> For the complete documentation index, see [llms.txt](https://docs.complycube.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.complycube.com/documentation/api-reference/core-resources/addresses/create-an-address.md).

# Create an address

### URL

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

Creates a new address.

### Headers

<table><thead><tr><th width="277">Name</th><th width="107">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>

### Body

<table><thead><tr><th width="277">Name</th><th width="107">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>clientId</code><mark style="color:red;">*</mark></td><td>string</td><td>The ID of the client associated with this address.</td></tr><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 of the client's address.</td></tr><tr><td><code>buildingName</code></td><td>string</td><td>The building name of the client's address.</td></tr><tr><td><code>line</code><mark style="color:red;">*</mark></td><td>string</td><td>The line of the client's address.</td></tr><tr><td><code>city</code><mark style="color:red;">*</mark></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><mark style="color:red;">*</mark></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 \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
               "clientId":"CLIENT_ID",
               "type": "main",
               "propertyNumber": "Flat 323",
               "line": "Common street",
               "city": "Aldgate",
               "state": "London",
               "postalCode": "W99 0RD",
               "country": "GB",
               "fromDate": "2007-09-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.create("CLIENT_ID", {
    type: "main",
    propertyNumber: "Flat 323",
    line: "Common street",
    city: "Aldgate",
    state: "London",
    postalCode: "W99 0RD",
    country: "GB",
    fromDate: "2007-09-01"
});
```

{% endtab %}

{% tab title="Python" %}

```python
from complycube import ComplyCubeClient
cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')

new_address = {    
    'type': 'main',
    'propertyNumber': 'Flat 323',
    'line': 'Common street',
    'city': 'Aldgate',
    'state': 'London',
    'postalCode': "W99 0RD",
    'country': 'GB',
    'fromDate': '2007-09-01'
}

cc_api.addresses.create('CLIENT_ID',**new_address)
```

{% endtab %}

{% tab title="PHP" %}

```php
use ComplyCube\ComplyCubeClient;

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

$result = $ccapi->address()->create('CLIENT_ID', [
    'type' => 'main',
    'line' => 'Common street',
    'city' => 'Aldgate',
    'country' => 'GB'
]);

```

{% endtab %}

{% tab title=".NET" %}

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

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

var addressRequest = new AddressRequest {
  clientId = "CLIENT_ID",
  type = "main",
  propertyNumber = "Flat 323",
  line = "Common street",
  city = "Aldgate",
  state = "London",
  postalCode = "W99 0RD",
  country = "GB",
  fromDate = new DateTime(2007, 09, 01);
};

var address = await addressApi.CreateAsync(addressRequest);
```

{% endtab %}
{% endtabs %}

### Example responses

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

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

{% endtab %}

{% tab title="Invalid Request (400)" %}

```json
{
    "type": "invalid_request",
    "message": "'type' should be equal to one of the allowed values:main,alternative,other",
    "param": "type"
}
```

{% endtab %}

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

```json
{
    "type": "resource_not_found",
    "message": "Invalid client id '5eb1276d96be4a0008713af2'"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
