Create Location Code
POST/api/spscommerce/:integrationInstance/location-codes
Add a location code to the directory. Every failed purchase order that was waiting on an unknown location code is retried straight away; retried_purchase_orders says how many.
integrations:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token and the integrations.update permission.
Body fields:
- trading_partner_id (string, required, max 64): the trading partner's SPS Commerce id (the purchase order sender)
- location_code (string, required, max 80): the store / DC code the partner sends (ship-to AddressLocationNumber or a line's store number); unique per trading partner on the connection
- distribution_center_code (string, optional, max 80): the DC a store rolls up to. With it, name and the address fields are optional, and an order for a retailer set to one order per DC ships to that DC. Leave it out for a DC or a direct-to-store location
- name (string, required, max 255)
- address1 (string, required, max 255)
- address2 (string, optional, max 255)
- city (string, required, max 100)
- state (string, max 100): required when country is US / USA
- zip (string, required, max 30)
- country (string, optional, 2–3 letters, default US)
Request
Responses
- 201
- 401
- 403
- 404
- 422
- 429
Created
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Content
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.