---
title: "Connect your BusinessPhoneSystem"
description: "Build against your own A1PBX account hostname."
---

## Confirm your account details

Obtain your assigned hostname, A1PBX API key, and enabled API version. The examples use `/app/api/7` and header authentication. Confirm both with A1ROUTES before use.

## Start with call history

If call-history access is enabled, use a read request to check connectivity without initiating a call. Save your account identifier as `A1PBX_ACCOUNT_ID` and your key as `A1PBX_API_KEY`.

### cURL

```bash
curl --fail-with-body --get \
  "https://$A1PBX_ACCOUNT_ID.a1routes.com/app/api/7/xml_cdr" \
  --header "Authorization: Basic $A1PBX_API_KEY" \
  --data-urlencode "limit=20" \
  --data-urlencode "offset=0" \
  --data-urlencode "order_by=start_epoch desc"
```

### Node.js

```javascript
const url = new URL(`https://${process.env.A1PBX_ACCOUNT_ID}.a1routes.com/app/api/7/xml_cdr`);
url.searchParams.set('limit', "20");
url.searchParams.set('offset', "0");
url.searchParams.set('order_by', "start_epoch desc");
const response = await fetch(url, {
  headers: {
    Authorization: `Basic ${process.env.A1PBX_API_KEY}`,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.text());
```

### Python

```python
import os
import requests
url = f"https://{os.environ['A1PBX_ACCOUNT_ID']}.a1routes.com/app/api/7/xml_cdr"
response = requests.get(
    url,
    params={
        "limit": "20",
        "offset": "0",
        "order_by": "start_epoch desc",
    },
    headers={"Authorization": "Basic " + os.environ["A1PBX_API_KEY"]},
    timeout=30,
)
response.raise_for_status()
print(response.text)
```

### PHP

```php
<?php
$url = 'https://' . getenv('A1PBX_ACCOUNT_ID') . '.a1routes.com/app/api/7/xml_cdr';
$url .= '?' . http_build_query([
    'limit' => '20',
    'offset' => '0',
    'order_by' => 'start_epoch desc',
]);
$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTPHEADER => ['Authorization: Basic ' . getenv('A1PBX_API_KEY')],
]);
$body = curl_exec($ch);
if ($body === false) throw new RuntimeException(curl_error($ch));
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) throw new RuntimeException('HTTP ' . $status);
echo $body;
```

## Choose a workflow

- [Originate a call](/docs/a1pbx/originate) from an existing authorized extension.
- [Find recordings](/docs/a1pbx/recordings) and [download audio](/docs/a1pbx/recording).
- [Read voicemail](/docs/a1pbx/voicemail) where mailbox access is enabled.

## Keep access narrow

Request only the operations required for your integration. Mailbox and recording access must match the user's entitlement; account membership alone should not be assumed to grant access to every message.
