Customer Management/
Addresses API/
Get Addresses

Get Addresses

GET Get all of a customers or account addresses

https://api.moltin.com/v2/customers/:customerId/addresses

OR

https://api.moltin.com/v2/accounts/:accountId/addresses

Parameters

Path parameters

NameRequiredTypeDescription
customerIdRequired (for customer addresses)stringA customer ID that has addresses.
accountIdRequired (for account addresses)stringAn account ID that has addresses.

Headers

NameRequiredTypeDescription
X-Moltin-Customer-TokenOptionalstringA customer token used to access customer addresses implicitly.
EP-Account-Management-Authentication-TokenOptionalstringAn account management authentication token that identifies the authenticated account member.
AuthorizationRequiredstringThe Bearer token to grant access to the API.

Request Examples Get Customer Addresses With Customer Token

Curl

curl -X GET https://api.moltin.com/v2/customers/:customer_id/addresses \
     -H "X-Moltin-Customer-Token: XXXX"
     -H "Authorization: Bearer XXXX"

JavaScript SDK

const MoltinGateway = require("@moltin/sdk").gateway;
const Moltin = MoltinGateway({
    client_id: "X",
});
const customerId = "XXXX";
const customerToken = "XXXX";
Moltin.CustomerAddresses.All({
    customer: customerId,
    token: customerToken,
}).then((addresses) => {
    // Do something
});

Request Examples Get Customer Addresses Without Customer Token

Curl

curl -X GET https://api.moltin.com/v2/customers/:customer_id/addresses \
     -H "Authorization: Bearer XXXX"

JavaScript SDK

const MoltinGateway = require("@moltin/sdk").gateway;
const Moltin = MoltinGateway({
    client_id: "X",
    client_secret: "X",
});
const customerId = "XXXX";
Moltin.CustomerAddresses.All({
    customer: customerId,
}).then((addresses) => {
    // Do something
});

Request Examples Get Account Addresses With Account Token

Curl

curl -X GET https://api.moltin.com/v2/accounts/:account_id/addresses \
     -H "Ep-Account-Management-Authentication-Token: XXXX"
     -H "Authorization: Bearer XXXX"

JavaScript SDK

const MoltinGateway = require("@moltin/sdk").gateway;
const Moltin = MoltinGateway({
    client_id: "X",
});
const accountId = "XXXX";
const accountToken = "XXXX";
Moltin.AccountAddresses.All({
    account: accountId,
    token: accountToken,
}).then((addresses) => {
    // Do something
});

Request Examples Get Account Addresses Without Account Token

Curl

curl -X GET https://api.moltin.com/v2/accounts/:account_id/addresses \
     -H "Authorization: Bearer XXXX"

JavaScript SDK

const MoltinGateway = require("@moltin/sdk").gateway;
const Moltin = MoltinGateway({
    client_id: "X",
    client_secret: "X",
});
const accountId = "XXXX";
Moltin.AccountAddresses.All({
    account: accountId,
}).then((addresses) => {
    // Do something
});

Response Example

200 OK

{
    "data": [
        {
            "id": "5f8da740-6680-463e-b31c-190b2db4bf9d",
            "type": "address",
            "name": "Home",
            "first_name": "Ron",
            "last_name": "Swanson",
            "company_name": "",
            "phone_number": "(555) 555-1234",
            "line_1": "1 Sunny Street",
            "line_2": "Sunny Place",
            "city": "Sunny Town",
            "postcode": "SU33 1YY",
            "county": "Sunnyville",
            "region": "Peterborough",
            "country": "GB",
            "instructions": "Leave in the shed",
            "links": {
                "self": "https://api.moltin.com/v2/addresses/5f8da740-6680-463e-b31c-190b2db4bf9d"
            },
            "meta": {
                "timestamps": {
                    "created_at": "2018-05-04T15:20:09.734Z",
                    "updated_at": "2018-05-04T15:20:09.734Z"
                }
            }
        }
    ]
}

Was this helpful?

Previous
Addresses API Overview

Learn

Docs