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
Body Parameter | Type | Required |
---|---|---|
type |
| Required |
attributes.business |
| Optional, default is 'false' |
attributes.first_name |
| Required if 'business' is 'false' |
attributes.last_name |
| Required if 'business' is 'false' |
attributes.company |
| Required if 'business' is 'true' |
attributes.line_1 |
| Required |
attributes.line_2 |
| Optional |
attributes.city |
| Required |
attributes.zip_code |
| Required, but for some countries |
attributes.state_code |
| Required |
attributes.country_code |
| Required |
attributes.phone |
| Required |
attributes.email |
| Optional |
attributes.notes |
| Optional |
attributes.lat |
| Optional |
attributes.lng |
| Optional |
attributes.billing_info |
| Optional |
attributes.reference |
| Optional |
attributes.reference_origin |
| Optional |
attributes.metadata |
| Optional |
relationships.geocoder |
| Optional |
relationships.tags |
| Optional |
Example
The following request creates a new address:
Last updated