---
title: "Create Address"
source_url: https://docs.rapyd.net/en/create-address.html
lang: en
---

# Create Address

Create an address.

> **Note:**
>
> - The code samples include successful requests (200) and bad requests (400).
>
>   - For error messages that appear due to bad requests (400), see:
>
>     - [General Errors](https://docs.rapyd.net/en/general-errors.md "General Errors")
>     - [Address Errors](https://docs.rapyd.net/en/address-errors.md "Address Errors")
>   - For information about unauthorized request (401) and other authentication errors, see [Troubleshooting Authentication and Authorization Errors](https://docs.rapyd.net/en/troubleshooting-authentication-and-authorization-errors.md "Troubleshooting Authentication and Authorization Errors").

### Parameters

### Request Header Parameters

- - access_key
  - Unique access key provided by Rapyd for each authorized user.

    See [Developers](https://docs.rapyd.net/en/developers.md "Developers").
- - Content-Type
  - Indicates that the data appears in JSON format. Set to **application/json**.
- - idempotency
  - A unique key that prevents the platform from creating the same object twice.

    See [Idempotency](https://docs.rapyd.net/en/idempotency.md "Idempotency").
- - salt
  - Random string. Recommended length: 8-16 characters.
- - signature
  - Signature calculated for each request individually.

    See [Request Signatures](https://docs.rapyd.net/en/request-signatures.md "Request Signatures").
- - timestamp
  - Timestamp for the request, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time") (seconds).

### Request Body Parameters

- - canton
  - Name of the canton administrative subdivision, as used in banking.
- - city
  - City portion of the address.

    Required for issuance of a card to the wallet contact. Required for creating a Visa card payment that requires 3DS.
- - country
  - The two-letter ISO 3166-1 ALPHA-2 code for the country.

    Required for creating a Visa card payment that requires 3DS.
- - district
  - Name of the district administrative subdivision, as used in banking.
- - line_1
  - Line 1 of the address, such as a building number and street name.

    Required for creating a Visa card payment that requires 3DS.
- - line_2
  - Line 2 of the address, such as a suite or apartment number, or the name of a named building.
- - line_3
  - Line 3 of the address.
- - metadata
  - A JSON object defined by the client. See [Metadata](https://docs.rapyd.net/en/metadata.md "Metadata").
- - name
  - The name of a contact person or an "in care of" person at this address. For a **personal** wallet contact type, alphabetic characters and spaces.

    Required for creating a Visa card payment that requires 3DS.
- - phone_number
  - Phone number associated with this specific address in E.164 format. Must be unique.

    Required for creating a Visa card payment that requires 3DS.
- - state
  - State or province portion of the address.

    Required for creating a Visa card payment that requires 3DS.
- - zip
  - Postal code portion of the address.

    Required for creating a Visa card payment that requires 3DS.

### Response Parameters

- - canton
  - Name of the canton administrative subdivision, as used in banking.
- - city
  - City portion of the address.
- - country
  - The two-letter ISO 3166-1 ALPHA-2 code for the country.
- - created_at
  - Time of creation of the object, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - district
  - Name of the district administrative subdivision, as used in banking.
- - id
  - ID of the `address` object.
- - line_1
  - Line 1 of the address, such as a building number and street name.
- - line_2
  - Line 2 of the address, such as a suite or apartment number, or the name of a named building.
- - line_3
  - Line 3 of the address.
- - metadata
  - A JSON object defined by the client. See [Metadata](https://docs.rapyd.net/en/metadata.md "Metadata").
- - name
  - The name of a contact person or an "in care of" person at this address. For a **personal** wallet contact, alphabetic characters and spaces.
- - phone_number
  - Phone number associated with this specific address in E.164 format. Must be unique.
- - state
  - State or province portion of the address.
- - zip
  - Postal code portion of the address.

### Code Samples

- - .Net Core

    - ```
      using System;
      using System.Text.Json;

      namespace RapydApiRequestSample
      {
          class Program
          {
              static void Main(string[] args)
              {
                  try
                  {
                      var requestObj = new
                      {
                          name = "John Doe",
                          line_1 = "123 State Street",
                          line_2 = "Apt. 34",
                          line_3 = "",
                          city = "Anytown",
                          district = "",
                          canton = "",
                          state = "NY",
                          country = "US",
                          zip = "12345",
                          phone_number = "12125559999",
                          metadata = new { merchant_defined = true }
                      };
                      string request = JsonSerializer.Serialize(requestObj);

                      string result = RapydApiRequestSample.Utilities.MakeRequest("POST", "/v1/addresses", request);

                      Console.WriteLine(result);
                  }
                  catch (Exception e)
                  {
                      Console.WriteLine("Error completing request: " + e.Message);
                  }
              }
          }
      }
      ```
- - JavaScript

    - ```javascript
      const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;

      async function main() {
        try {
          const body = {
            name: 'John Doe',
            line_1: '123 State Street',
            line_2: 'Apt. 34',
            line_3: '',
            city: 'Anytown',
            district: '',
            canton: '',
            state: 'NY',
            country: 'US',
            zip: '12345',
            phone_number: '12125559999',
            metadata: {
              merchant_defined: true
            }
          };
          const result = await makeRequest('POST', '/v1/addresses', body);

          console.log(result);
        } catch (error) {
          console.error('Error completing request', error);
        }
      }
      ```
- - PHP

    - ```php
      <?php
      $path = $_SERVER['DOCUMENT_ROOT'];
      $path .= "/<path-to-your-utility-file>/utilities.php";
      include($path);

      $body = [
          "name" => "John Doe",
          "line_1" => "123 State Street",
          "line_2" => "Apt. 34",
          "line_3" => "",
          "city" => "Anytown",
          "district" => "",
          "canton" => "",
          "state" => "NY",
          "country" => "US",
          "zip" => "12345",
          "phone_number" => "12125559999",
          "metadata" => array(
              "merchant_defined" => true
          )
      ];

      try {
          $object = make_request('post', '/v1/addresses', $body);
          var_dump($object);
      } catch(Exception $e) {
          echo "Error =>$e";
      }
      ?>
      ```
- - Python

    - ```python
      from pprint import pprint

      from utilities import make_request

      address = {
          "name": "John Doe",
          "line_1": "123 State Street",
          "line_2": "Apt. 34",
          "line_3": "",
          "city": "Anytown",
          "district": "",
          "canton": "",
          "state": "NY",
          "country": "US",
          "zip": "12345",
          "phone_number": "12125559999",
          "metadata": {
              "merchant_defined": True
          }
      }
      result = make_request(method='post', path='/v1/addresses', body=address)
      pprint(result)
      ```

- /v1/addresses

- Create Address
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/addresses' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "name": "John Doe",
      "line_1": "123 State Street",
      "line_2": "Apt. 34",
      "city": "Anytown",
      "country": "US",
      "zip": "12345",
      "phone_number": "12125559999"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "",
          "status": "SUCCESS",
          "message": "",
          "response_code": "",
          "operation_id": "5babe286-9f81-4b45-9170-3026136aacd1"
      },
      "data": {
          "id": "address_f9189070a0671b1a4302851b839d166a",
          "name": "John Doe",
          "line_1": "123 First Street",
          "line_2": "Apt. 34",
          "line_3": "",
          "city": "Anytown",
          "state": "",
          "country": "US",
          "zip": "12345",
          "phone_number": "12125559999",
          "metadata": {},
          "canton": "",
          "district": "",
          "created_at": 1761820962
      }
  }
  ```

- Bad Request - Name Missing
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/addresses' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "line_1": "123 State Street",
      "line_2": "Apt. 34",
      "city": "Anytown",
      "country": "US",
      "zip": "12345",
      "phone_number": "12125559999"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "INVALID_ADDRESS_NAME",
          "status": "ERROR",
          "message": "The request attempted an operation that requires an address, but the name associated with the address was missing. The request was rejected. Corrective action: In the 'name' field, provide a valid personal or business name.",
          "response_code": "INVALID_ADDRESS_NAME",
          "operation_id": "dbea0f73-ed2e-4bfe-8145-a390e0693f5a"
      }
  }
  ```

- Bad Request - Street Address Line 1 Missing
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/addresses' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "name": "John Doe",
      "line_2": "Apt. 34",
      "city": "Anytown",
      "country": "US",
      "zip": "12345",
      "phone_number": "12125559999"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "INVALID_ADDRESS_LINE_1",
          "status": "ERROR",
          "message": "The request attempted an operation that requires an address, but Line 1 of the address was missing. The request was rejected. Corrective action: In the 'line_1' field, provide a valid street address.",
          "response_code": "INVALID_ADDRESS_LINE_1",
          "operation_id": "351c5186-76c9-4fdb-a557-ac5ec1afc5b0"
      }
  }
  ```
