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