> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Add a business address

POST https://api-sandbox.payabli.com/api/v2/businesses/{businessReference}/addresses
Content-Type: application/json

Adds an address to a business. Returns the new address and its `businessAddressReference`.

Reference: https://docs.payabli.com/developers/api-reference/businesses/add-a-business-address

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api-sandbox.payabli.com/api` (Sandbox, default)
- `https://api.payabli.com/api` (Production)

## Request

### Path parameters

- `businessReference` (string, required) — The business reference (`businessUuid`).

### Body (application/json)

This endpoint expects a CreateBusinessAddressRequest.

- `type` (enum, required) — The address role.
  - Allowed values: `legal`, `billing`, `shipping`, `remittance`, `physical`, `mailing`
- `addressLine1` (string, required) — The first line of the street address.
- `cityLocality` (string, required) — The city or locality.
- `stateProvince` (string, required) — The state or province.
- `postalCode` (string, required) — The postal or ZIP code.
- `country` (string, required) — The two-character ISO country code.
- `location` (enum, optional) — The physical use of the address.
  - Allowed values: `office`, `warehouse`, `retail`, `home`, `other`
- `addressLine2` (string, optional) — The second line of the street address.
- `floor` (string, optional) — The floor, if applicable.
- `suiteApartNumber` (string, optional) — The suite or apartment number, if applicable.

## Response

### 201

Address added.

- `success` (boolean, required) — Whether the request succeeded.
- `message` (string, required, nullable) — A human-readable result message.
- `traceId` (string, required, nullable) — The trace identifier for the request, useful for support.
- `data` (BusinessAddressResponse, required, nullable) — The business address.

## Errors

### 400 Bad Request Error

Bad request / invalid data.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

### 401 Unauthorized Error

Unauthorized request.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

### 404 Not Found Error

The requested resource wasn't found.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

### 500 Internal Server Error

Internal server error.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

## Types

### BusinessAddressResponse

A business address, returned by the address endpoints.

- `_links` (BusinessAddressLinks, required) — Hypermedia links for the business address resource.
- `businessAddressReference` (string, required) — The reference of the business-to-address link, used to read and manage the address. Valid only under its own business.
- `type` (enum, required) — The address role.
  - Allowed values: `legal`, `billing`, `shipping`, `remittance`, `physical`, `mailing`
- `location` (enum, required) — The physical use of the address.
  - Allowed values: `office`, `warehouse`, `retail`, `home`, `other`
- `addressLine1` (string, required) — The first line of the street address.
- `addressLine2` (string, required, nullable) — The second line of the street address.
- `cityLocality` (string, required) — The city or locality.
- `stateProvince` (string, required) — The state or province.
- `postalCode` (string, required) — The postal or ZIP code.
- `country` (string, required) — The two-character ISO country code.
- `floor` (string, required, nullable) — The floor, if applicable.
- `suiteApartNumber` (string, required, nullable) — The suite or apartment number, if applicable.

### PayabliErrorBodyResponseData

Object with detailed error context.

- `explanation` (string, optional) — Human-readable explanation of what happened.
- `todoAction` (string, optional) — Suggested resolution.

### BusinessAddressLinks

Hypermedia links for a business address resource.

- `self` (string, optional) — Relative path to the business address resource.
- `business` (string, optional) — Relative path to the business that owns the address.

## Examples

**Request**

```json
{
  "type": "mailing",
  "addressLine1": "202 Warehouse Ln",
  "cityLocality": "Austin",
  "stateProvince": "TX",
  "postalCode": "73302",
  "country": "US",
  "location": "warehouse"
}
```

**Response**

```json
{
  "success": true,
  "message": "Address added successfully",
  "traceId": "0HNOF89NNTM7O:00000092",
  "data": {
    "_links": {
      "self": "/v2/businesses/019fed1a-3d6e-75d3-a81e-cba3874b0a55/addresses/019fed1a-67d6-768a-b4cc-29d4299e21d9",
      "business": "/v2/businesses/019fed1a-3d6e-75d3-a81e-cba3874b0a55"
    },
    "businessAddressReference": "019fed1a-67d6-768a-b4cc-29d4299e21d9",
    "type": "mailing",
    "location": "warehouse",
    "addressLine1": "202 Warehouse Ln",
    "addressLine2": null,
    "cityLocality": "Austin",
    "stateProvince": "TX",
    "postalCode": "73302",
    "country": "US",
    "floor": null,
    "suiteApartNumber": null
  }
}
```

**SDK Code**

```python
import requests

url = "https://api-sandbox.payabli.com/api/v2/businesses/019fed1a-3d6e-75d3-a81e-cba3874b0a55/addresses"

payload = {
    "type": "mailing",
    "addressLine1": "202 Warehouse Ln",
    "cityLocality": "Austin",
    "stateProvince": "TX",
    "postalCode": "73302",
    "country": "US",
    "location": "warehouse"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api-sandbox.payabli.com/api/v2/businesses/019fed1a-3d6e-75d3-a81e-cba3874b0a55/addresses';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"type":"mailing","addressLine1":"202 Warehouse Ln","cityLocality":"Austin","stateProvince":"TX","postalCode":"73302","country":"US","location":"warehouse"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-sandbox.payabli.com/api/v2/businesses/019fed1a-3d6e-75d3-a81e-cba3874b0a55/addresses"

	payload := strings.NewReader("{\n  \"type\": \"mailing\",\n  \"addressLine1\": \"202 Warehouse Ln\",\n  \"cityLocality\": \"Austin\",\n  \"stateProvince\": \"TX\",\n  \"postalCode\": \"73302\",\n  \"country\": \"US\",\n  \"location\": \"warehouse\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.payabli.com/api/v2/businesses/019fed1a-3d6e-75d3-a81e-cba3874b0a55/addresses")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"type\": \"mailing\",\n  \"addressLine1\": \"202 Warehouse Ln\",\n  \"cityLocality\": \"Austin\",\n  \"stateProvince\": \"TX\",\n  \"postalCode\": \"73302\",\n  \"country\": \"US\",\n  \"location\": \"warehouse\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-sandbox.payabli.com/api/v2/businesses/019fed1a-3d6e-75d3-a81e-cba3874b0a55/addresses")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"mailing\",\n  \"addressLine1\": \"202 Warehouse Ln\",\n  \"cityLocality\": \"Austin\",\n  \"stateProvince\": \"TX\",\n  \"postalCode\": \"73302\",\n  \"country\": \"US\",\n  \"location\": \"warehouse\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-sandbox.payabli.com/api/v2/businesses/019fed1a-3d6e-75d3-a81e-cba3874b0a55/addresses', [
  'body' => '{
  "type": "mailing",
  "addressLine1": "202 Warehouse Ln",
  "cityLocality": "Austin",
  "stateProvince": "TX",
  "postalCode": "73302",
  "country": "US",
  "location": "warehouse"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/v2/businesses/019fed1a-3d6e-75d3-a81e-cba3874b0a55/addresses");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"mailing\",\n  \"addressLine1\": \"202 Warehouse Ln\",\n  \"cityLocality\": \"Austin\",\n  \"stateProvince\": \"TX\",\n  \"postalCode\": \"73302\",\n  \"country\": \"US\",\n  \"location\": \"warehouse\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "mailing",
  "addressLine1": "202 Warehouse Ln",
  "cityLocality": "Austin",
  "stateProvince": "TX",
  "postalCode": "73302",
  "country": "US",
  "location": "warehouse"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/v2/businesses/019fed1a-3d6e-75d3-a81e-cba3874b0a55/addresses")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```