> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# 電話番号を取得

GET https://api.elevenlabs.io/v1/convai/phone-numbers/{phone_number_id}

電話番号の詳細をIDで取得

Reference: https://elevenlabs.io/docs/api-reference/phone-numbers/get

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Request

### Path parameters

- `phone_number_id` (string, required) — 電話番号ID。電話番号をインポートすると返されます。

## Response

### 200

成功レスポンス。

- `conversational_ai_phone_numbers_get_Response_200`
  - `provider`: `twilio` (GetPhoneNumberTwilioResponseModel)
    - `label` (string, required) — 電話番号のラベル
    - `phone_number` (string, required) — 電話番号
    - `phone_number_id` (string, required) — 電話番号のID
    - `assigned_agent` (PhoneNumberAgentInfo, optional, nullable) — 電話番号に割り当てられたエージェント。
    - `supports_inbound` (boolean, optional, default: true, deprecated) — このフィールドは非推奨であり、今後削除されます。この電話番号が着信通話に対応しているかどうかです。
    - `supports_outbound` (boolean, optional, default: true, deprecated) — このフィールドは非推奨であり、今後削除されます。この電話番号が発信通話に対応しているかどうかです。
  - `provider`: `exotel` (GetPhoneNumberExotelResponseModel)
    - `label` (string, required) — 電話番号のラベル
    - `phone_number` (string, required) — 電話番号
    - `phone_number_id` (string, required) — 電話番号のID
    - `assigned_agent` (PhoneNumberAgentInfo, optional, nullable) — 電話番号に割り当てられたエージェント。
    - `supports_inbound` (boolean, optional, default: true, deprecated) — このフィールドは非推奨であり、今後削除されます。この電話番号が着信通話に対応しているかどうかです。
    - `supports_outbound` (boolean, optional, default: true, deprecated) — このフィールドは非推奨であり、今後削除されます。この電話番号が発信通話に対応しているかどうかです。
  - `provider`: `sip_trunk` (GetPhoneNumberSIPTrunkResponseModel)
    - `label` (string, required) — 電話番号のラベル
    - `livekit_stack` (enum, required, default: standard) — この番号に使用するLivekitスタックのタイプ。
      - Allowed values: `standard`, `static`
    - `phone_number` (string, required) — 電話番号
    - `phone_number_id` (string, required) — 電話番号のID
    - `assigned_agent` (PhoneNumberAgentInfo, optional, nullable) — 電話番号に割り当てられたエージェント。
    - `inbound_trunk` (GetPhoneNumberInboundSIPTrunkConfigResponseModel, optional, nullable) — 着信SIPトランクの設定（設定されている場合）。
    - `outbound_trunk` (GetPhoneNumberOutboundSIPTrunkConfigResponseModel, optional, nullable) — 発信SIPトランクの設定（設定されている場合）。
    - `store_sip_messages` (boolean, optional, default: true) — この電話番号のSIPメッセージを保存するかどうか。
    - `provider_config` (GetPhoneNumberOutboundSIPTrunkConfigResponseModel, optional, nullable, deprecated) — 電話番号のSIPトランク設定詳細
    - `supports_inbound` (boolean, optional, default: true, deprecated) — このフィールドは非推奨であり、今後削除されます。この電話番号が着信通話に対応しているかどうかです。
    - `supports_outbound` (boolean, optional, default: true, deprecated) — このフィールドは非推奨であり、今後削除されます。この電話番号が発信通話に対応しているかどうかです。

## Errors

### 422 Unprocessable Entity Error

検証エラー

- `detail` (list of ValidationError, optional)

## Types

### PhoneNumberAgentInfo

- `agent_id` (string, required) — エージェントのID
- `agent_name` (string, required) — エージェントの名前。
- `environment` (string, optional, nullable) — この番号への通話で環境変数を解決するために使用する環境です。
- `branch_id` (string, optional, nullable) — この番号への通話に使用するエージェントブランチ。

### GetPhoneNumberInboundSIPTrunkConfigResponseModel

- `allowed_addresses` (list of string, required) — トランクの使用を許可するIPアドレスのリスト。リストの各項目には、個別のIPアドレスまたはCIDRブロックを表すClassless Inter-Domain Routing表記を指定できます。
- `allowed_numbers` (list of string, required, nullable) — トランクの使用を許可する電話番号のリスト。
- `media_encryption` (enum, required, default: allowed)
  - Allowed values: `disabled`, `allowed`, `required`
- `has_auth_credentials` (boolean, required) — 認証情報が設定されているかどうか。
- `username` (string, optional, nullable) — SIPトランクのユーザー名（利用可能な場合）
- `remote_domains` (list of string, optional, nullable) — TLS証明書の検証に使用するリモートSIPサーバーのドメイン。
- `attributes_to_headers` (map from string to string, optional) — attributes_to_headers用の動的変数名からヘッダー名へのマップ

### GetPhoneNumberOutboundSIPTrunkConfigResponseModel

電話番号のSIPトランク設定詳細

- `address` (string, required) — SIP INVITEの送信先ホスト名またはIP
- `transport` (enum, required, default: auto) — SIPトランスポートに使用するプロトコル
  - Allowed values: `auto`, `udp`, `tcp`, `tls`
- `media_encryption` (enum, required, default: allowed) — メディアを暗号化するかどうか（データレイヤー）。
  - Allowed values: `disabled`, `allowed`, `required`
- `has_auth_credentials` (boolean, required) — 認証情報が設定されているかどうか。
- `headers` (map from string to string, optional) — INVITEリクエストのSIPヘッダー
- `attributes_to_headers` (map from string to string, optional) — attributes_to_headers用の動的変数名からヘッダー名へのマップ
- `username` (string, optional, nullable) — SIPトランクのユーザー名（利用可能な場合）
- `has_outbound_trunk` (boolean, optional, default: false) — LiveKit SIPアウトバウンドトランクが設定されているかどうか。
- `enabled_codecs` (list of enum, optional) — 発信通話のSDPで提供するメディアコーデック。空の場合、サポートされているすべてのコーデックが提供されます。
  - Allowed values: `G722/8000`, `PCMU/8000`, `PCMA/8000`

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItems

## Examples

**Response**

```json
{
  "provider": "twilio",
  "label": "Customer Support",
  "phone_number": "+1234567890",
  "phone_number_id": "phone_123"
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/convai/phone-numbers/TeaqRRdTcIfIu2i7BYfT"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/convai/phone-numbers/TeaqRRdTcIfIu2i7BYfT';
const options = {method: 'GET'};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.elevenlabs.io/v1/convai/phone-numbers/TeaqRRdTcIfIu2i7BYfT"

	req, _ := http.NewRequest("GET", url, nil)

	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.elevenlabs.io/v1/convai/phone-numbers/TeaqRRdTcIfIu2i7BYfT")

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

request = Net::HTTP::Get.new(url)

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.elevenlabs.io/v1/convai/phone-numbers/TeaqRRdTcIfIu2i7BYfT")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/convai/phone-numbers/TeaqRRdTcIfIu2i7BYfT');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/phone-numbers/TeaqRRdTcIfIu2i7BYfT");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/phone-numbers/TeaqRRdTcIfIu2i7BYfT")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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