Update a customer address
AI agents: read /llms.txt; add .md to any page URL. This page as Markdown: /reference/customer-addresses/v1-customer-address-update.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.
PUT/
Saves changes to an address. Addresses already printed on a document are never changed in place: YoPrint keeps the old address for those documents and saves your changes as a new address.
address_save_result.save_mode says what happened:
updated_in_place_unused(200): nothing used the address, so it was changed. Same id;revision_numberwent up by one.created_replacement_address_used(200): a sales order, quote, invoice, shipment, package, purchase order or brand profile uses the address.datais a new address with a new id and your changes; it takes over as primary if the old one was. The old address stays on those documents and leaves the current list. Brand profiles keep pointing at the old address: update them to the new id yourself.no_address_fields_changed(200): the values you sent are the ones saved. Nothing changed.stale_address(409): you sentbase_revision_numberand someone saved the address since. Nothing changed;current_addressandstale_baseshow the latest.blocked_superseded_historical_address(409): the address was already replaced by an edit. Editcurrent_addressinstead.blocked_external_or_compliance(409): the address is synced from another system or was redacted.
This answer has no status field: success, address_save_result and, on success, data; on a 409 also message (the mode).
Business rules
- Only billing and shipping addresses of this customer can be updated here; deleted ones can't.
is_primaryis not changed here: use Set the primary address.- 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.").
Side effects
- May create a new address (
created_replacement_address_used). Existing sales orders, quotes, invoices, shipments, and purchase orders keep their saved copy of the old address.
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
The address's id (
idfrom List a customer's addresses). A hash id from an earlier answer; unique keys and document numbers (such asPO0042) don't work here.- Example
uAu3dAKIaHyAYk
- Example
Request body
application/json, required.
address1stringaddress2stringStreet line 2, such as a suite or unit.
base_revision_numberintegerProtects against concurrent edits: send the
revision_numberyou last read, and YoPrint refuses the save with 409stale_addressif someone changed the address since.citystringThe city.
countrystringcountry_codestringWhen you change
statewithoutcountry_code, the address's saved country is used to check it.labelstringnotestringA note kept with the address, such as delivery instructions.
operation_keystringYour id for this save. Retrying with the same key and the same values returns the replacement the first try made instead of a 409.
postcodestringThe postal or ZIP code.
statestringnullis dropped before the request is read, so it can't clear the state: leave the field out to keep it.state_codestringAs
state:nullis the same as leaving it out.
Response
200Saved, or nothing to save. address_save_result.save_mode says which; data is the address to use from now on.
- Always
true
- Always
What the save did.
Child fields (7)
The message code for what happened, identical to
save_mode.The key you sent, or one YoPrint made.
- One of:
"updated_in_place_unused","created_replacement_address_used","no_address_fields_changed","stale_address","blocked_superseded_historical_address","blocked_external_or_compliance"
- One of:
current_addressobject | nullOn a refusal: the address to edit instead.
previous_addressobject | nullreplacement_addressobject | nullstale_baseobject | null
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
- The address is deleted, or is not a billing or shipping address of this customer.
error.codeis null anderror.messagenames the record type. - Fix
- Check the ids.
409Nothing saved: the address changed since
base_revision_number, was replaced by an edit, or is synced from another system or redacted.- When
address_save_result.save_modeisstale_address,blocked_superseded_historical_addressorblocked_external_or_compliance. Not the usual error envelope: the body hassuccess: false,address_save_resultandmessage.- Fix
- Re-read
address_save_result.current_address, then save against it. Ablocked_external_or_complianceaddress can't be edited at all.
422Validation failed or external Shopify customers are read-only from this API.
- When
- A field has the wrong type, 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.
Notes
- Always use the id in
datafrom the answer from now on: after a replacement it is a new id.
Related
- GETList a customer's addresses
/v1/ api/ store/ {team_slug}/ customer/ {hash_id}/ address - PATCHUpdate a brand profile (same as PUT)
/v1/ api/ store/ {team_slug}/ customer/ {hash_id}/ profile/ {id}
