createCustomerAddress

createCustomerAddress

This method allows you to create a new address for a specific customer.

Parameters

customerId (string, required): The UUID of the customer for whom you want to create the address.

Body

  • formatted (string, optional): The full, formatted address.
  • street (string, optional): The street address.
  • city (string, optional): The city of the address.
  • state (string, optional): The state of the address.
  • region (string, optional): The region of the address.
  • postalCode (string, optional): The postal code of the address.
  • locality (string, optional): The locality of the address.
  • country (string, optional): The country code of the address (e.g., "AFG" for Afghanistan). Must be a valid ISO 3166-1 alpha-3 country code.

Returns

A JSON object containing the newly created address details, including the address ID and other information.

Usage Example

const axios = require('axios');
let data = JSON.stringify({
  "formatted": "string",
  "street": "string",
  "city": "string",
  "state": "string",
  "region": "string",
  "postalCode": "string",
  "locality": "string",
  "country": "AFG"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.nexera.id/customers/:customerId/addresses',
  headers: { 
    'Content-Type': 'application/json', 
    'Accept': 'application/json', 
    'Authorization': 'Bearer <TOKEN>'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});