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

# Create customer

> Use when onboarding a new billing customer (e.g. sign-up or CRM sync). Ideal for linking via external_customer_id to your app's user id.



## OpenAPI

````yaml /api-reference/openapi.json post /customers
openapi: 3.0.1
info:
  title: Flexprice API
  description: Flexprice API Service
  contact:
    name: API Support
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1.0'
servers:
  - url: https://us.api.flexprice.io/v1
    description: US Region
  - url: https://api.cloud.flexprice.io/v1
    description: India Region
security: []
paths:
  /customers:
    post:
      tags:
        - Customers
      summary: Create customer
      description: >-
        Use when onboarding a new billing customer (e.g. sign-up or CRM sync).
        Ideal for linking via external_customer_id to your app's user id.
      operationId: createCustomer
      requestBody:
        description: Customer
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustomerRequest'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CreateCustomerRequest:
      required:
        - external_id
      type: object
      properties:
        address_city:
          maxLength: 100
          type: string
          description: address_city is the city name with maximum 100 characters
        address_country:
          type: string
          description: address_country is the two-letter ISO 3166-1 alpha-2 country code
        address_line1:
          maxLength: 255
          type: string
          description: >-
            address_line1 is the primary address line with maximum 255
            characters
        address_line2:
          maxLength: 255
          type: string
          description: >-
            address_line2 is the secondary address line with maximum 255
            characters
        address_postal_code:
          maxLength: 20
          type: string
          description: >-
            address_postal_code is the ZIP code or postal code with maximum 20
            characters
        address_state:
          maxLength: 100
          type: string
          description: >-
            address_state is the state, province, or region name with maximum
            100 characters
        email:
          type: string
          description: >-
            email is the customer's email address and must be a valid email
            format if provided
        external_id:
          type: string
          description: >-
            external_id is the unique identifier from your system to reference
            this customer (required)
        integration_entity_mapping:
          type: array
          description: >-
            integration_entity_mapping contains provider integration mappings
            for this customer
          items:
            $ref: '#/components/schemas/CreateEntityIntegrationMappingRequest'
        metadata:
          type: object
          additionalProperties:
            type: string
          description: >-
            metadata contains additional key-value pairs for storing extra
            information
        name:
          type: string
          description: name is the full name or company name of the customer
        skip_onboarding_workflow:
          type: boolean
          description: >-
            skip_onboarding_workflow when true, prevents the customer onboarding
            workflow from being triggered

            This is used internally when a customer is created via a workflow to
            prevent infinite loops

            Default: false
        tax_rate_overrides:
          type: array
          description: >-
            tax_rate_overrides contains tax rate configurations to be linked to
            this customer
          items:
            $ref: '#/components/schemas/TaxRateOverride'
      description: Request object for creating a new customer in the system
    CustomerResponse:
      type: object
      properties:
        address_city:
          type: string
          description: AddressCity is the city of the customer's address
        address_country:
          type: string
          description: >-
            AddressCountry is the country of the customer's address (ISO 3166-1
            alpha-2)
        address_line1:
          type: string
          description: AddressLine1 is the first line of the customer's address
        address_line2:
          type: string
          description: AddressLine2 is the second line of the customer's address
        address_postal_code:
          type: string
          description: AddressPostalCode is the postal code of the customer's address
        address_state:
          type: string
          description: AddressState is the state of the customer's address
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        email:
          type: string
          description: Email is the email of the customer
        environment_id:
          type: string
          description: EnvironmentID is the environment identifier for the customer
        external_id:
          type: string
          description: ExternalID is the external identifier for the customer
        id:
          type: string
          description: ID is the unique identifier for the customer
        integrations:
          type: array
          items:
            $ref: '#/components/schemas/EntityIntegrationMappingResponse'
        metadata:
          type: object
          additionalProperties:
            type: string
          description: Metadata
        name:
          type: string
          description: Name is the name of the customer
        status:
          $ref: '#/components/schemas/types.Status'
        tenant_id:
          type: string
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
      description: Customer response object containing all customer information
    errors.ErrorResponse:
      type: object
      properties:
        code:
          type: string
          enum:
            - not_found
            - already_exists
            - version_conflict
            - validation_error
            - invalid_operation
            - permission_denied
            - http_client_error
            - database_error
            - system_error
            - internal_error
            - service_unavailable
        details:
          type: object
          additionalProperties:
            type: object
        http_status_code:
          type: integer
        message:
          type: string
      x-speakeasy-name-override: ErrorResponse
    CreateEntityIntegrationMappingRequest:
      required:
        - entity_id
        - entity_type
        - provider_entity_id
        - provider_type
      type: object
      properties:
        entity_id:
          maxLength: 255
          type: string
        entity_type:
          $ref: '#/components/schemas/types.IntegrationEntityType'
        metadata:
          type: object
          additionalProperties: true
        provider_entity_id:
          maxLength: 255
          type: string
        provider_type:
          maxLength: 50
          type: string
    TaxRateOverride:
      required:
        - currency
        - tax_rate_code
      type: object
      properties:
        auto_apply:
          type: boolean
          default: true
        currency:
          type: string
        metadata:
          type: object
          additionalProperties:
            type: string
        priority:
          type: integer
        tax_rate_code:
          type: string
    EntityIntegrationMappingResponse:
      type: object
      properties:
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        entity_id:
          type: string
        entity_type:
          $ref: '#/components/schemas/types.IntegrationEntityType'
        environment_id:
          type: string
        id:
          type: string
        provider_entity_id:
          type: string
        provider_type:
          type: string
        status:
          $ref: '#/components/schemas/types.Status'
        tenant_id:
          type: string
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
    types.Status:
      type: string
      enum:
        - published
        - deleted
        - archived
      x-enum-varnames:
        - StatusPublished
        - StatusDeleted
        - StatusArchived
      x-speakeasy-name-override: Status
    types.IntegrationEntityType:
      type: string
      enum:
        - customer
        - plan
        - invoice
        - subscription
        - payment
        - credit_note
        - addon
        - item
        - item_price
        - price
      x-enum-varnames:
        - IntegrationEntityTypeCustomer
        - IntegrationEntityTypePlan
        - IntegrationEntityTypeInvoice
        - IntegrationEntityTypeSubscription
        - IntegrationEntityTypePayment
        - IntegrationEntityTypeCreditNote
        - IntegrationEntityTypeAddon
        - IntegrationEntityTypeItem
        - IntegrationEntityTypeItemPrice
        - IntegrationEntityTypePrice
      x-speakeasy-name-override: IntegrationEntityType
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enter your API key in the format *x-api-key &lt;api-key&gt;**
      name: x-api-key
      in: header

````