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

# Create a customer

> Creates a new customer with optional contacts, billing address, aliases, and a required default currency.



## OpenAPI

````yaml /api-reference/specs/2026-04-01.json post /customers
openapi: 3.1.0
info:
  description: >-
    Alguna is the AI-native quote-to-revenue platform for B2B companies: CPQ,
    subscription and usage-based billing, invoicing, payment collection, and
    revenue recognition in one system of record. The API operates on one
    versioned agreement per customer: quotes, subscriptions and their versions,
    usage, invoices, payments, and revenue schedules read from it. Official
    SDKs: TypeScript (@alguna/sdk), Python (alguna), Go
    (github.com/alguna-io/alguna-go), Rust (alguna), and the alguna CLI
    (@alguna/cli).
  title: Alguna Public API
  version: '2026-04-01'
servers:
  - url: https://api.alguna.io
    x-fern-server-name: Production
security:
  - bearerAuth: []
tags:
  - name: Billing Events and Metrics
  - name: Checkout Sessions
  - name: Credit Notes
  - name: Credits
  - name: Customer Portal Sessions
  - name: Customers
  - name: Feedback
  - name: Insights
  - name: Integrations
  - name: Invoices
  - name: Merchants
  - name: Payments
  - name: Plans
  - name: Product Bundles
  - name: Products
  - name: Quotes
  - name: Refunds
  - name: Revenue Schedules
  - name: Subscription Changes
  - name: Subscription Versions
  - name: Subscriptions
  - name: Tags
  - name: Tax
  - name: Users
  - name: Wallet Grants
  - name: Wallets
paths:
  /customers:
    post:
      tags:
        - Customers
      summary: Create a customer
      description: >-
        Creates a new customer with optional contacts, billing address, aliases,
        and a required default currency.
      operationId: create-customer
      parameters:
        - in: header
          name: Alguna-Version
          required: true
          schema:
            enum:
              - '2026-04-01'
            type: string
        - in: header
          name: Idempotency-Key
          schema:
            description: >-
              A unique string that makes a retried write safe. If you send the
              same request with the same key within 24 hours, the API returns
              the stored response and does not run the request again. A 5xx or
              429 response is not stored, so a retry with that key runs the
              request again.
            example: ik_a1b2c3d4e5f6
            maxLength: 255
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustomerRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
          description: Success
          headers:
            Idempotency-Key:
              description: Echo of the idempotency key provided in the request
              schema:
                type: string
            Idempotent-Replayed:
              description: >-
                Whether this response was replayed from a previous request
                (true) or freshly executed (false)
              schema:
                type: boolean
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ErrorResponse'
                  - $ref: '#/components/schemas/GatewayErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden — the organization does not have access to this feature
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            Conflict — a request with this idempotency key is currently being
            processed
          headers:
            Retry-After:
              description: >-
                Seconds to wait before retrying with the same idempotency key.
                Sent only when a request with this key is still being processed;
                a 409 without it is a conflict that a retry will not resolve.
              schema:
                type: integer
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '502':
          description: >-
            Bad Gateway — sent by the infrastructure in front of the API; the
            body is not JSON. Safe to retry.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            Service Unavailable — a dependency is temporarily unavailable. Retry
            with backoff.
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            Gateway Timeout — the request did not finish in time. Retry with
            backoff; use an idempotency key for writes.
