> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rasen.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rasen.ai/_mcp/server.

# Get the SIP trunk setup

GET https://api.rasen.ai/v1/telephony/sip-trunk

Get the workspace's SIP trunk: its state, the SIP addresses your carrier sends calls to, and its inbound connections and outbound trunks. A workspace without SIP trunking answers enabled false. Trunk passwords are write-only and never appear in a response. When state is failed, failed_step and failure_reason say where and why, as safe codes; retry with connectSipTrunk. A stopped address regeneration reports an address_ step on a ready setup; retry it with regenerateSipAddress. This read never starts or retries work.

Reference: https://docs.rasen.ai/enterprise/api-reference/telephony/get-sip-trunk-setup

## Authentication

- `Authorization` header (bearer token, required) — An organisation-owned key whose secret starts ra_org_. The Owner or an Admin of an organisation that Rasen has invited makes it in the app; no API operation makes, changes, rotates or revokes a key. On a workspace operation send the workspace ID in the Rasen-Workspace header; without it the answer is 400 invalid_request with details.field Rasen-Workspace. A workspace outside the organisation or outside the key's workspace list is 404 not_found. An organisation that is not invited gets 403 organisation_api_not_enabled.

## Request

### Headers

- `Rasen-Workspace` (string, required) — The ID of the workspace that this operation acts in. It must be a workspace of the key's organisation and in the key's workspace list. A missing, empty or malformed value is 400 invalid_request with details.field Rasen-Workspace; a workspace outside the organisation or the key's workspace list is the hidden 404 not_found.

## Response

### 200

The SIP trunk setup.

- `enabled` (boolean, required) — SIP trunking is switched on for this workspace. When false, every other field is null or empty.
- `state` (string, required, nullable)
- `address_regenerating` (boolean, required)
- `addresses` (list of SipTrunkAddress, required)
- `inbound_connections` (list of SipTrunkInboundConnection, required)
- `outbound_trunks` (list of SipTrunkOutboundTrunk, required)
- `failed_step` (string, optional, nullable) — The setup step that failed (state failed), or the address regeneration step that stopped (state ready with address_regenerating); null otherwise. A step name only, never a key or a value.
- `failure_reason` (string, optional, nullable) — A safe code for why the last setup job failed; null when nothing failed. Never provider text. provider_refused, provider_conflict: the SIP provider refused a setup request; provider_unavailable: it could not be reached; provider_auth_failed: the platform's provider access was refused; provider_rate_limited: the provider limited requests; sip_trunk_not_ready: the SIP setup was not ready for this step; internal_error: a platform fault. Retry with connectSipTrunk, or with regenerateSipAddress when failed_step starts with address_; contact support if it repeats.

## Errors

### 400 Bad Request Error

Invalid input or cursor. Correct the request.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 401 Unauthorized Error

Invalid, expired or revoked API key. Creator departure or membership changes do not invalidate a workspace key.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 403 Forbidden Error

Operation not allowed by current credential or workspace access.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 429 Too Many Requests Error

Rate limited. Respect Retry-After and retry the same intent where permitted.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 500 Internal Server Error

Internal error. The effect may have happened. Retry the same request with the same Idempotency-Key; read the resource before creating a new intent. For an operation that takes an Idempotency-Key, a client retry with the same key is safe: the server replays the stored outcome if the first attempt took effect; if the first attempt had no effect, the retry performs the operation once. Never retry with a new key.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 503 Service Unavailable Error

Service unavailable. Respect Retry-After where present. For an operation that takes an Idempotency-Key, a client retry with the same key is safe: the server replays the stored outcome if the first attempt took effect; if the first attempt had no effect, the retry performs the operation once. Never retry with a new key.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

## Types

### SipTrunkAddress

- `region` (string, required)
- `uri` (string, required, nullable) — The SIP address your carrier sends calls to; null until it exists.
- `region_state` (string, required)

### SipTrunkInboundConnection

