> For the complete documentation index, see [llms.txt](https://docs.liquidcommerce.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.liquidcommerce.cloud/services/users-api/create-update-address.md).

# Create/Update Address

## Endpoint Details <a href="#search-catalog" id="search-catalog"></a>

<mark style="color:green;">`POST`</mark> `/users/addresses/add`

### Headers

| Header        | Value                        |
| ------------- | ---------------------------- |
| Content-Type  | `application/json`           |
| Authorization | `Bearer <YOUR_ACCESS_TOKEN>` |

### Body

<table><thead><tr><th width="185">Parameter</th><th width="109">Type</th><th width="339">Description</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td><code>userId</code></td><td>string</td><td>Identifier of the user to add address for</td><td>true</td></tr><tr><td><code>one</code></td><td>string</td><td>Primary street address</td><td>true</td></tr><tr><td><code>two</code></td><td>string</td><td>Secondary address (apt, suite, etc.)</td><td>false</td></tr><tr><td><code>city</code></td><td>string</td><td>City name</td><td>true</td></tr><tr><td><code>state</code></td><td>string</td><td>Two-letter state code or full state name</td><td>true</td></tr><tr><td><code>zip</code></td><td>string</td><td>Postal/ZIP code</td><td>true</td></tr><tr><td><code>type</code></td><td>string</td><td>Address type ('shipping' or 'billing')</td><td>false</td></tr><tr><td><code>placesId</code></td><td>string</td><td>Google Places API location identifier</td><td>false</td></tr><tr><td><code>lat</code></td><td>number</td><td>Latitude coordinate of address</td><td>false</td></tr><tr><td><code>long</code></td><td>number</td><td>Longitude coordinate of address</td><td>false</td></tr><tr><td><code>isDefault</code></td><td>boolean</td><td>Set as default address for type, <br><strong>default: false</strong></td><td>false</td></tr></tbody></table>

### Response Details

<table><thead><tr><th width="226">Field</th><th width="197">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>statusCode</code></td><td>number</td><td>HTTP status code of the response</td></tr><tr><td><code>message</code></td><td>string</td><td>A brief message describing the result of the API call</td></tr><tr><td><code>metadata</code></td><td><a href="#metadata-object">metaDataObject</a></td><td>Contains metadata about the API call</td></tr><tr><td><code>auth</code></td><td><a href="/pages/4amDKkDBbASmenwDBAOp#auth-object">authObject</a></td><td>Authentication object, only when refresh in <code>true</code></td></tr><tr><td><code>data</code></td><td><a href="/pages/wceSkuTxWdNKbsXqXmHN#useraddress">userAddress</a></td><td>Address object added</td></tr></tbody></table>

### Metadata Object

<table><thead><tr><th width="144">Field</th><th width="140">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>languages</code></td><td>Array&#x3C;string></td><td>List of supported languages for the response, e.g. ["en"]</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Unix timestamp (in milliseconds) when the response was generated</td></tr><tr><td><code>timezone</code></td><td>string</td><td>Timezone used for the response, always "UTC"</td></tr><tr><td><code>requestId</code></td><td>string</td><td>Unique identifier for the API request. Used for debugging and support</td></tr><tr><td><code>path</code></td><td>string</td><td>API path</td></tr><tr><td><code>version</code></td><td>string</td><td>API version used for the request</td></tr></tbody></table>

### Sample Request and Response

```bash
curl --location 'https://staging.api.liquidcommerce.cloud/users/addresses/add' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
    "userId": "usrid_123abc456def",
    "one": "100 Madison Ave",
    "two": "Apt 1707",
    "city": "New York",
    "state": "NY",
    "zip": "10016",
    "type": "shipping",
    "placesId": "placeid_123abc456ef",
    "lat": 40.7447986,
    "long": -73.98530819999999,
    "isDefault": true
}'
```

{% tabs %}
{% tab title="201" %}

```json
{
    "statusCode": 201,
    "message": "Updating or creating an new address succeeded",
    "metadata": {
        "languages": [
            "en"
        ],
        "timestamp": 1731598717444,
        "timezone": "UTC",
        "requestId": "reqid_123abc45def",
        "path": "/api/users/addresses/add",
        "version": "1.7.0"
    },
    "data": {
        "id": "addrid_123abc45def",
        "type": "shipping",
        "one": "100 Madison Ave",
        "two": "Apt 1707",
        "city": "New York",
        "state": "NY",
        "zip": "10016",
        "lat": 40.7447986,
        "long": -73.98530819999999,
        "placesId": "placeid_123abc456ef",
        "country": "US",
        "createdAt": "2024-11-14T15:38:37.775Z",
        "updatedAt": "2024-11-14T15:38:37.775Z",
        "isDefault": true
    }
}
```

{% endtab %}
{% endtabs %}
