> ## 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 a new product

> Create a new product with billing schemas for the authenticated organization



## OpenAPI

````yaml post /products
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:
  /products:
    post:
      tags:
        - Products
        - dev-api
      summary: Create a new product
      description: >-
        Create a new product with billing schemas for the authenticated
        organization
      operationId: createProduct
      requestBody:
        $ref: '#/components/requestBodies/createProductRequest'
      responses:
        '201':
          $ref: '#/components/responses/createProductResponse'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
      security:
        - BearerAuth: []
          ApiKeyAuth: []
components:
  requestBodies:
    createProductRequest:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/createProductRequest'
  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
    createProductResponse:
      description: Product created successfully
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Response200'
              - $ref: '#/components/schemas/createProductResponse'
  schemas:
    createProductRequest:
      allOf:
        - $ref: '#/components/schemas/productCreate'
    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
    createProductResponse:
      type: object
      description: Response for successful product creation
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              description: Created product ID
          required:
            - id
      required:
        - data
      examples:
        - data:
            id: product_0197ebcc-b7f9-79b6-8a92-569ea231fc4d
    productCreate:
      type: object
      description: Request body for creating a new product
      properties:
        name:
          type: string
          description: Product name
          examples:
            - Product number One
        description:
          type: string
          description: Product description
          examples:
            - Good products's description
        metadata:
          type: object
          description: Additional metadata for the product
        schemas:
          type: array
          description: Array of billing schemas for the product
          items:
            $ref: '#/components/schemas/billingSchemaCreate'
      examples:
        - name: 'ONE_TIME PRODUCT #2'
          description: 'ONE_TIME PRODUCT DESCRIPTION #2'
          metadata:
            id: elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn
            email: test@test.tt
            custom: custom field
          schemas:
            - name: Basic Product
              description: Basic Product Schema 1234
              currency: GBP
              type: RECURRING
              base_price: 104.04
              interval_type: MONTH
              interval_count: 1
              payment_type: ARREARS
              renew_type: CALENDAR
              billing_type: FULL
              configurations:
                - starts_at: 1
                  ends_at: 2
                  price_per_unit: 5
                  metric:
                    id: metric_01978a62-4297-70fb-8bac-3c43e91e0d30
                    metric_key: metric_key
                    name: Metric
                    aggregation_type: SUM
    billingSchemaCreate:
      type: object
      description: Request body for creating a new billing schema
      properties:
        name:
          type: string
          description: Schema name
          examples:
            - Basic Product
        description:
          type:
            - string
            - 'null'
          description: Schema description
          examples:
            - Basic Product Schema
        currency:
          $ref: '#/components/schemas/currency'
          description: Currency code
        type:
          type: string
          enum:
            - ONE_TIME
            - RECURRING
            - USAGE_BASED
            - TIERED_USAGE
          description: Billing schema type
        base_price:
          type:
            - string
            - number
          format: decimal
          description: Price
        interval_type:
          type:
            - string
            - 'null'
          enum:
            - DAY
            - WEEK
            - MONTH
            - YEAR
            - null
          description: Billing interval type
        interval_count:
          type:
            - number
            - 'null'
          description: Billing interval count
        payment_type:
          type:
            - string
            - 'null'
          enum:
            - ADVANCE
            - ARREARS
            - null
          description: Payment type
        renew_type:
          type:
            - string
            - 'null'
          enum:
            - CALENDAR
            - ANNIVERSARY
            - null
          description: Renewal type
        billing_type:
          type:
            - string
            - 'null'
          enum:
            - PRORATED
            - FULL
            - null
          description: Billing type
        configurations:
          type: array
          description: Array of billing configurations for the schema
          items:
            $ref: '#/components/schemas/billingConfigurationCreate'
      required:
        - name
        - currency
        - type
        - base_price
      examples:
        - name: Basic Product
          description: Basic Product Schema 1234
          currency: GBP
          type: RECURRING
          base_price: 104.04
          interval_type: MONTH
          interval_count: 1
          payment_type: ARREARS
          renew_type: CALENDAR
          billing_type: FULL
          configurations:
            - starts_at: 1
              ends_at: 2
              price_per_unit: 5
              metric:
                id: metric_01978a62-4297-70fb-8bac-3c43e91e0d30
                metric_key: metric_key
                name: Metric
                aggregation_type: SUM
    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
    billingConfigurationCreate:
      type: object
      description: Request body for creating a new billing configuration
      properties:
        starts_at:
          type:
            - number
            - string
            - 'null'
          description: Start value for the configuration range
        ends_at:
          type:
            - number
            - string
            - 'null'
          description: End value for the configuration range
        price_per_unit:
          type:
            - string
            - number
          format: decimal
          description: Price per unit
        metric:
          $ref: '#/components/schemas/billingMetricCreate'
      required:
        - starts_at
        - ends_at
        - price_per_unit
        - metric
    billingMetricCreate:
      type: object
      description: Request body for creating a new billing metric
      properties:
        metric_key:
          type: string
          description: Metric key identifier
        name:
          type: string
          description: Metric name
        aggregation_type:
          type: string
          description: Type of aggregation for the metric
          enum:
            - SUM
            - MAX
            - MIN
            - COUNT
            - AVG
            - LAST
            - FIRST
            - MEDIAN
            - MODE
            - RANGE
            - STANDARD_DEVIATION
            - VARIANCE
      required:
        - metric_key
        - name
        - aggregation_type
  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.

````