Retrieve a phone number
Return the details of a phone number associated with the given external connection.
GET
/
external_connections
/
{id}
/
phone_numbers
/
{phone_number_id}
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const phoneNumber = await client.externalConnections.phoneNumbers.retrieve('1234567889', {
id: '1293384261075731499',
});
console.log(phoneNumber.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
phone_number = client.external_connections.phone_numbers.retrieve(
phone_number_id="1234567889",
id="1293384261075731499",
)
print(phone_number.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
phoneNumber, err := client.ExternalConnections.PhoneNumbers.Get(
context.TODO(),
"1234567889",
telnyx.ExternalConnectionPhoneNumberGetParams{
ID: "1293384261075731499",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", phoneNumber.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.externalconnections.phonenumbers.PhoneNumberRetrieveParams;
import com.telnyx.sdk.models.externalconnections.phonenumbers.PhoneNumberRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
PhoneNumberRetrieveParams params = PhoneNumberRetrieveParams.builder()
.id("1293384261075731499")
.phoneNumberId("1234567889")
.build();
PhoneNumberRetrieveResponse phoneNumber = client.externalConnections().phoneNumbers().retrieve(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
phone_number = telnyx.external_connections.phone_numbers.retrieve("1234567889", id: "1293384261075731499")
puts(phone_number)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$phoneNumber = $client->externalConnections->phoneNumbers->retrieve(
'1234567889', id: '1293384261075731499'
);
var_dump($phoneNumber);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx external-connections:phone-numbers retrieve \
--api-key 'My API Key' \
--id 1293384261075731499 \
--phone-number-id 1234567889curl --request GET \
--url https://api.telnyx.com/v2/external_connections/{id}/phone_numbers/{phone_number_id} \
--header 'Authorization: Bearer <token>'{
"data": {
"ticket_id": "542c3bca-d247-42bc-8fe7-e01d16ecd761",
"telephone_number": "<string>",
"number_id": "<string>",
"civic_address_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"location_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"displayed_country_code": "<string>",
"acquired_capabilities": []
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifies the resource.
Example:
"1293384261075731499"
A phone number's ID via the Telnyx API
Example:
"1234567889"
Response
Successful response
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const phoneNumber = await client.externalConnections.phoneNumbers.retrieve('1234567889', {
id: '1293384261075731499',
});
console.log(phoneNumber.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
phone_number = client.external_connections.phone_numbers.retrieve(
phone_number_id="1234567889",
id="1293384261075731499",
)
print(phone_number.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
phoneNumber, err := client.ExternalConnections.PhoneNumbers.Get(
context.TODO(),
"1234567889",
telnyx.ExternalConnectionPhoneNumberGetParams{
ID: "1293384261075731499",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", phoneNumber.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.externalconnections.phonenumbers.PhoneNumberRetrieveParams;
import com.telnyx.sdk.models.externalconnections.phonenumbers.PhoneNumberRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
PhoneNumberRetrieveParams params = PhoneNumberRetrieveParams.builder()
.id("1293384261075731499")
.phoneNumberId("1234567889")
.build();
PhoneNumberRetrieveResponse phoneNumber = client.externalConnections().phoneNumbers().retrieve(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
phone_number = telnyx.external_connections.phone_numbers.retrieve("1234567889", id: "1293384261075731499")
puts(phone_number)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$phoneNumber = $client->externalConnections->phoneNumbers->retrieve(
'1234567889', id: '1293384261075731499'
);
var_dump($phoneNumber);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx external-connections:phone-numbers retrieve \
--api-key 'My API Key' \
--id 1293384261075731499 \
--phone-number-id 1234567889curl --request GET \
--url https://api.telnyx.com/v2/external_connections/{id}/phone_numbers/{phone_number_id} \
--header 'Authorization: Bearer <token>'{
"data": {
"ticket_id": "542c3bca-d247-42bc-8fe7-e01d16ecd761",
"telephone_number": "<string>",
"number_id": "<string>",
"civic_address_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"location_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"displayed_country_code": "<string>",
"acquired_capabilities": []
}
}