# Update an address

### URL

<mark style="color:green;">**POST**</mark> `https://api.complycube.com/v1/addresses/:id`

Updates the specified address by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

### Headers

<table><thead><tr><th width="316">Name</th><th width="81">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Type</code><mark style="color:red;">*</mark></td><td>string</td><td>The content-type must always be set to <code>application/json</code>.</td></tr><tr><td><code>Authorization</code><mark style="color:red;">*</mark></td><td>string</td><td>The API <strong><code>live</code></strong> or <strong><code>test</code></strong> key.</td></tr></tbody></table>

### Path parameters

<table><thead><tr><th width="315.46484375">Name</th><th width="81.18359375">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code><mark style="color:red;">*</mark></td><td>string</td><td>The ID of the address.</td></tr></tbody></table>

### Body

<table><thead><tr><th width="311.8359375">Name</th><th width="83.72265625">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code></td><td>string</td><td>The type of address. Valid values include:<br>1. <code>main</code><br>2. <code>alternative</code><br>3. <code>other</code></td></tr><tr><td><code>propertyNumber</code></td><td>string</td><td>The property number for this address.</td></tr><tr><td><code>buildingName</code></td><td>string</td><td>The building name for this address.</td></tr><tr><td><code>line</code></td><td>string</td><td>The line of the client's address.</td></tr><tr><td><code>city</code></td><td>string</td><td>The city or town of the client's address.</td></tr><tr><td><code>state</code></td><td>string</td><td>The county, state, or province of the client's address. When country is <code>US</code>, this must be the <a href="https://pe.usps.com/text/pub28/28apb.htm">state's USPS abbreviation</a> (e.g. <code>NY</code>, <code>CA</code>, or <code>DE</code>).</td></tr><tr><td><code>postalCode</code></td><td>string</td><td>The zip or postcode of the client's address.</td></tr><tr><td><code>country</code></td><td>string</td><td>The country of the client's address. This will be the <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">two-letter country ISO code</a>.</td></tr><tr><td><code>fromDate</code></td><td>string</td><td>The date the client moved into this address. The format is <code>YYYY-MM-DD</code>.</td></tr><tr><td><code>toDate</code></td><td>string</td><td>The date the client moved out of this address. The format is <code>YYYY-MM-DD</code>.</td></tr></tbody></table>

### Example request

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

```bash
curl -X POST https://api.complycube.com/v1/addresses/{:addressId} \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
          	"propertyNumber": "Flat 57",
          	"toDate": "2020-01-01"
        }'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const { ComplyCube } = require("@complycube/api");

const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });

const address = await complycube.address.update("ADDRESS_ID", {
    propertyNumber: "Flat 57",
    toDate: "2020-01-01"
});
```

{% endtab %}

{% tab title="Python" %}

```python
from complycube import ComplyCubeClient

cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')

updated_address = cc_api.addresses.update(
    'ADDRESS_ID', 
    propertyNumber='Flat 57', 
    toDate='2020-01-01'
)
```

{% endtab %}

{% tab title="PHP" %}

```php
use ComplyCube\ComplyCubeClient;

$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');

$address = $ccapi->address()->update('CLIENT_ID', ['country' => 'US']);
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using ComplyCube.Net;
using ComplyCube.Net.Resources.Addresses;

var addressApi = new AddressApi(new ComplyCubeClient("<YOUR_API_KEY>"));

var update = new AddressRequest {
  propertyNumber = "Flat 57",
  toDate = new DateTime(2020, 01, 01);
};

var address = await addressApi.UpdateAsync(update);
```

{% endtab %}
{% endtabs %}

### Example response

{% tabs %}
{% tab title="Success (200)" %}

```json
{
    "id": "5eb1276f96be4a0008713af6",
    "clientId": "5eb1276d96be4a0008713af5",
    "type": "main",
    "propertyNumber": "Flat 57",
    "line": "Common street",
    "city": "Aldgate",
    "state": "London",
    "postalCode": "W10 11L",
    "country": "GB",
    "fromDate": "2007-09-01",
    "toDate": "2020-01-01",
    "createdAt": "2020-01-04T17:24:29.146Z",
    "updatedAt": "2020-01-04T17:36:10.712Z"
}
```

{% endtab %}

{% tab title="Resource Not Found (404)" %}

```json
{
    "type": "resource_not_found",
    "message": "Invalid address id '5eb1276f96be4a0008713af5'"
}

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.complycube.com/documentation/api-reference/core-resources/addresses/update-an-address.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