- `id` (string, required)
- `region` (string, required)
- `carrier_ips` (list of string, required) — The carrier IP addresses or CIDR ranges allowed to send calls.
- `enforce_carrier_ips` (boolean, required)
- `uri` (string, required, nullable)
- `in_use` (boolean, required) — A number routes through this connection.
- `created_at` (datetime, required)

### SipTrunkOutboundTrunk

- `id` (string, required)
- `kind` (string, required)
- `label` (string, required)
- `region` (string, required)
- `endpoint` (string, required) — The trunk's host name or IP address.
- `port` (integer, required)
- `transport` (string, required)
- `carrier_prefix` (string, required, nullable)
- `has_password` (boolean, required) — A trunk password is stored. The password itself is write-only and never answered.
- `in_use` (boolean, required)
- `state` (string, required)
- `created_at` (datetime, required)

### ErrorResponseError

Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

- `code` (string, required) — Stable code. Branch on code (and details.reason for conflict), never on message. Each code has one HTTP status; see components.x-error-catalog.
- `message` (string, required) — Safe description; no provider payload or submitted secrets.
- `details` (map from string to any, optional) — Safe code-specific details. The public fields for each code are listed in components.x-error-catalog. Details never contain a request fingerprint, a hash of a request, secret material or another tenant's data. forbidden may include required_capabilities (a list).
- `request_id` (string, optional) — Same value as the X-Request-Id header. Quote it to support.
- `retry` (string, optional) — Retry class of this code: no (fix the request or state first), yes (retry the same request and the same Idempotency-Key), retry_after (wait for Retry-After, then retry the same request). Open response vocabulary. Preserve unknown values; never assume they mean success.

## Examples

**Response**

```json
{
  "enabled": true,
  "state": "string",
  "address_regenerating": true,
  "addresses": [
    {
      "region": "string",
      "uri": "string",
      "region_state": "string"
    }
  ],
  "inbound_connections": [
    {
      "id": "string",
      "region": "string",
      "carrier_ips": [
        "string"
      ],
      "enforce_carrier_ips": true,
      "uri": "string",
      "in_use": true,
      "created_at": "2024-01-15T09:30:00Z"
    }
  ],
  "outbound_trunks": [
    {
      "id": "string",
      "kind": "string",
      "label": "string",
      "region": "string",
      "endpoint": "string",
      "port": 1,
      "transport": "string",
      "carrier_prefix": "string",
      "has_password": true,
      "in_use": true,
      "state": "string",
      "created_at": "2024-01-15T09:30:00Z"
    }
  ],
  "failed_step": "string",
  "failure_reason": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.rasen.ai/v1/telephony/sip-trunk"

headers = {
    "Rasen-Workspace": "ws_01j00000000000000000000000",
    "Authorization": "Bearer <token>"
}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.rasen.ai/v1/telephony/sip-trunk';
const options = {
  method: 'GET',
  headers: {
    'Rasen-Workspace': 'ws_01j00000000000000000000000',
    Authorization: 'Bearer <token>'
  }
};

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

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

url = URI("https://api.rasen.ai/v1/telephony/sip-trunk")

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

request = Net::HTTP::Get.new(url)
request["Rasen-Workspace"] = 'ws_01j00000000000000000000000'
request["Authorization"] = 'Bearer <token>'

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.get("https://api.rasen.ai/v1/telephony/sip-trunk")
  .header("Rasen-Workspace", "ws_01j00000000000000000000000")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.rasen.ai/v1/telephony/sip-trunk', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Rasen-Workspace' => 'ws_01j00000000000000000000000',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.rasen.ai/v1/telephony/sip-trunk");
var request = new RestRequest(Method.GET);
request.AddHeader("Rasen-Workspace", "ws_01j00000000000000000000000");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Rasen-Workspace": "ws_01j00000000000000000000000",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.rasen.ai/v1/telephony/sip-trunk")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```