POST
Authorise an existing customer to buy on a company account

Authorizations

Authorization
string
header
required

A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.

Headers

Idempotency-Key
string
required

A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.

Path Parameters

companyId
string
required

Body

application/json

THIS ATTACHES AN EXISTING PERSON AND CANNOT CREATE ONE. customer_id is a pointer the server resolves inside your store; a customer that does not exist there is 422, never a silently created record. The person's own fields (email, first_name, last_name, phone, locale) are refused BY NAME rather than answered "unknown field", because they are real things about this person that this route deliberately will not touch: creating or editing a shopper is the customers API. A customer already attached to this company is 409 contact_exists, because a person linked twice would be two authorities the merchant has to revoke separately and revoking one would look like it worked. location_ids is refused: per-location ordering authority is not modelled yet, so a contact is attached to the company as a whole.

customer_id
string
required

Required. The id of an EXISTING customer in this store, as returned by GET /api/v1/customers. It is the only thing this API publishes about the person: resolve their name and email through the customers API with read_customers.

is_primary
boolean

Optional, defaults to false. Setting it true DEMOTES whichever contact currently holds the flag, in the same transaction, because at most one primary is allowed per company.

Response

Created

data
object