Add an address to a customer
AI agents: read /llms.txt; add .md to any page URL. This page as Markdown: /reference/customer-addresses/v1-customer-address-store.md. Index of every page and the rules for every call: /llms.txt. Guides and concepts in one file: /llms-full.txt. OpenAPI: /openapi.json.
POST/
Adds a billing or shipping address and returns it.
The first address of each role becomes primary; later ones don't, whatever is_primary says. Use Set the primary address to change it.
Business rules
state_codeandcountry_codeare trimmed and upper-cased.- Works on a deleted customer too: the address is added to it.
- For
USandCA,stateorstate_codemust name a real state or province; YoPrint stores the name and the code together. - Customers synced from Shopify are read-only here: changes are refused with 422
validation_error"External customers are read-only. Manage changes from Shopify." System customers (is_system: true) are refused the same way ("System customer cannot be modified or deleted.").
Path parameters
Your team slug, shown as Team ID next to your API key in Profile.
- Example
your-team
- Example
The customer's id (
idfrom List customers or Create a customer). A hash id from an earlier answer; unique keys and document numbers (such asPO0042) don't work here.- Example
EDhVUaC6jbLbed
- Example
Request body
application/json, required.
Required. Street line 1.
Required. Two-letter country code, such as
US.Required, but the first address of each role always becomes primary and later ones never do. Use the set-primary operation to change it.
Required. A name for the address, shown in pickers: "Head office".
Required. What the address is for.
- One of:
"billing","shipping"
- One of:
address2stringStreet line 2, such as a suite or unit.
citystringThe city.
countrystringThe country name. Shown as the country of
country_codewhen blank.notestringA note kept with the address, such as delivery instructions.
postcodestringThe postal or ZIP code.
statestringThe state or province name, such as "Illinois". For US and Canada addresses, send either
stateorstate_code(or both matching): YoPrint resolves and stores both. For other countries, send the name instate. Sendingnullis ignored; omit the field to leave it unset.state_codestringThe two-letter state or province code, such as
ILorON. Used for US and Canada addresses: send eitherstate_codeorstate. Sendingnullis ignored; omit the field to leave it unset.
Response
200Successful response.
Child fields (33)
False for deleted, replaced, Shopify or redacted addresses. Only current addresses can be picked for new documents or edited.
Goes up by one on every saved change. Send it back as
base_revision_numberwhen updating the address to protect against concurrent edits.billingorshippingfor customer addresses.address2string | nulladdress_family_idstring | nullShared by an address and the copies made when it was edited after use.
citystring | nullcopied_from_address_idstring | nullcountrystring | nullcountry_codestring | nullcustomer_idstringCustomer addresses only: the customer's id.
external_typestring | nullshopifyfor an address synced from Shopify.hold_stockbooleanCompany locations only; false for customer addresses.
is_default_warehousebooleanCompany locations only; false for customer addresses.
is_externalbooleanTrue for an address synced from Shopify; such addresses are read-only.
nexusbooleanCompany locations only; false for customer addresses.
notestring | nullowner_idstring | nullThe owner's id: for a customer address, the customer's id (the same as
customer_id).owner_typestringcustomerfor customer addresses.- One of:
"customer","team","unknown"
- One of:
postal_can_validatebooleanpostal_is_validbooleanpostal_validatedbooleanTrue once YoPrint has checked the address with its address validator.
postal_can_validatesays whether it could be checked andpostal_is_validgives the result. Any edit resets it to false.postcodestring | nullsourcestringcustomerfor customer addresses.- One of:
"customer","company_location","custom","unknown"
- One of:
statestring | nullstate_codestring | nullsuperseded_atstring (date-time) | nullsuperseded_by_address_idstring | nullSet on an old copy: the address that replaced it.
used_by_active_profilebooleanTrue when a brand profile uses it as Ship From. Sent on lists, reads, updates and customer answers; not on create or set-primary.
Errors
401The API key is missing or wrong (
unauthenticated).403You are not allowed to do this.
api_access_not_in_plan: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only{"message": "Insufficient Permission"}. Other refusals use the error envelope, withunauthorizedoruser_is_not_authorized.- When
- Your role has no Manage Customers permission. This 403 has a short body,
{"message": "Insufficient Permission"}, with nosuccessorerror. - Fix
- Ask a team owner to give your role Manage Customers.
404Not found.
page_not_found: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's.code: null, with a message that starts "No query results for": there is no record with that id.- When
- No customer with this id in the team. Deleted customers are found here, so this also works on a deleted customer.
error.codeis null anderror.messagenames the record type. - Fix
- Check the id.
422Validation failed or external Shopify customers are read-only from this API.
- When
role,label,address1,country_codeoris_primaryis missing, or a US or Canadian state can't be matched.error.codeisvalidation_failed.- Fix
- Fix each field named in
error.fields; its keys are field paths such ascontact.0.phone. - When
- The customer comes from Shopify, or is a system customer (
error.codevalidation_error, with the reason inerror.message). - Fix
- Change Shopify customers in Shopify. System customers cannot be changed.
Related
- PATCHSet the primary address
/v1/ api/ store/ {team_slug}/ customer/ {hash_id}/ address/ {id}/ primary - PUTUpdate a customer address
/v1/ api/ store/ {team_slug}/ customer/ {hash_id}/ address/ {id}
