Create gateway token key
Create gateway token key within the authenticated Telnyx account. Foreign and unknown resource IDs return the same 404 response. The token secret is returned only on the original create response. A replay returns metadata without the secret. Provisioning is advisory; ready is not a guarantee of inference availability.
curl --request POST \
--url https://api.telnyx.com/v2/llm_token_gateway/token_keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "support-service",
"token_group_id": "11111111-1111-4111-8111-111111111111",
"max_parallel_requests": 5
}
'import requests
url = "https://api.telnyx.com/v2/llm_token_gateway/token_keys"
payload = {
"name": "support-service",
"token_group_id": "11111111-1111-4111-8111-111111111111",
"max_parallel_requests": 5
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'support-service',
token_group_id: '11111111-1111-4111-8111-111111111111',
max_parallel_requests: 5
})
};
fetch('https://api.telnyx.com/v2/llm_token_gateway/token_keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.telnyx.com/v2/llm_token_gateway/token_keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'support-service',
'token_group_id' => '11111111-1111-4111-8111-111111111111',
'max_parallel_requests' => 5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.telnyx.com/v2/llm_token_gateway/token_keys"
payload := strings.NewReader("{\n \"name\": \"support-service\",\n \"token_group_id\": \"11111111-1111-4111-8111-111111111111\",\n \"max_parallel_requests\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.telnyx.com/v2/llm_token_gateway/token_keys")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"support-service\",\n \"token_group_id\": \"11111111-1111-4111-8111-111111111111\",\n \"max_parallel_requests\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/llm_token_gateway/token_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"support-service\",\n \"token_group_id\": \"11111111-1111-4111-8111-111111111111\",\n \"max_parallel_requests\": 5\n}"
response = http.request(request)
puts response.read_body{
"data": {
"record_type": "token_key",
"id": "11111111-1111-4111-8111-111111111111",
"created_at": "2026-10-07T08:00:00Z",
"updated_at": "2026-10-07T08:00:00Z",
"version": 1,
"name": "support-backend",
"token_group_id": "11111111-1111-4111-8111-111111111111",
"token_user_id": null,
"max_budget": 1000,
"budget_duration": "1d",
"tpm_limit": 10000000,
"rpm_limit": 6000,
"allowed_models": null,
"expires_at": null,
"blocked": false,
"required_end_user_id": false,
"spend": 0,
"reserved_spend": 0,
"budget_started_at": null,
"resets_at": null,
"max_parallel_requests": 5,
"provisioning": "ready"
}
}{
"data": {
"record_type": "token_key",
"id": "11111111-1111-4111-8111-111111111111",
"created_at": "2026-10-07T08:00:00Z",
"updated_at": "2026-10-07T08:00:00Z",
"version": 1,
"name": "support-backend",
"token_group_id": "11111111-1111-4111-8111-111111111111",
"token_user_id": null,
"max_budget": 1000,
"budget_duration": "1d",
"tpm_limit": 10000000,
"rpm_limit": 6000,
"allowed_models": null,
"expires_at": null,
"blocked": false,
"required_end_user_id": false,
"spend": 0,
"reserved_spend": 0,
"budget_started_at": null,
"resets_at": null,
"token": "ltg_sk_SYNTHETIC_EXAMPLE_NOT_A_VALID_CREDENTIAL",
"max_parallel_requests": 5,
"provisioning": "ready"
}
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "unauthorized",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "unauthorized",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "not_found",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "idempotency_conflict",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "precondition_failed",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "precondition_required",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "rate_limit_exceeded",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "enforcement_unavailable",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}Authorizations
Management-only Telnyx account credential.
Headers
24h, scoped by account+method+path. Same key/body returns same outcome; changed body 409; in-progress 409 with Retry-After. Token-create replay returns 200 metadata WITHOUT secret.
1 - 128^[A-Za-z0-9_-]+$Body
1 - 256^[^\u0000-\u001f\u007f]+$Optional maximum concurrent reserved/dispatched cache misses across replicas. Null means no concurrency cap. Cache hits do not consume slots; unknown usage retains its budget hold without a slot.
1 <= x <= 1000Omitted or null defaults to the maximum (1000 USD) (on a blocked key, null is kept until the key is unblocked); a value below the minimum (0.000001 USD) or above the maximum is rejected with 400 limit_out_of_range; a malformed value (negative, wrong type or precision) is 400 invalid_request. Block the key (blocked: true) to deny it; blocking is always accepted. The default budget is lifetime unless budget_duration is set. Budgets and spend are an enforcement guard computed at one flat placeholder rate for every Telnyx-hosted model (rate_version telnyx-reference-v1: 5 USD per million input and 15 USD per million output tokens), not the customer's bill; Telnyx Inference usage is billed separately at the model's actual price.
0.000001 <= x <= 1000Must be a multiple of 0.0000011d, 7d, 30d, null Omitted or null defaults to the maximum (10000000) (on a blocked key, null is kept until the key is unblocked); a value below the minimum (1) or above the maximum is rejected with 400 limit_out_of_range; a malformed value (negative, wrong type or precision) is 400 invalid_request. Block the key (blocked: true) to deny it; blocking is always accepted.
1 <= x <= 10000000Omitted or null defaults to the maximum (6000) (on a blocked key, null is kept until the key is unblocked); a value below the minimum (1) or above the maximum is rejected with 400 limit_out_of_range; a malformed value (negative, wrong type or precision) is 400 invalid_request. Block the key (blocked: true) to deny it; blocking is always accepted.
1 <= x <= 600010001 - 256^[^\u0000-\u001f\u007f]+$Require a nonempty caller-asserted end-user ID; not proof of identity.
Response
Idempotency replay: metadata only; lost create response requires revoke/new create.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.telnyx.com/v2/llm_token_gateway/token_keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "support-service",
"token_group_id": "11111111-1111-4111-8111-111111111111",
"max_parallel_requests": 5
}
'import requests
url = "https://api.telnyx.com/v2/llm_token_gateway/token_keys"
payload = {
"name": "support-service",
"token_group_id": "11111111-1111-4111-8111-111111111111",
"max_parallel_requests": 5
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'support-service',
token_group_id: '11111111-1111-4111-8111-111111111111',
max_parallel_requests: 5
})
};
fetch('https://api.telnyx.com/v2/llm_token_gateway/token_keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.telnyx.com/v2/llm_token_gateway/token_keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'support-service',
'token_group_id' => '11111111-1111-4111-8111-111111111111',
'max_parallel_requests' => 5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.telnyx.com/v2/llm_token_gateway/token_keys"
payload := strings.NewReader("{\n \"name\": \"support-service\",\n \"token_group_id\": \"11111111-1111-4111-8111-111111111111\",\n \"max_parallel_requests\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.telnyx.com/v2/llm_token_gateway/token_keys")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"support-service\",\n \"token_group_id\": \"11111111-1111-4111-8111-111111111111\",\n \"max_parallel_requests\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/llm_token_gateway/token_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"support-service\",\n \"token_group_id\": \"11111111-1111-4111-8111-111111111111\",\n \"max_parallel_requests\": 5\n}"
response = http.request(request)
puts response.read_body{
"data": {
"record_type": "token_key",
"id": "11111111-1111-4111-8111-111111111111",
"created_at": "2026-10-07T08:00:00Z",
"updated_at": "2026-10-07T08:00:00Z",
"version": 1,
"name": "support-backend",
"token_group_id": "11111111-1111-4111-8111-111111111111",
"token_user_id": null,
"max_budget": 1000,
"budget_duration": "1d",
"tpm_limit": 10000000,
"rpm_limit": 6000,
"allowed_models": null,
"expires_at": null,
"blocked": false,
"required_end_user_id": false,
"spend": 0,
"reserved_spend": 0,
"budget_started_at": null,
"resets_at": null,
"max_parallel_requests": 5,
"provisioning": "ready"
}
}{
"data": {
"record_type": "token_key",
"id": "11111111-1111-4111-8111-111111111111",
"created_at": "2026-10-07T08:00:00Z",
"updated_at": "2026-10-07T08:00:00Z",
"version": 1,
"name": "support-backend",
"token_group_id": "11111111-1111-4111-8111-111111111111",
"token_user_id": null,
"max_budget": 1000,
"budget_duration": "1d",
"tpm_limit": 10000000,
"rpm_limit": 6000,
"allowed_models": null,
"expires_at": null,
"blocked": false,
"required_end_user_id": false,
"spend": 0,
"reserved_spend": 0,
"budget_started_at": null,
"resets_at": null,
"token": "ltg_sk_SYNTHETIC_EXAMPLE_NOT_A_VALID_CREDENTIAL",
"max_parallel_requests": 5,
"provisioning": "ready"
}
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "unauthorized",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "unauthorized",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "not_found",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "idempotency_conflict",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "precondition_failed",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "precondition_required",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "rate_limit_exceeded",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "enforcement_unavailable",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}