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

# Create Customer



## OpenAPI

````yaml https://app.flowglad.com/api/openapi post /api/v1/customers
openapi: 3.1.0
info:
  title: Flowglad API
  version: 0.0.1
servers:
  - url: https://app.flowglad.com
security: []
externalDocs:
  url: https://docs.flowglad.com
paths:
  /api/v1/customers:
    post:
      tags:
        - Customer
      summary: Create Customer
      operationId: customers-create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customer:
                  $ref: '#/components/schemas/CustomerClientInsertSchema'
              required:
                - customer
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      customer:
                        $ref: '#/components/schemas/CustomerClientSelectSchema'
                      subscription:
                        $ref: '#/components/schemas/SubscriptionClientSelectSchema'
                      subscriptionItems:
                        type: array
                        items:
                          $ref: '#/components/schemas/SubscriptionItemRecordOutput'
                    required:
                      - customer
                    additionalProperties: false
                required:
                  - data
                additionalProperties: false
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '401':
          description: Authorization not provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.UNAUTHORIZED'
        '403':
          description: Insufficient access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.FORBIDDEN'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.INTERNAL_SERVER_ERROR'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CustomerClientInsertSchema:
      type: object
      properties:
        email:
          type: string
        name:
          type: string
        archived:
          type: boolean
        logoURL:
          anyOf:
            - type: string
            - type: 'null'
        iconURL:
          anyOf:
            - type: string
            - type: 'null'
        domain:
          anyOf:
            - type: string
            - type: 'null'
        externalId:
          type: string
        userId:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - email
        - name
        - externalId
    CustomerClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        email:
          type: string
        name:
          type: string
        invoiceNumberBase:
          anyOf:
            - type: string
            - type: 'null'
        archived:
          type: boolean
        logoURL:
          anyOf:
            - type: string
            - type: 'null'
        iconURL:
          anyOf:
            - type: string
            - type: 'null'
        domain:
          anyOf:
            - type: string
            - type: 'null'
        billingAddress:
          anyOf:
            - $ref: '#/components/schemas/BillingAddress'
            - type: 'null'
        externalId:
          type: string
        userId:
          anyOf:
            - type: string
            - type: 'null'
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - email
        - name
        - invoiceNumberBase
        - archived
        - logoURL
        - iconURL
        - domain
        - externalId
        - userId
        - pricingModelId
      additionalProperties: false
    SubscriptionClientSelectSchema:
      oneOf:
        - $ref: '#/components/schemas/StandardSubscriptionRecord'
        - $ref: '#/components/schemas/NonRenewingSubscriptionRecord'
      type: object
      discriminator:
        propertyName: renews
        mapping:
          'true':
            $ref: '#/components/schemas/StandardSubscriptionRecord'
          'false':
            $ref: '#/components/schemas/NonRenewingSubscriptionRecord'
    SubscriptionItemRecordOutput:
      $ref: '#/components/schemas/StaticSubscriptionItemClientSelectSchemaOutput'
    error.BAD_REQUEST:
      title: Invalid input data error (400)
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Invalid input data
          type: string
        code:
          description: The error code
          example: BAD_REQUEST
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    error.UNAUTHORIZED:
      title: Authorization not provided error (401)
      description: The error information
      example:
        code: UNAUTHORIZED
        message: Authorization not provided
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Authorization not provided
          type: string
        code:
          description: The error code
          example: UNAUTHORIZED
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    error.FORBIDDEN:
      title: Insufficient access error (403)
      description: The error information
      example:
        code: FORBIDDEN
        message: Insufficient access
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Insufficient access
          type: string
        code:
          description: The error code
          example: FORBIDDEN
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    error.INTERNAL_SERVER_ERROR:
      title: Internal server error error (500)
      description: The error information
      example:
        code: INTERNAL_SERVER_ERROR
        message: Internal server error
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Internal server error
          type: string
        code:
          description: The error code
          example: INTERNAL_SERVER_ERROR
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    BillingAddress:
      type: object
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
        firstName:
          anyOf:
            - type: string
            - type: 'null'
        lastName:
          anyOf:
            - type: string
            - type: 'null'
        email:
          anyOf:
            - type: string
              format: email
              pattern: >-
                ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
            - type: 'null'
        address:
          type: object
          properties:
            name:
              anyOf:
                - type: string
                - type: 'null'
            line1:
              anyOf:
                - type: string
                - type: 'null'
            line2:
              anyOf:
                - type: string
                - type: 'null'
            city:
              anyOf:
                - type: string
                - type: 'null'
            state:
              anyOf:
                - type: string
                - type: 'null'
            postal_code:
              anyOf:
                - type: string
                - type: 'null'
            country:
              type: string
          required:
            - country
          additionalProperties: false
        phone:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - address
      additionalProperties: false
    StandardSubscriptionRecord:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        startDate:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        customerId:
          type: string
        organizationId:
          type: string
        status:
          type: string
          enum:
            - trialing
            - active
            - past_due
            - unpaid
            - cancellation_scheduled
            - incomplete
            - incomplete_expired
            - canceled
            - paused
        defaultPaymentMethodId:
          anyOf:
            - type: string
            - type: 'null'
        backupPaymentMethodId:
          anyOf:
            - type: string
            - type: 'null'
        trialEnd:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        currentBillingPeriodStart:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        currentBillingPeriodEnd:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        metadata:
          anyOf:
            - $ref: '#/components/schemas/Metadata'
            - type: 'null'
        canceledAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        cancelScheduledAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        cancellationReason:
          anyOf:
            - type: string
            - type: 'null'
        replacedBySubscriptionId:
          anyOf:
            - type: string
            - type: 'null'
        isFreePlan:
          anyOf:
            - type: boolean
            - type: 'null'
        doNotCharge:
          anyOf:
            - type: boolean
            - type: 'null'
        priceId:
          type: string
        runBillingAtPeriodStart:
          anyOf:
            - type: boolean
            - type: 'null'
        interval:
          type: string
          enum:
            - day
            - week
            - month
            - year
        intervalCount:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        billingCycleAnchorDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        name:
          anyOf:
            - type: string
            - type: 'null'
        renews:
          type: boolean
          const: true
        pricingModelId:
          type: string
        scheduledAdjustmentAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        current:
          description: >-
            Whether the subscription is current (statuses "active", "trialing",
            "past_due", or "cancellation_scheduled")
          type: boolean
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - startDate
        - customerId
        - organizationId
        - status
        - defaultPaymentMethodId
        - backupPaymentMethodId
        - cancellationReason
        - replacedBySubscriptionId
        - isFreePlan
        - doNotCharge
        - priceId
        - runBillingAtPeriodStart
        - interval
        - intervalCount
        - name
        - renews
        - pricingModelId
        - current
      additionalProperties: false
    NonRenewingSubscriptionRecord:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        startDate:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        customerId:
          type: string
        organizationId:
          type: string
        status:
          type: string
          enum:
            - active
            - canceled
            - credit_trial
        defaultPaymentMethodId:
          anyOf:
            - type: string
            - type: 'null'
        backupPaymentMethodId:
          anyOf:
            - type: string
            - type: 'null'
        trialEnd:
          description: Omitted.
          type: 'null'
        currentBillingPeriodStart:
          description: Omitted.
          type: 'null'
        currentBillingPeriodEnd:
          description: Omitted.
          type: 'null'
        metadata:
          anyOf:
            - $ref: '#/components/schemas/Metadata'
            - type: 'null'
        canceledAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        cancelScheduledAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        cancellationReason:
          anyOf:
            - type: string
            - type: 'null'
        replacedBySubscriptionId:
          anyOf:
            - type: string
            - type: 'null'
        isFreePlan:
          anyOf:
            - type: boolean
            - type: 'null'
        doNotCharge:
          anyOf:
            - type: boolean
            - type: 'null'
        priceId:
          type: string
        runBillingAtPeriodStart:
          anyOf:
            - type: boolean
            - type: 'null'
        interval:
          description: Omitted.
          type: 'null'
        intervalCount:
          description: Omitted.
          type: 'null'
        billingCycleAnchorDate:
          description: Omitted.
          type: 'null'
        name:
          anyOf:
            - type: string
            - type: 'null'
        renews:
          type: boolean
          const: false
        pricingModelId:
          type: string
        scheduledAdjustmentAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        current:
          description: >-
            Whether the subscription is current (statuses "active", "trialing",
            "past_due", "cancellation_scheduled", or "credit_trial")
          type: boolean
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - startDate
        - customerId
        - organizationId
        - status
        - defaultPaymentMethodId
        - backupPaymentMethodId
        - trialEnd
        - currentBillingPeriodStart
        - currentBillingPeriodEnd
        - cancellationReason
        - replacedBySubscriptionId
        - isFreePlan
        - doNotCharge
        - priceId
        - runBillingAtPeriodStart
        - interval
        - intervalCount
        - billingCycleAnchorDate
        - name
        - renews
        - pricingModelId
        - current
      additionalProperties: false
    StaticSubscriptionItemClientSelectSchemaOutput:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        subscriptionId:
          type: string
        name:
          anyOf:
            - type: string
            - type: 'null'
        addedDate:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        priceId:
          anyOf:
            - type: string
            - type: 'null'
        unitPrice:
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        quantity:
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        metadata:
          anyOf:
            - $ref: '#/components/schemas/Metadata'
            - type: 'null'
        type:
          type: string
          const: static
        externalId:
          anyOf:
            - type: string
            - type: 'null'
        expiredAt:
          description: >-
            Used as a flag to soft delete a subscription item without losing its
            history for auditability. If set, it will be removed from the
            subscription items list and will not be included in the billing
            period item list. Epoch milliseconds.
          anyOf:
            - description: >-
                Used as a flag to soft delete a subscription item without losing
                its history for auditability. If set, it will be removed from
                the subscription items list and will not be included in the
                billing period item list. Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        manuallyCreated:
          type: boolean
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - subscriptionId
        - name
        - addedDate
        - priceId
        - unitPrice
        - quantity
        - type
        - externalId
        - manuallyCreated
        - pricingModelId
      additionalProperties: false
    Metadata:
      description: JSON object
      type: object
      propertyNames:
        type: string
      additionalProperties:
        anyOf:
          - type: string
            maxLength: 500
          - type: number
          - type: boolean
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````