Create a spend limit
Sets a limit for a product and period that has none. Send exactly one of amount and unlimited: true. The period’s spend is checked at once: if it is already above the new limit, the product is blocked immediately (evaluation.blocked_now). Returns 409 when a limit already exists for the product and period; update it instead.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const SpendLimit = await client.spendLimits.create();
console.log(SpendLimit.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
)
spend_limit = client.spend_limits.create()
print(spend_limit.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"),
)
spendLimit, err := client.SpendLimits.New(
context.TODO(),
telnyx.SpendLimitNewParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", spendLimit.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.spendLimits.SpendLimitCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
SpendLimitCreateParams params = SpendLimitCreateParams.builder()
.build();
var response = client.spendLimits().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
spend_limit = telnyx.spend_limits.create
puts(spend_limit)<?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 {
$spend_limit = $client->spendLimits->create();
var_dump($spend_limit);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx spend-limits create \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/spend_limits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product": "inference",
"period": "daily",
"amount": 100,
"reason": "Team budget"
}
'{
"data": {
"record_type": "spend_limit",
"product": "inference",
"product_name": "Inference",
"period": "daily",
"period_start": "2026-09-24",
"period_end": "2026-09-25",
"limit": {
"amount": "100",
"unlimited": false,
"origin": "self_service",
"updated_at": "2026-09-24T09:12:03.412Z"
},
"effective_limit_usd": "100",
"spend_usd": "37.41",
"spend_error": null,
"blocked": false,
"block": null,
"evaluation": {
"spend_usd": "37.41",
"released": false,
"blocked_now": false,
"still_over_limit": false,
"still_blocked_other_period": false,
"evaluation_deferred": false
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
- Amount
- Unlimited
Send exactly one of amount and unlimited: true.
Product to limit, as returned in product by the list operation.
"inference"
Limit in USD. 0 blocks at the first cent of spend.
x >= 0100
daily is the current UTC day; monthly is the current UTC calendar month.
daily, monthly "daily"
Optional; only false is allowed together with amount.
false false
Why the limit is set or changed, kept for audit.
500"Team budget"
Response
The limit was created. evaluation says whether the change blocked the product.
The spend limit, spend and block state of one product and period.
Show child attributes
Show child attributes
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const SpendLimit = await client.spendLimits.create();
console.log(SpendLimit.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
)
spend_limit = client.spend_limits.create()
print(spend_limit.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"),
)
spendLimit, err := client.SpendLimits.New(
context.TODO(),
telnyx.SpendLimitNewParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", spendLimit.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.spendLimits.SpendLimitCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
SpendLimitCreateParams params = SpendLimitCreateParams.builder()
.build();
var response = client.spendLimits().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
spend_limit = telnyx.spend_limits.create
puts(spend_limit)<?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 {
$spend_limit = $client->spendLimits->create();
var_dump($spend_limit);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx spend-limits create \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/spend_limits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product": "inference",
"period": "daily",
"amount": 100,
"reason": "Team budget"
}
'{
"data": {
"record_type": "spend_limit",
"product": "inference",
"product_name": "Inference",
"period": "daily",
"period_start": "2026-09-24",
"period_end": "2026-09-25",
"limit": {
"amount": "100",
"unlimited": false,
"origin": "self_service",
"updated_at": "2026-09-24T09:12:03.412Z"
},
"effective_limit_usd": "100",
"spend_usd": "37.41",
"spend_error": null,
"blocked": false,
"block": null,
"evaluation": {
"spend_usd": "37.41",
"released": false,
"blocked_now": false,
"still_over_limit": false,
"still_blocked_other_period": false,
"evaluation_deferred": false
}
}
}