Create an address

How to create an address via API

To create a new address, send a POST request to the /api/addresses endpoint, passing the resource arguments in the request body.

Request

POST https://yourdomain.commercelayer.io/api/addresses

Arguments

Example

The following request creates a new address:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/addresses' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "addresses",
    "attributes": {
      "first_name": "John",
      "last_name": "Smith",
      "company": "The Red Brand Inc.",
      "line_1": "2883 Geraldine Lane",
      "city": "New York",
      "zip_code": "10013",
      "state_code": "NY",
      "country_code": "US",
      "phone": "(212) 646-338-1228"
    }
  }
}'

Last updated