Create address
curl --request POST \
--url https://api.marzipan.co/v1/account/addresses \
--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"
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.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
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', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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"
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("POST", 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.post("https://api.marzipan.co/v1/account/addresses")
.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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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": "The first name field is required.",
"errors": {
"firstName": [
"The first name field is required."
]
}
}Account
Create address
Add a new delivery address to the authenticated customer’s account. Returns the full updated list of addresses.
POST
/
account
/
addresses
Create address
curl --request POST \
--url https://api.marzipan.co/v1/account/addresses \
--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"
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.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
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', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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"
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("POST", 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.post("https://api.marzipan.co/v1/account/addresses")
.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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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": "The first name field is required.",
"errors": {
"firstName": [
"The first name field is required."
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is the account token returned from the Login endpoint.
Body
application/json
ISO country code
Must be a valid phone number for the given country
Set this address as the customer's default
Response
Success
Unique identifier for the address
State/county value
Alias of state
Full country name
ISO country code
Address type
⌘I

