Update shipping address
Update the shipping address of an order. Note: if the order has moved to status shipped
the order address can't be changed as it has already been sent with the carrier.
PUT https://api.gelato.com/v2/order/{{MyOrderId}}/address
Request example
$ curl -X PUT \
https://api.gelato.com/v2/order/{{MyOrderId}}/address \
-H 'Accept: */*' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: {{apiKey}}' \
-d '{
"countryIsoCode": "US",
"companyName": "Example",
"firstName": "Paul",
"lastName": "Smith",
"addressLine1": "451 Clarkson Ave",
"addressLine2": "Brooklyn",
"stateCode": "NY",
"city": "New York",
"postcode": "11203",
"email": "[email protected]",
"phone": "123456789"
}'
Response example
{
"id": "d6bcf17f-3a48-4ec8-888e-70766ae8b56a",
"countryIsoCode": "US",
"firstName": "Paul",
"lastName": "Smith",
"companyName": "Example",
"addressLine1": "451 Clarkson Ave",
"addressLine2": "Brooklyn",
"city": "New York",
"postcode": "11203",
"stateCode": "NY",
"email": "[email protected]",
"phone": "123456789"
}
Request and Response data
Request and response data represented by RecipientObject
. This is the same object as in Quote request
Parameter | Type | Description |
---|---|---|
countryIsoCode (required) | string | The two-character ISO 3166-1 code that identifies the country or region. Please note: the country code for United Kingdom is GB and not UK as used in the top-level domain names for that country.Pattern: ^[A-Z]{2}$ |
firstName (required) | string | The first name of the recipient at this address. Maximum length is 25 characters |
lastName (required) | string | The last name of the recipient at this address. Maximum length is 25 characters |
companyName (optional) | string | The company name of the recipient at this address. Maximum length is 60 characters |
addressLine1 (required) | string | The first line of the address. For example, number, street, and so on. Maximum length is 35 characters |
addressLine2 (optional) | string | The second line of the address. For example, suite or apartment number. Maximum length is 35 characters |
city (required) | string | The city name. Maximum length is 30 characters |
postcode (required) | string | The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See postal code. Maximum length is 15 characters |
stateCode (optional) | string | The code for a US state or the equivalent for other countries. Required for requests if the address is in one of these countries: Brazil, India, Chile, Australia, United Kingdom or United States. In case of United Kingdom country, the state code means county. Maximum length is 35 characters |
email (required) | string | The email address for the recipient. Pattern: .+@["-].+$ |
phone (optional) | string | The phone number, in E.123 format. Maximum length is 25 characters |
isBusiness (optional) | bool | Boolean value, declares the recipient being a business. Use if tax for recipient country is different for private and business customers (e.g. in Brazil) to change federalTaxId field type. Mandatory for Brazil if recipient is a company. |
federalTaxId (optional) | string | The Federal Tax identification number of recipient. Use to provide CPF/CNPJ of a Brazilian recipient. Mandatory for Brazil. In order to supply CNPJ instead of CPF, set isBusiness field to true. |
stateTaxId (optional) | string | The State Tax identification number of recipient. Use to provide IE of a Brazilian recipient. Mandatory for Brazil if recipient is a company. In order to supply this field, set isBusiness field to true. |
registrationStateCode (optional) | string | The code number for a US state or the equivalent for other countries that defines state where recipient company is registered. Mandatory for Brazil if recipient is a company. In order to supply this field, set isBusiness field to true. |
Response Messages
Error response: Country change attempt rejected
{
"message": "Address can't be updated",
"details": [
{
"message": "Country change isn't allowed",
"reference": "countryIsoCode"
}
]
}
Error response: First address validation failed
{
"message": "Request object contain errors!",
"details": [
{
"message": "This value should not be blank.",
"reference": "firstName"
},
{
"message": "This value should not be blank.",
"reference": "lastName"
}
]
}
Error response: Second Address validation failed
{
"message": "Address is incorrect",
"details": [
{
"message": "The value is not a valid postcode. Please use 5 digits without whitespaces",
"reference": null
}
]
}
Error response: Order not found
{
"message": "Order not found",
"details": []
}
HTTP Status Code | Message |
---|---|
200 | The order address was changed. |
400 | The order address cannot be changed, see reason in the details. |
404 | Order not found. |