> ## Documentation Index
> Fetch the complete documentation index at: https://docs.useaira.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create credit pool

> Creates a new credit pool for a customer.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/credit-pools/
openapi: 3.1.0
info:
  title: API Reference
  version: '1.0'
  description: Aira API Reference
  x-logo:
    url: https://static.useaira.com/images/airalogo.svg
    backgroundColor: '#FFFFFF'
    altText: Aira Logo
servers:
  - url: https://api.useaira.com
    description: API base URL
security:
  - ApiKey: []
paths:
  /v1/credit-pools/:
    post:
      tags:
        - Credit Pools
      summary: Create credit pool
      description: Creates a new credit pool for a customer.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                customerId:
                  type: string
                  format: uuid
                  description: >-
                    The unique identifier of the customer the credit pool
                    belongs to.
                currencyUnitCode:
                  type: string
                  description: >-
                    Code of the currency unit the pool's credits are denominated
                    in. Must be a non-default currency unit registered on the
                    tenant.
                  example: USD
                startDate:
                  type: string
                  format: date
                  description: >-
                    Date the credit pool starts, when the initial credits are
                    loaded.
                renewalCreditAmount:
                  type: string
                  pattern: ^\d+(\.\d{1,6})?$
                  description: >-
                    Amount of credits granted to the pool on each renewal, as a
                    decimal string in the pool's currency unit.
                topUpSettings:
                  type: object
                  description: >-
                    The top-up settings of the credit pool: the credit package
                    purchased when the pool's balance needs replenishing.
                  properties:
                    creditPackageAmount:
                      type: string
                      pattern: ^\d+(\.\d{1,6})?$
                      description: >-
                        Amount of credits granted per purchased package, as a
                        decimal string in the pool's currency unit.
                    price:
                      type: number
                      multipleOf: 1
                      minimum: 1
                      description: Price billed per purchased package, in cents.
                  required:
                    - creditPackageAmount
                    - price
                  additionalProperties: false
              required:
                - customerId
                - currencyUnitCode
                - startDate
                - renewalCreditAmount
                - topUpSettings
              additionalProperties: false
        required: true
        description: A credit pool object with initial configuration and top-up settings.
      responses:
        '201':
          description: >-
            The request was successfully processed, and the credit pool has been
            created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: The unique identifier of the credit pool in our system.
                  customerId:
                    type: string
                    format: uuid
                    description: >-
                      The unique identifier of the customer the credit pool
                      belongs to.
                  currencyUnitId:
                    type: string
                    format: uuid
                    description: >-
                      The unique identifier of the currency unit the pool's
                      credits are denominated in.
                  startDate:
                    type: string
                    format: date
                    description: >-
                      Date the credit pool starts, when the initial credits are
                      loaded.
                  renewalCreditAmount:
                    type: string
                    pattern: ^\d+(\.\d{1,6})?$
                    description: >-
                      Amount of credits granted to the pool on each renewal, as
                      a decimal string in the pool's currency unit.
                  availableAmount:
                    type: string
                    pattern: ^\d+(\.\d{1,6})?$
                    description: >-
                      Current credit balance available for consumption, as a
                      decimal string in the pool's currency unit.
                  scheduleRenewalDate:
                    type: string
                    format: date
                    description: >-
                      Date of the next scheduled renewal, when
                      renewalCreditAmount is granted to the pool.
                  topUpSettings:
                    type: object
                    description: >-
                      Schema representing the top-up settings of a credit pool:
                      the credit package purchased when the pool's balance needs
                      replenishing. Purchases appear on invoices as credit
                      purchase line items.
                    properties:
                      createdBy:
                        type: string
                        format: uuid
                        description: >-
                          The unique identifier of the user who configured the
                          top-up settings.
                      creditPackageAmount:
                        type: string
                        pattern: ^\d+(\.\d{1,6})?$
                        description: >-
                          Amount of credits granted per purchased package, as a
                          decimal string in the pool's currency unit.
                      price:
                        type: number
                        multipleOf: 1
                        minimum: 1
                        description: Price billed per purchased package, in cents.
                    required:
                      - createdBy
                      - creditPackageAmount
                      - price
                    additionalProperties: false
                  currencyUnit:
                    type: object
                    description: >-
                      Schema representing a currency unit: the unit credits and
                      credit-consuming usage are denominated in. BRL is the
                      default; tenants can define custom credit units.
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: >-
                          The unique identifier of the currency unit in our
                          system.
                      name:
                        type: string
                        description: Display name of the currency unit.
                      code:
                        type: string
                        description: Short code of the currency unit (e.g. BRL).
                        example: BRL
                    required:
                      - id
                      - name
                      - code
                    additionalProperties: false
                required:
                  - id
                  - customerId
                  - currencyUnitId
                  - startDate
                  - renewalCreditAmount
                  - availableAmount
                  - scheduleRenewalDate
                  - topUpSettings
                  - currencyUnit
                additionalProperties: false
        '400':
          description: Error object returned to the client.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A human-readable description of the error
                  code:
                    type: string
                    description: A unique identifier for the type of error
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      Additional context about the error, such as invalid fields
                      or constraints. Each endpoint may include specific error
                      details in their documentation
                  causations:
                    type: array
                    description: >-
                      Optional array of error objects following the same
                      structure as the parent error. Only present when there's a
                      meaningful chain of related errors to expose
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: >-
                            A human-readable description of the underlying error
                            cause
                        code:
                          type: string
                          description: A unique identifier for the type of underlying error
                        details:
                          type: object
                          additionalProperties: true
                          description: Additional context about the underlying error
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - code
                  - message
                additionalProperties: false
        '404':
          description: Error object returned to the client when a resource is not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A human-readable description of the error
components:
  securitySchemes:
    ApiKey:
      type: apiKey
      description: API Key Authentication.
      name: X-API-KEY
      in: header

````