Create a customer service record
Create a new customer service record for the provided phone number.
POST
/
customer_service_records
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const customerServiceRecord = await client.customerServiceRecords.create({
phone_number: '+13035553000',
});
console.log(customerServiceRecord.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
)
customer_service_record = client.customer_service_records.create(
phone_number="+13035553000",
)
print(customer_service_record.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"),
)
customerServiceRecord, err := client.CustomerServiceRecords.New(context.TODO(), telnyx.CustomerServiceRecordNewParams{
PhoneNumber: "+13035553000",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", customerServiceRecord.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.customerservicerecords.CustomerServiceRecordCreateParams;
import com.telnyx.sdk.models.customerservicerecords.CustomerServiceRecordCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CustomerServiceRecordCreateParams params = CustomerServiceRecordCreateParams.builder()
.phoneNumber("+13035553000")
.build();
CustomerServiceRecordCreateResponse customerServiceRecord = client.customerServiceRecords().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
customer_service_record = telnyx.customer_service_records.create(phone_number: "+13035553000")
puts(customer_service_record)<?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 {
$customerServiceRecord = $client->customerServiceRecords->create(
phoneNumber: '+13035553000',
additionalData: [
'accountNumber' => '123456789',
'addressLine1' => '123 Main St',
'authorizedPersonName' => 'John Doe',
'billingPhoneNumber' => '+12065551212',
'city' => 'New York',
'customerCode' => '123456789',
'name' => 'Entity Inc.',
'pin' => '1234',
'state' => 'NY',
'zipCode' => '10001',
],
webhookURL: 'https://example.com/webhook',
);
var_dump($customerServiceRecord);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx customer-service-records create \
--api-key 'My API Key' \
--phone-number +13035553000curl --request POST \
--url https://api.telnyx.com/v2/customer_service_records \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "+13035553000",
"webhook_url": "https://example.com/webhook",
"additional_data": {
"name": "Entity Inc.",
"authorized_person_name": "John Doe",
"pin": "1234",
"account_number": "123456789",
"customer_code": "123456789",
"address_line_1": "123 Main St",
"city": "New York",
"state": "NY",
"zip_code": "10001",
"billing_phone_number": "+12065551212"
}
}
'{
"data": {
"id": "db7cebdb-21a8-4e89-8f51-e03ba6b799bb",
"phone_number": "+2003271000",
"status": "pending",
"error_message": null,
"result": null,
"webhook_url": "https://example.com/webhook",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request.",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10010",
"title": "Authorization failed",
"detail": "You do not have permission to perform the requested action on the specified resource or resources.",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10010"
}
}
]
}{
"errors": [
{
"code": "10002",
"title": "Invalid phone number",
"detail": "The phone number is invalid.",
"source": {
"pointer": "/phone_numbers",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10002"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occurred.",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10007"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
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 customerServiceRecord = await client.customerServiceRecords.create({
phone_number: '+13035553000',
});
console.log(customerServiceRecord.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
)
customer_service_record = client.customer_service_records.create(
phone_number="+13035553000",
)
print(customer_service_record.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"),
)
customerServiceRecord, err := client.CustomerServiceRecords.New(context.TODO(), telnyx.CustomerServiceRecordNewParams{
PhoneNumber: "+13035553000",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", customerServiceRecord.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.customerservicerecords.CustomerServiceRecordCreateParams;
import com.telnyx.sdk.models.customerservicerecords.CustomerServiceRecordCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CustomerServiceRecordCreateParams params = CustomerServiceRecordCreateParams.builder()
.phoneNumber("+13035553000")
.build();
CustomerServiceRecordCreateResponse customerServiceRecord = client.customerServiceRecords().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
customer_service_record = telnyx.customer_service_records.create(phone_number: "+13035553000")
puts(customer_service_record)<?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 {
$customerServiceRecord = $client->customerServiceRecords->create(
phoneNumber: '+13035553000',
additionalData: [
'accountNumber' => '123456789',
'addressLine1' => '123 Main St',
'authorizedPersonName' => 'John Doe',
'billingPhoneNumber' => '+12065551212',
'city' => 'New York',
'customerCode' => '123456789',
'name' => 'Entity Inc.',
'pin' => '1234',
'state' => 'NY',
'zipCode' => '10001',
],
webhookURL: 'https://example.com/webhook',
);
var_dump($customerServiceRecord);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx customer-service-records create \
--api-key 'My API Key' \
--phone-number +13035553000curl --request POST \
--url https://api.telnyx.com/v2/customer_service_records \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "+13035553000",
"webhook_url": "https://example.com/webhook",
"additional_data": {
"name": "Entity Inc.",
"authorized_person_name": "John Doe",
"pin": "1234",
"account_number": "123456789",
"customer_code": "123456789",
"address_line_1": "123 Main St",
"city": "New York",
"state": "NY",
"zip_code": "10001",
"billing_phone_number": "+12065551212"
}
}
'{
"data": {
"id": "db7cebdb-21a8-4e89-8f51-e03ba6b799bb",
"phone_number": "+2003271000",
"status": "pending",
"error_message": null,
"result": null,
"webhook_url": "https://example.com/webhook",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request.",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10010",
"title": "Authorization failed",
"detail": "You do not have permission to perform the requested action on the specified resource or resources.",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10010"
}
}
]
}{
"errors": [
{
"code": "10002",
"title": "Invalid phone number",
"detail": "The phone number is invalid.",
"source": {
"pointer": "/phone_numbers",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10002"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occurred.",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10007"
}
}
]
}