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

# Create an invoice

> Create an invoice with items and customer information



## OpenAPI

````yaml post /invoices/create
openapi: 3.1.0
info:
  title: BitGPT 402pay API
  description: Full description of private and dev-availble API endpoints
  version: 1.0.0
  termsOfService: https://bitgpt.xyz/terms
  contact:
    name: API Support
    url: https://help.bitgpt.xyz
    email: support@bitgpt.xyz
servers:
  - url: https://api.bitgpt.xyz
    description: Production API server
security: []
tags:
  - name: Payments
    description: Invoice and payment management endpoints
  - name: Products
    description: Product management endpoints
  - name: dev-api
    description: Developer API endpoints
externalDocs:
  description: Full BitGPT 402pay API documentation
  url: https://docs.bitgpt.xyz
paths:
  /invoices/create:
    post:
      tags:
        - Payments
        - dev-api
      summary: Create an invoice
      description: Create an invoice with items and customer information
      operationId: createInvoice
      requestBody:
        $ref: '#/components/requestBodies/createInvoiceRequest'
      responses:
        '201':
          $ref: '#/components/responses/createInvoiceResponse'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
      security:
        - BearerAuth: []
          ApiKeyAuth: []
components:
  requestBodies:
    createInvoiceRequest:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/createInvoiceRequest'
  responses:
    '400':
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                enum:
                  - 400
                  - 401
                  - 403
                  - 404
                description: Status code of the response
              data:
                type:
                  - object
                  - 'null'
                description: Response data containing the requested object
              error:
                type:
                  - string
                  - 'null'
                examples:
                  - Invalid email address
                description: Error message of the response, human readable
              message:
                type: 'null'
              env:
                type: string
                enum:
                  - development
                  - production
                description: API environment
              log:
                type:
                  - string
                  - object
                  - 'null'
                examples:
                  - request_id: req_1234567890
                  - Some pertinent log message
                description: Useful informaiton, not always present, to debug the response
              validator:
                type:
                  - object
                  - 'null'
                examples:
                  - email: Invalid email address
                    password: Password is required
                description: >-
                  Validator response object, each key is the field name and
                  value is the error message
              support_id:
                type:
                  - string
                  - 'null'
                format: uuid
                examples:
                  - support_uuidv7-something-else
                description: >-
                  Support ID linked to the response, used to identify it when
                  talking with our team
            required:
              - status
              - error
              - message
              - env
              - log
              - validator
              - support_id
    '401':
      description: Access token is missing or invalid
      content:
        application/json:
          schema:
            allOf:
              - type: object
                properties:
                  status:
                    type: integer
                    enum:
                      - 400
                      - 401
                      - 403
                      - 404
                    description: Status code of the response
                  data:
                    type:
                      - object
                      - 'null'
                    description: Response data containing the requested object
                  error:
                    type:
                      - string
                      - 'null'
                    examples:
                      - Invalid email address
                    description: Error message of the response, human readable
                  message:
                    type: 'null'
                  env:
                    type: string
                    enum:
                      - development
                      - production
                    description: API environment
                  log:
                    type:
                      - string
                      - object
                      - 'null'
                    examples:
                      - request_id: req_1234567890
                      - Some pertinent log message
                    description: >-
                      Useful informaiton, not always present, to debug the
                      response
                  validator:
                    type:
                      - object
                      - 'null'
                    examples:
                      - email: Invalid email address
                        password: Password is required
                    description: >-
                      Validator response object, each key is the field name and
                      value is the error message
                  support_id:
                    type:
                      - string
                      - 'null'
                    format: uuid
                    examples:
                      - support_uuidv7-something-else
                    description: >-
                      Support ID linked to the response, used to identify it
                      when talking with our team
                required:
                  - status
                  - error
                  - message
                  - env
                  - log
                  - validator
                  - support_id
              - properties:
                  status:
                    type: integer
                    enum:
                      - 401
    '403':
      description: You do not have the required permissions to access this resource
      content:
        application/json:
          schema:
            allOf:
              - type: object
                properties:
                  status:
                    type: integer
                    enum:
                      - 400
                      - 401
                      - 403
                      - 404
                    description: Status code of the response
                  data:
                    type:
                      - object
                      - 'null'
                    description: Response data containing the requested object
                  error:
                    type:
                      - string
                      - 'null'
                    examples:
                      - Invalid email address
                    description: Error message of the response, human readable
                  message:
                    type: 'null'
                  env:
                    type: string
                    enum:
                      - development
                      - production
                    description: API environment
                  log:
                    type:
                      - string
                      - object
                      - 'null'
                    examples:
                      - request_id: req_1234567890
                      - Some pertinent log message
                    description: >-
                      Useful informaiton, not always present, to debug the
                      response
                  validator:
                    type:
                      - object
                      - 'null'
                    examples:
                      - email: Invalid email address
                        password: Password is required
                    description: >-
                      Validator response object, each key is the field name and
                      value is the error message
                  support_id:
                    type:
                      - string
                      - 'null'
                    format: uuid
                    examples:
                      - support_uuidv7-something-else
                    description: >-
                      Support ID linked to the response, used to identify it
                      when talking with our team
                required:
                  - status
                  - error
                  - message
                  - env
                  - log
                  - validator
                  - support_id
              - properties:
                  status:
                    type: integer
                    enum:
                      - 403
    createInvoiceResponse:
      description: Invoice created successfully
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Response200'
              - $ref: '#/components/schemas/createInvoiceResponse'
  schemas:
    createInvoiceRequest:
      type: object
      description: Request body for creating a new invoice
      properties:
        items:
          type: array
          minItems: 1
          items:
            oneOf:
              - type: object
                description: Invoice item for product type
                required:
                  - type
                  - product_id
                  - quantity
                properties:
                  type:
                    type: string
                    enum:
                      - PRODUCT
                    description: Type of invoice item
                  product_id:
                    type: string
                    description: Product ID
                  quantity:
                    type: integer
                    minimum: 1
                    description: Quantity
                  billing_schema_id:
                    type: string
                    description: >-
                      Billing schema ID (optional for PRODUCT type). Required if
                      product has multiple billing schemas.
                examples:
                  - type: PRODUCT
                    product_id: product_0197a8d9-8426-7e71-9edf-26301686ed26
                    billing_schema_id: schema_0197a8d9-8427-7dc4-9b9f-4e29594b5d12
                    quantity: 2
              - type: object
                description: Invoice item for payment intent type
                required:
                  - type
                  - price
                  - currency
                properties:
                  type:
                    type: string
                    enum:
                      - PAYMENT_INTENT
                    description: Type of invoice item
                  currency:
                    $ref: '#/components/schemas/currency'
                    description: Currency code for the item
                  price:
                    type:
                      - number
                      - string
                    description: Price
                  payment_intent_id:
                    type: string
                    description: Payment intent ID (optional for PAYMENT_INTENT type)
                examples:
                  - type: PAYMENT_INTENT
                    currency: AUD
                    price: '501'
        customer_email:
          type: string
          format: email
          description: Customer email address
        currency:
          $ref: '#/components/schemas/currency'
          description: >-
            Main currency for calculation (optional, can be determined from
            items). You must specify currency if all items do not have the same
            currency
        metadata:
          type: object
          description: Additional metadata for the invoice
        redirect_url:
          type: string
          format: uri
          description: URL to redirect to after payment completion
      required:
        - items
        - customer_email
      examples:
        - customer_email: test@test.tt
          currency: EUR
          metadata:
            a: b
            c: d
            e: f
            i: j
          redirect_url: https://example.com/success
          items:
            - type: PAYMENT_INTENT
              currency: AUD
              price: '501'
            - type: PAYMENT_INTENT
              currency: BITCOIN
              price: '0.001'
            - type: PAYMENT_INTENT
              currency: GBP
              price: '10'
            - type: PRODUCT
              product_id: product_0197a8d9-8426-7e71-9edf-26301686ed26
              billing_schema_id: schema_0197a8d9-8427-7dc4-9b9f-4e29594b5d12
              quantity: 2
    Response200:
      type: object
      properties:
        status:
          type: integer
          enum:
            - 200
            - 201
            - 202
          description: Status code of the response
        data:
          type:
            - object
            - array
            - 'null'
          description: Response data containing the requested object
        error:
          type:
            - string
            - 'null'
          examples:
            - Invalid email address
          description: Error message of the response, human readable
        message:
          type:
            - string
            - 'null'
          examples:
            - Resource created successfully
          description: Message of the response, human readable
        env:
          type: string
          enum:
            - development
            - production
          description: API environment
        log:
          type:
            - string
            - object
            - 'null'
          examples:
            - request_id: req_1234567890
            - Some pertinent log message
          description: Useful informaiton, not always present, to debug the response
        validator:
          type:
            - object
            - 'null'
          examples:
            - email: Invalid email address
              password: Password is required
          description: >-
            Validator response object, each key is the field name and value is
            the error message
        support_id:
          type:
            - string
            - 'null'
          format: uuid
          examples:
            - support_uuidv7-something-else
          description: >-
            Support ID linked to the response, used to identify it when talking
            with our team
      required:
        - status
        - data
        - message
        - env
      examples:
        - status: 200
          data:
            id: '123'
          error: null
          log: null
          validator: null
          support_id: null
          message: Resource created successfully
          env: development
    createInvoiceResponse:
      type: object
      description: Invoice created successfully
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              description: Created invoice ID
          required:
            - id
      required:
        - data
      examples:
        - status: 201
          data:
            id: invoice_0197d561-ead7-75b4-b037-2580e9bbc40f
    currency:
      type: string
      enum:
        - BITCOIN
        - ETHEREUM
        - USDT
        - USDC
        - USDC_NATIVE
        - SOLANA
        - BINANCE_COIN
        - RIPPLE
        - POLYGON
        - TRON
        - LITECOIN
        - BITCOIN_CASH
        - DOGECOIN
        - USD
        - EUR
        - CHF
        - GBP
        - AUD
        - JPY
        - CNY
        - CAD
        - HKD
        - SGD
        - SEK
        - KRW
        - NOK
        - NZD
        - INR
        - MXN
        - TWD
        - ZAR
        - BRL
        - DKK
        - PLN
        - THB
        - ILS
        - IDR
        - CZK
        - AED
        - TRY
        - HUF
        - CLP
        - SAR
        - PHP
        - MYR
        - COP
        - RUB
        - RON
        - PEN
      examples:
        - GBP
        - BITCOIN
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Send your access token as header Authorization: Bearer {accessToken}'
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Your API key that starts with sk_live or sk_test. You can create yours
        at go.bitgpt.xyz/api-keys.

````