---
title: "Create a customer"
method: POST
path: "/customers"
tags: ["Customers"]
---

# Create a customer

`POST /customers`

## Request

- Base URL: `https://api.togai.com`
- URL: `https://api.togai.com/customers`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/togaihq/apis/togai-apis/docs/customers/post.ts> (a function with typed inputs; its response is checked against the schema)

This API let’s you to create customers and corresponding accounts.

## Request body

- CreateCustomerRequest: Payload to create customer
  - `id` string, required: Customer identifier
  - `name` string, required: Name of the Customer
  - `primaryEmail` string, required: Primary email of the customer
  - `address` Address, required: billing address of the customer
    - `phoneNumber` string: Contact number
    - `line1` string: Address line 1 (eg. Street, PO Box, Company Name)
    - `line2` string: Address line 2 (eg. apartment, suite, unit or building)
    - `postalCode` string: ZIP or postal code
    - `city` string: City, district, suburb, town or village
    - `state` string: State, county, province or region
    - `country` string: Two letter country code [ISO-3166-1 Alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
  - `settings` CreateEntitySetting[]
    - `id` string, required
    - `value` string, required
    - `namespace` string, required
    - `name` string, required
    - `dataType` 'STRING' | 'NUMERIC' | 'JSON' | 'JSON_LOGIC', required
  - `account` CreateAccountRequestWithoutCustomerId: Payload to create account
    - `id` string, required: Identifier of the account
    - `name` string, required: Name of the Account
    - `invoiceCurrency` string: Use [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code in which the account must be invoiced. For example: AED is the currency code for United Arab Emirates dirham.
    - `aliases` string[]: Aliases are tags that are associated with an account. Multiple aliases are allowed for a single account.
    - `accountAliases` CreateAccountAliasRequest[]: Aliases which effective range
      - `value` string, required
      - `effectiveFrom` string, date-time: Effective from date, if not provided, it will be set to -infinity
      - `effectiveUntil` string, date-time: Effective until date, if not provided, it will be set to +infinity
    - `address` Address: billing address of the customer
      - `phoneNumber` string: Contact number
      - `line1` string: Address line 1 (eg. Street, PO Box, Company Name)
      - `line2` string: Address line 2 (eg. apartment, suite, unit or building)
      - `postalCode` string: ZIP or postal code
      - `city` string: City, district, suburb, town or village
      - `state` string: State, county, province or region
      - `country` string: Two letter country code [ISO-3166-1 Alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
    - `primaryEmail` string: Primary email of the account
    - `settings` CreateEntitySetting[]
      - `id` string, required
      - `value` string, required
      - `namespace` string, required
      - `name` string, required
      - `dataType` 'STRING' | 'NUMERIC' | 'JSON' | 'JSON_LOGIC', required
    - `netTermDays` integer: Net term for the invoices of the account
    - `metadata` object: Additional information associated with the account. Example: GSTN, VATN
    - `tags` string[]: Tag for accounts are stored in lowercase
    - `status` 'ACTIVE' | 'DRAFT': Status of the created account defaults to ACTIVE

## Response `201`

Response for Create customer request

- CreateCustomerResponse
  - `id` string, required: Identifier of customer
  - `togaiCustomerId` string, required: Unique identifier of customer
  - `name` string, required: Name of the Customer
  - `primaryEmail` string, required: Primary email of the customer
  - `billingAddress` string
  - `address` Address: billing address of the customer
    - `phoneNumber` string: Contact number
    - `line1` string: Address line 1 (eg. Street, PO Box, Company Name)
    - `line2` string: Address line 2 (eg. apartment, suite, unit or building)
    - `postalCode` string: ZIP or postal code
    - `city` string: City, district, suburb, town or village
    - `state` string: State, county, province or region
    - `country` string: Two letter country code [ISO-3166-1 Alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
  - `settings` CreateEntitySetting[]
    - `id` string, required
    - `value` string, required
    - `namespace` string, required
    - `name` string, required
    - `dataType` 'STRING' | 'NUMERIC' | 'JSON' | 'JSON_LOGIC', required
  - `account` Account: Structure of an account
    - `id` string, required: Identifier of the account
    - `togaiAccountId` string, required: Unique identifier of the account
    - `togaiCustomerId` string, required: Unique identifier of the customer
    - `name` string, required: Name of the Account
    - `customerId` string, required: Identifier of the customer
    - `invoiceCurrency` string: [ISO_4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency in which the account must be invoiced Defaults to Base currency.
    - `aliases` object[]: list of aliases of the account
      - `alias` string
    - `netTermDays` integer
    - `address` Address: billing address of the customer
      - `phoneNumber` string: Contact number
      - `line1` string: Address line 1 (eg. Street, PO Box, Company Name)
      - `line2` string: Address line 2 (eg. apartment, suite, unit or building)
      - `postalCode` string: ZIP or postal code
      - `city` string: City, district, suburb, town or village
      - `state` string: State, county, province or region
      - `country` string: Two letter country code [ISO-3166-1 Alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
    - `primaryEmail` string: Primary email of the customer
    - `status` 'ACTIVE' | 'DRAFT' | 'ARCHIVED', required: Status of the account
    - `settings` CreateEntitySetting[]
      - `id` string, required
      - `value` string, required
      - `namespace` string, required
      - `name` string, required
      - `dataType` 'STRING' | 'NUMERIC' | 'JSON' | 'JSON_LOGIC', required
    - `invoiceGroupDetails` InvoiceGroupDetails: Invoice group details
      - `id` string, required
      - `name` string, required
      - `email` string, required
      - `dailyInvoiceConsolidation` boolean, required
      - `netTermDays` integer
      - `invoiceCurrency` string, required
      - `billingAddress` Address, required: billing address of the customer
        - `phoneNumber` string: Contact number
        - `line1` string: Address line 1 (eg. Street, PO Box, Company Name)
        - `line2` string: Address line 2 (eg. apartment, suite, unit or building)
        - `postalCode` string: ZIP or postal code
        - `city` string: City, district, suburb, town or village
        - `state` string: State, county, province or region
        - `country` string: Two letter country code [ISO-3166-1 Alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
    - `metadata` object: Additional information associated with the account. Example: GSTN, VATN
    - `tags` string[]: Tag for accounts are stored in lowercase

## Other responses

- `400`: Error response
- `401`: Error response
- `403`: Error response
- `404`: Error response
- `429`: Error response
- `default`: Error response

## Changes

- **2024-03-18** `3135bb8c67b3`: 1 info
  - added the optional property `account/netTermDays` to the response with the `201` status
- **2024-03-01** `6fb940b0dad9`: 3 breaking, 1 warning, 8 info
  - the response property `account/invoiceCurrency` became optional for the status `201`
  - the `account/primaryEmail` response property's maxLength was increased from `255` to `320` for the response status `201`
  - the `primaryEmail` response property's maxLength was increased from `255` to `320` for the response status `201`
  - added the new `DRAFT` enum value to the `account/status` response property for the response status `201`
  - …8 more
- **2023-12-21** `dbff52f9d224`: 1 info
  - added the new optional request property `account/accountAliases`
- **2023-11-30** `b3351be4b462`: 1 warning
  - removed the optional property `account/aliases/items/status` from the response with the `201` status
- **2023-11-03** `a6c96c5ec06e`: 7 info
  - added the new optional request property `account/address/phoneNumber`
  - added the new optional request property `account/metadata`
  - added the new optional request property `address/phoneNumber`
  - added the optional property `account/address/phoneNumber` to the response with the `201` status
  - …3 more

[Operation history](https://skmtc.dev/togaihq/apis/togai-apis/changes/customers/post.md)

---

[API](https://skmtc.dev/togaihq/apis/togai-apis.md) - [All operations](https://skmtc.dev/togaihq/apis/togai-apis/llms.txt) - [OpenAPI document](https://skmtc.dev/togaihq/apis/togai-apis/revisions/442f5d8f4aa0?raw)