components:
  schemas:
    CreateCustomerRequest:
      properties:
        aliases:
          description: Alternative identifiers for the customer
          items:
            type: string
          nullable: true
          type: array
        autopay_timing:
          allOf:
            - $ref: '#/components/schemas/AutopayTiming'
          description: >-
            When auto-pay charges the customer's invoices. on_issue: when the
            invoice is issued. on_due_date: on the invoice's due date. Defaults
            to the organization's default Autopay Timing.
          example: on_due_date
          nullable: true
        billing_address:
          allOf:
            - $ref: '#/components/schemas/AddressRequest'
          description: Customer billing address
          nullable: true
        contacts:
          description: Customer contacts
          items:
            $ref: '#/components/schemas/ContactRequest'
          type: array
        currency:
          description: ISO 4217 currency code
          example: USD
          type: string
        name:
          description: The name of the customer
          example: Acme Corp
          type: string
        parent_customer_id:
          description: >-
            The parent customer to nest this customer under: its ID, an alias or
            a connected-account external ID. The parent must not itself be a
            child customer.
          example: cust_parent123
          minLength: 1
          nullable: true
          type: string
      required:
        - currency
        - name
      type: object
    CustomerResponse:
      properties:
        aliases:
          description: Alternative identifiers for the customer
          items:
            type: string
          type: array
        assignments:
          description: >-
            Users assigned to the customer, such as the account executive and
            customer success manager
          items:
            $ref: '#/components/schemas/CustomerAssignment'
          type: array
        autopay_timing:
          allOf:
            - $ref: '#/components/schemas/AutopayTiming'
          description: >-
            When auto-pay charges the customer's invoices. on_issue: when the
            invoice is issued. on_due_date: on the invoice's due date.
            Subscriptions and invoices can override it.
          example: on_issue
        billing_address:
          allOf:
            - $ref: '#/components/schemas/AddressResponse'
          description: Customer billing address
          nullable: true
        contacts:
          description: Customer contacts
          items:
            $ref: '#/components/schemas/ContactResponse'
          type: array
        created_at:
          description: Timestamp when the customer was created
          example: '2026-04-01T10:00:00Z'
          format: date-time
          type: string
        currency:
          description: ISO 4217 currency code
          example: USD
          type: string
        id:
          description: Unique identifier for the customer
          example: cust_abc123
          type: string
        name:
          description: Customer name
          example: Acme Corp
          type: string
        parent_customer_id:
          description: ID of the parent customer this customer is nested under
          example: cust_parent123
          nullable: true
          type: string
        tax_country:
          description: ISO 3166-1 alpha-3 country code used for tax determination
          example: DEU
          nullable: true
          type: string
        tax_id:
          description: Customer tax identification number
          example: DE123456789
          nullable: true
          type: string
        tax_rate:
          description: >-
            Tax rate applied to the customer, expressed as a decimal fraction
            (0.20 = 20%)
          example: '0.20'
          nullable: true
          type: string
        tax_reason:
          allOf:
            - $ref: '#/components/schemas/TaxabilityReason'
          description: Reason determining how tax is applied to the customer
          example: standard_rated
          nullable: true
        tax_status:
          description: Customer tax status
          example: taxable
          nullable: true
          type: string
        tax_type:
          allOf:
            - $ref: '#/components/schemas/TaxType'
          description: Type of tax applied to the customer
          example: vat
          nullable: true
        updated_at:
          description: Timestamp when the customer was last updated
          example: '2026-04-01T12:30:00Z'
          format: date-time
          type: string
      required:
        - assignments
        - autopay_timing
        - created_at
        - currency
        - id
        - name
        - updated_at
      type: object
    ErrorResponse:
      description: The body of every error the API returns.
      properties:
        code:
          description: >-
            Machine-readable error code, such as `not_found` or
            `invoice_already_issued`. New codes may be added at any time, so
            handle a code you do not know by its HTTP status.
          type: string
        detail:
          description: Explanation of what went wrong
          type: string
        request_id:
          description: >-
            Identifies the request, as the `X-Request-Id` response header does.
            Quote it when contacting support.
          type: string
        status:
          description: HTTP status code of the response
          format: int64
          type: integer
        title:
          description: >-
            HTTP status text. Sent only by version, idempotency and
            credit-refusal errors.
          type: string
        type:
          description: Always `about:blank`. Sent only by version and idempotency errors.
          type: string
      required:
        - status
        - detail
      type: object
    GatewayErrorResponse:
      description: >-
        Returned by the API gateway when a request carries no valid API key,
        before the API handles it.
      properties:
        code:
          description: Machine-readable error code, e.g. `unauthenticated`
          type: string
        details:
          nullable: true
          type: object
        message:
          description: Explanation of what went wrong
          type: string
      required:
        - code
        - message
      type: object
    AutopayTiming:
      enum:
        - on_issue
        - on_due_date
      type: string
    AddressRequest:
      properties:
        city:
          description: City
          example: San Francisco
          minLength: 1
          type: string
        country:
          description: ISO 3166-1 alpha-3 country code
          example: USA
          minLength: 1
          type: string
        line1:
          description: Street address line 1
          example: 123 Main St
          minLength: 1
          type: string
        line2:
          description: Street address line 2
          example: Suite 100
          type: string
        postal_code:
          description: Postal or ZIP code
          example: '94105'
          minLength: 1
          type: string
        state:
          description: >-
            State or province. For US and Canadian addresses, a two-letter code
            or the full name; the customer stores the code. Any other value is
            rejected.
          example: CA
          minLength: 1
          type: string
      required:
        - city
        - country
        - line1
        - postal_code
        - state
      type: object
    ContactRequest:
      properties:
        email:
          description: Contact email address
          example: john@example.com
          type: string
        email_preferences:
          description: Email notification preferences
          items:
            type: string
          nullable: true
          type: array
        first_name:
          description: Contact first name
          example: John
          nullable: true
          type: string
        id:
          description: Contact ID for updating existing contacts
          nullable: true
          type: string
        is_primary:
          description: Whether this is the primary contact
          example: true
          type: boolean
        last_name:
          description: Contact last name
          example: Doe
          nullable: true
          type: string
      required:
        - email
        - is_primary
      type: object
    CustomerAssignment:
      properties:
        type:
          description: >-
            Role the user holds on the customer: account executive (sales) or
            customer success manager (customer_success)
          enum:
            - sales
            - customer_success
          example: sales
          type: string
        user_id:
          description: User ID of the assignee; resolve it with the users endpoints
          example: usr_abc123
          type: string
      required:
        - type
        - user_id
      type: object
    AddressResponse:
      properties:
        city:
          description: City
          example: San Francisco
          type: string
        country:
          description: ISO 3166-1 alpha-3 country code
          example: USA
          type: string
        line1:
          description: Street address line 1
          example: 123 Main St
          type: string
        line2:
          description: Street address line 2
          example: Suite 100
          type: string
        postal_code:
          description: Postal or ZIP code
          example: '94105'
          type: string
        state:
          description: State or province
          example: CA
          type: string
      required:
        - city
        - country
        - line1
        - postal_code
        - state
      type: object
    ContactResponse:
      properties:
        email:
          description: Contact email address
          example: john@example.com
          type: string
        email_preferences:
          description: Email notification preferences
          items:
            type: string
          nullable: true
          type: array
        first_name:
          description: Contact first name
          example: John
          nullable: true
          type: string
        id:
          description: Unique identifier for the contact
          example: cont_abc123
          type: string
        is_primary:
          description: Whether this is the primary contact
          example: true
          type: boolean
        last_name:
          description: Contact last name
          example: Doe
          nullable: true
          type: string
      required:
        - email
        - id
        - is_primary
      type: object
    TaxabilityReason:
      enum:
        - standard_rated
        - reverse_charge
        - not_collecting
        - customer_exempt
        - zero_rated
        - other
      type: string
    TaxType:
      enum:
        - gst
        - hst
        - igst
        - jct
        - lease_tax
        - pst
        - qst
        - sales_tax
        - service_tax
        - vat
      type: string
  securitySchemes:
    bearerAuth:
      bearerFormat: API Key
      description: API key authentication. Pass your API key as a Bearer token.
      scheme: bearer
      type: http
      x-fern-bearer:
        env: ALGUNA_API_KEY
        name: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.