Skip to main content
PUT
/
account
/
addresses
/
{address}
Update address
curl --request PUT \
  --url https://api.marzipan.co/v1/account/addresses/{address} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "firstName": "Jane",
  "lastName": "Doe",
  "addressLine1": "12 Baker Street",
  "addressLine2": "Flat 2",
  "city": "London",
  "state": "Greater London",
  "postcode": "W1U 6TU",
  "country": "GB",
  "phone": "+447700900123",
  "defaultAddress": true
}
'
import requests

url = "https://api.marzipan.co/v1/account/addresses/{address}"

payload = {
"firstName": "Jane",
"lastName": "Doe",
"addressLine1": "12 Baker Street",
"addressLine2": "Flat 2",
"city": "London",
"state": "Greater London",
"postcode": "W1U 6TU",
"country": "GB",
"phone": "+447700900123",
"defaultAddress": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
firstName: 'Jane',
lastName: 'Doe',
addressLine1: '12 Baker Street',
addressLine2: 'Flat 2',
city: 'London',
state: 'Greater London',
postcode: 'W1U 6TU',
country: 'GB',
phone: '+447700900123',
defaultAddress: true
})
};

fetch('https://api.marzipan.co/v1/account/addresses/{address}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.marzipan.co/v1/account/addresses/{address}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'firstName' => 'Jane',
'lastName' => 'Doe',
'addressLine1' => '12 Baker Street',
'addressLine2' => 'Flat 2',
'city' => 'London',
'state' => 'Greater London',
'postcode' => 'W1U 6TU',
'country' => 'GB',
'phone' => '+447700900123',
'defaultAddress' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.marzipan.co/v1/account/addresses/{address}"

payload := strings.NewReader("{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"addressLine1\": \"12 Baker Street\",\n \"addressLine2\": \"Flat 2\",\n \"city\": \"London\",\n \"state\": \"Greater London\",\n \"postcode\": \"W1U 6TU\",\n \"country\": \"GB\",\n \"phone\": \"+447700900123\",\n \"defaultAddress\": true\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api.marzipan.co/v1/account/addresses/{address}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"addressLine1\": \"12 Baker Street\",\n \"addressLine2\": \"Flat 2\",\n \"city\": \"London\",\n \"state\": \"Greater London\",\n \"postcode\": \"W1U 6TU\",\n \"country\": \"GB\",\n \"phone\": \"+447700900123\",\n \"defaultAddress\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.marzipan.co/v1/account/addresses/{address}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"addressLine1\": \"12 Baker Street\",\n \"addressLine2\": \"Flat 2\",\n \"city\": \"London\",\n \"state\": \"Greater London\",\n \"postcode\": \"W1U 6TU\",\n \"country\": \"GB\",\n \"phone\": \"+447700900123\",\n \"defaultAddress\": true\n}"

response = http.request(request)
puts response.read_body
[
  {
    "id": "9c1f7b2e-3d4a-4c1b-8f2a-1a2b3c4d5e6f",
    "firstName": "Jane",
    "lastName": "Doe",
    "addressLine1": "12 Baker Street",
    "addressLine2": "Flat 2",
    "city": "London",
    "state": "Greater London",
    "county": "Greater London",
    "postcode": "W1U 6TU",
    "countryName": "United Kingdom",
    "country": "GB",
    "type": "shipping",
    "defaultAddress": true,
    "deliveryInstructions": null,
    "phone": "+447700900123"
  }
]
{
"message": "Unauthenticated."
}
{
"message": "No query results for model."
}
{
"message": "The postcode field is required.",
"errors": {
"postcode": [
"The postcode field is required."
]
}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is the account token returned from the Login endpoint.

Path Parameters

address
string<uuid>
required

The address ID

Body

application/json
firstName
string
required
lastName
string
required
addressLine1
string
required
city
string
required
postcode
string
required
country
string
required

ISO country code

addressLine2
string | null
state
string | null
phone
string | null

Must be a valid phone number for the given country

defaultAddress
boolean

Set this address as the customer's default

Response

Success

id
string<uuid>

Unique identifier for the address

firstName
string
lastName
string
addressLine1
string
addressLine2
string | null
city
string
state
string | null

State/county value

county
string | null

Alias of state

postcode
string
countryName
string

Full country name

country
string

ISO country code

type
string | null

Address type

defaultAddress
boolean
deliveryInstructions
string | null
phone
string | null