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

# Create Customer

> Create a customer.

[The Customers Data Model](https://docs.rootfi.dev/api-reference/customers/overview) is designed to streamline the management and retrieval of customer-related information across various accounting platforms.


## OpenAPI

````yaml POST /ecommerce/customers
openapi: 3.0.1
info:
  title: rootfi
  version: v3
servers:
  - url: https://api.rootfi.dev/v3
    description: global
  - url: https://api.sa.rootfi.dev/v3
    description: saudi
security: []
paths:
  /ecommerce/customers:
    post:
      tags:
        - EcommerceCustomers
      summary: Create Customer
      description: Create a customer.
      operationId: ecommerce_customers_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ecommerceCreateCustomersRequest'
            examples:
              Example1:
                value:
                  company_id: 1089
                  data:
                    - name: John Doe
                      email: ''
                      phone: '1234567890'
                      currency_id: '1234567890'
                      status: ACTIVE
                      updated_at: '2024-01-22T05:07:31.465Z'
                      created_at: '2024-01-22T05:07:31.465Z'
                      address:
                        rootfi_id: 278264
                        platform_id: CONTACTS_1af68894-ea9f-ee11-be36-7c1e520f50bc_ADDRESS
                        street: 123 Main Street
                        locality: Main Street
                        city: New York
                        state: New York
                        pincode: '123456'
                        country: USA
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ecommerceCreateCustomersResponse'
              examples:
                Example1:
                  value:
                    data:
                      - rootfi_id: 157
                        rootfi_deleted_at: null
                        rootfi_created_at: '2024-01-22T05:07:31.465Z'
                        rootfi_updated_at: '2024-01-22T05:07:31.000Z'
                        rootfi_company_id: 1089
                        platform_id: '123456_1'
                        platform_unique_id: '123456'
                        name: John Doe
                        email: ''
                        phone: '1234567890'
                        currency_id: '1234567890'
                        status: ACTIVE
                        updated_at: '2024-01-22T05:07:31.465Z'
                        created_at: '2024-01-22T05:07:31.465Z'
                        address:
                          rootfi_id: 278264
                          platform_id: >-
                            CONTACTS_1af68894-ea9f-ee11-be36-7c1e520f50bc_ADDRESS
                          street: 123 Main Street
                          locality: Main Street
                          city: New York
                          state: New York
                          pincode: '123456'
                          country: USA
                    sync_id: '1234567890'
        '401':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
        '403':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ecommerceCreateCustomersRequest:
      title: ecommerceCreateCustomersRequest
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ecommerceCustomersFields'
          description: The data of the customer endpoint
      required:
        - data
      allOf:
        - $ref: '#/components/schemas/CompanyIDRequestField'
    ecommerceCreateCustomersResponse:
      title: ecommerceCreateCustomersResponse
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ecommerceCustomerObject'
          description: The data of the customer endpoint
        sync_id:
          type: string
          nullable: true
          description: The sync id of the request
      required:
        - data
    RootFiAPIResponseType:
      title: RootFiAPIResponseType
      type: object
      properties:
        error:
          $ref: '#/components/schemas/RootFiAPIResponseErrorType'
          description: The error message
      required:
        - error
    ecommerceCustomersFields:
      title: ecommerceCustomersFields
      type: object
      properties:
        name:
          type: string
          nullable: true
          description: The name of the customer
        email:
          type: string
          nullable: true
          description: The email of the customer
        phone:
          type: string
          nullable: true
          description: The phone of the customer
        currency_id:
          type: string
          nullable: true
          description: The currency of the customer
        status:
          $ref: '#/components/schemas/BaseStatus'
          nullable: true
          description: The status of the customer
        updated_at:
          type: string
          nullable: true
          description: The updated_at of the customer
        created_at:
          type: string
          nullable: true
          description: The created_at of the customer
        address:
          $ref: '#/components/schemas/ecommerceAddressObject'
          nullable: true
          description: The address of the customer
    CompanyIDRequestField:
      title: CompanyIDRequestField
      type: object
      properties:
        company_id:
          type: integer
          description: The ID of the company in the accounting platform
        run_async:
          type: boolean
          nullable: true
          description: Run the request asynchronously
      required:
        - company_id
    ecommerceCustomerObject:
      title: ecommerceCustomerObject
      type: object
      properties: {}
      allOf:
        - $ref: '#/components/schemas/AccountingRootFiBaseFields'
        - $ref: '#/components/schemas/ecommerceCustomersFields'
    RootFiAPIResponseErrorType:
      title: RootFiAPIResponseErrorType
      type: object
      properties:
        message:
          type: string
          description: The error message
        code:
          type: string
          description: The error code
        field:
          type: string
          description: The status of the error
      required:
        - message
        - code
        - field
    BaseStatus:
      title: BaseStatus
      type: string
      enum:
        - ACTIVE
        - ARCHIVED
        - UNKNOWN
    ecommerceAddressObject:
      title: ecommerceAddressObject
      type: object
      properties:
        rootfi_id:
          type: integer
          nullable: true
          description: The RootFi ID of the customer
        platform_id:
          type: string
          nullable: true
          description: The platform ID of the customer
        street:
          type: string
          nullable: true
          description: The street of the address
        locality:
          type: string
          nullable: true
          description: The locality of the address
        city:
          type: string
          nullable: true
          description: The city of the address
        state:
          type: string
          nullable: true
          description: The state of the address
        pincode:
          type: string
          nullable: true
          description: The pincode of the address
        country:
          type: string
          nullable: true
          description: The country of the address
    AccountingRootFiBaseFields:
      title: AccountingRootFiBaseFields
      type: object
      properties:
        rootfi_id:
          type: number
          format: double
          description: The unique ID we assign for that data's information
          example: 157
        rootfi_deleted_at:
          type: string
          format: date-time
          nullable: true
          description: The date at which the data was deleted in the accounting platform
        rootfi_created_at:
          type: string
          format: date-time
          description: The date at which RootFi first synced this data
          example: '2024-01-22T05:07:31.465Z'
        rootfi_updated_at:
          type: string
          format: date-time
          description: The latest date at which RootFi updated this data
          example: '2024-01-22T05:07:31.000Z'
        rootfi_company_id:
          type: number
          format: double
          description: The ID of the company in the accounting platform
          example: 1089
        platform_id:
          type: string
          description: An unique custom RootFi ID made from platform's unique_id.
          example: '123456'
        platform_unique_id:
          type: string
          nullable: true
          description: The ID of the data in the accounting platform.
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            A JSON containing fields that you can directly get from the
            accounting platform.
        data_hash:
          type: string
          nullable: true
          description: The hash of the data
      required:
        - rootfi_id
        - rootfi_created_at
        - rootfi_updated_at
        - rootfi_company_id
        - platform_id
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````