Square: Create Customer
Square customers.createCustomer: arguments, response, policy and SDK examples.
← Customers operations · Get started
Operation square.createcustomer
Provider route: POST /v2/customers. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/square with npm, or alter-sdk-square with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { SquareIntegration } from "@alter-ai/square";
async function execute(input: Parameters<SquareIntegration["customers"]["createCustomer"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new SquareIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.customers.createCustomer(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_square import SquareIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = SquareIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.customers.create_customer(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
body | Model | Required within parent | Expand Create Customer — request body — body |
Referenced models: Create Customer — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Create Customer — response body |
Referenced models: Create Customer — response body
Schemas
Section titled “Schemas”6 more schemas are linked from the tables above, on the schema pages.
Create Customer — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Defines the body parameters that can be included in a request to the `CreateCustomer` endpoint. |
address | Model | Optional | Expand Create Customer — request body — body address The physical address associated with the customer profile. For maximum length constraints, see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address). The `first_name` and `last_name` fields are ignored if they are present in the request. |
birthday | string | Optional | The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified. |
company_name | string | Optional | A business name associated with the customer profile. The maximum length for this value is 500 characters. |
email_address | string | Optional | The email address associated with the customer profile. The maximum length for this value is 254 characters. |
family_name | string | Optional | The family name (that is, the last name) associated with the customer profile. The maximum length for this value is 300 characters. |
given_name | string | Optional | The given name (that is, the first name) associated with the customer profile. The maximum length for this value is 300 characters. |
idempotency_key | string | Optional | The idempotency key for the request. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). |
nickname | string | Optional | A nickname for the customer profile. The maximum length for this value is 100 characters. |
note | string | Optional | A custom note associated with the customer profile. |
phone_number | string | Optional | The phone number associated with the customer profile. The phone number must be valid and can contain 9–16 digits, with an optional `+` prefix and country code. For more information, see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). |
reference_id | string | Optional | An optional second ID used to associate the customer profile with an entity in another system. The maximum length for this value is 100 characters. |
tax_ids | Model | Optional | Expand Create Customer — request body — body tax ids The tax ID associated with the customer profile. This field is available only for customers of sellers in EU countries or the United Kingdom. For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). |
Referenced models: Create Customer — request body — body address, Create Customer — request body — body tax ids
Create Customer — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Defines the fields that are included in the response body of a request to the [CreateCustomer](api-endpoint:Customers-CreateCustomer) or [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) endpoint. Either `errors` or `customer` is present in a given response (never both). |
customer | Model | Optional | Expand Create Customer — response body — customer The created customer. |
errors | array | Optional | Any errors that occurred during the request. |
errors[] | Model | Each item | Expand Get Shift — response body — errors item |
Referenced models: Create Customer — response body — customer, Get Shift — response body — errors item
Create Customer — request body — body address
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents a postal address in a country. For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
address_line_1 | JSON | Optional | |
address_line_1 (anyOf 1) | string | Alternative | The first line of the address. Fields that start with `address_line` provide the address's most specific details, like street number, street name, and building name. They do *not* provide less specific details like city, state/province, or country (these details are provided in other fields). |
address_line_1 (anyOf 2) | null | Alternative | |
address_line_2 | JSON | Optional | |
address_line_2 (anyOf 1) | string | Alternative | The second line of the address, if any. |
address_line_2 (anyOf 2) | null | Alternative | |
address_line_3 | JSON | Optional | |
address_line_3 (anyOf 1) | string | Alternative | The third line of the address, if any. |
address_line_3 (anyOf 2) | null | Alternative | |
administrative_district_level_1 | JSON | Optional | |
administrative_district_level_1 (anyOf 1) | string | Alternative | A civil entity within the address's country. In the US, this is the state. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
administrative_district_level_1 (anyOf 2) | null | Alternative | |
administrative_district_level_2 | JSON | Optional | |
administrative_district_level_2 (anyOf 1) | string | Alternative | A civil entity within the address's `administrative_district_level_1`. In the US, this is the county. |
administrative_district_level_2 (anyOf 2) | null | Alternative | |
administrative_district_level_3 | JSON | Optional | |
administrative_district_level_3 (anyOf 1) | string | Alternative | A civil entity within the address's `administrative_district_level_2`, if any. |
administrative_district_level_3 (anyOf 2) | null | Alternative | |
country | JSON | Optional | |
country (anyOf 1) | Model | Alternative | Expand Create Location — request body — body location country The address's country, in the two-letter format of ISO 3166. For example, `US` or `FR`. See [Country](#type-country) for possible values |
country (anyOf 2) | null | Alternative | |
first_name | JSON | Optional | |
first_name (anyOf 1) | string | Alternative | Optional first name when it's representing recipient. |
first_name (anyOf 2) | null | Alternative | |
last_name | JSON | Optional | |
last_name (anyOf 1) | string | Alternative | Optional last name when it's representing recipient. |
last_name (anyOf 2) | null | Alternative | |
locality | JSON | Optional | |
locality (anyOf 1) | string | Alternative | The city or town of the address. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
locality (anyOf 2) | null | Alternative | |
postal_code | JSON | Optional | |
postal_code (anyOf 1) | string | Alternative | The address's postal code. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
postal_code (anyOf 2) | null | Alternative | |
sublocality | JSON | Optional | |
sublocality (anyOf 1) | string | Alternative | A civil region within the address's `locality`, if any. |
sublocality (anyOf 2) | null | Alternative | |
sublocality_2 | JSON | Optional | |
sublocality_2 (anyOf 1) | string | Alternative | A civil region within the address's `sublocality`, if any. |
sublocality_2 (anyOf 2) | null | Alternative | |
sublocality_3 | JSON | Optional | |
sublocality_3 (anyOf 1) | string | Alternative | A civil region within the address's `sublocality_2`, if any. |
sublocality_3 (anyOf 2) | null | Alternative |
Referenced models: Create Location — request body — body location country
Create Customer — request body — body tax ids
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents the tax ID associated with a [customer profile](entity:Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). |
eu_vat | JSON | Optional | |
eu_vat (anyOf 1) | string | Alternative | The EU VAT identification number for the customer. For example, `IE3426675K`. The ID can contain alphanumeric characters only. Maximum length: 20 |
eu_vat (anyOf 2) | null | Alternative |
Get Shift — response body — errors item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents an error encountered during a request to the Connect API. See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information. |
category | string | Required within parent | Indicates which high-level category of error has occurred during a request to the Connect API. The high-level category for the error. See [ErrorCategory](#type-errorcategory) for possible values Known values: API_ERROR, AUTHENTICATION_ERROR, INVALID_REQUEST_ERROR, RATE_LIMIT_ERROR, PAYMENT_METHOD_ERROR, REFUND_ERROR, MERCHANT_SUBSCRIPTION_ERROR, EXTERNAL_VENDOR_ERROR |
code | Model | Required within parent | Expand Get Shift — response body — errors item code The specific code of the error. See [ErrorCode](#type-errorcode) for possible values |
detail | string | Optional | A human-readable description of the error for debugging purposes. |
field | string | Optional | The name of the field provided in the original request (if any) that the error pertains to. |
Referenced models: Get Shift — response body — errors item code
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: square.createcustomer. Catalog operation: CreateCustomer. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["CUSTOMERS_WRITE"]
Pinned headers: {"Square-Version": "2026-11-18"}