# Create an account address

Source: https://developers.swell.is/backend-api/account-addresses/create-an-account-address

Create a new customer account address.

## Arguments

- `id` (objectId): Unique identifier for the address.
- `active` (boolean): Whether the address is active on the account. Inactive accounts will not be returned in the [Storefront API](https://developers.swell.is/frontend-api/introduction). Default: `true`.
- `parent_id` (objectId, required): The corresponding account `id` for the address.
- `address1` (string, required): Primary street address.
- `address2` (string): Secondary street address.
- `city` (string): City where the address is located.
- `company` (string): Customer's company name, if applicable.
- `country` (string): Country of the residence.
- `date_created` (date): Date of the address creation.
- `date_updated` (date): Date the address was updated.
- `fingerprint` (string): A unique fingerprint hashed from specific address fields that is used to prevent duplicate entries.
- `first_name` (string): First name listed for the address.
- `last_name` (string): Last name listed for the address.
- `name` (string): Combined name listed for the address.
- `parent` (Account): Link to the parent account.
- `phone` (string): Phone number listed for the address.
- `state` (string): State of the address.
- `zip` (string): Postal code of the address.

## Example request

`POST /accounts:addresses`

**cURL**

```sh
$ curl https://api.swell.store/accounts:addresses \
  -u store-id:secret-key \
  -d email= "adoringfan@azurasstar.com" \
  -d first_name="Adoring" \
  -d last_name="Fan" \
  -d address1="123 Breezehome St" \
	-d city="Whiterun" \
	-d country="US" \
```

**Node**

```javascript
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');

await swell.post('/accounts:addresses', {
  email: 'adoringfan@azurasstar.com',
  first_name: 'Adoring'
  last_name: 'Fan'
	address1: '123 Breezehome St'
	city: 'Whiterun'
	country: 'US'
});
```

**PHP**

```php
<?php $swell = new \Swell\Client('store-id', 'secret-key');

$swell->post('/accounts:addresses', [
  'email' => 'adoringfan@azurasstar.com',
  'first_name' => 'Adoring'
  'last_name' => 'Fan'
  'address1' => '123 Breezehome St'
	'city' => 'Whiterun'
	'country' => 'US'
]);
```

## Example response

```json
{
      "parent_id": "621e53a6213eaf013d1fa6b2",
      "name": "Adoring Fan",
      "first_name": "Adoring",
      "last_name": "Fan",
      "address1": "123 Breezehome St",
      "address2": null,
      "city": "Whiterun",
      "state": "NY",
      "zip": null,
      "country": "US",
      "phone": null,
      "company": "Honningbrew Meadery",
      "fingerprint": "1219483071269e91f9528ac1c4237944",
      "date_created": "2022-07-12T17:53:55.762Z",
      "active": true,
      "id": "62cdb5332c0a5f00123c5fd7"
    }
```
