curl --request POST \
--url https://api.limitguard.ai/v1/keys/upgrade/{tier} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.limitguard.ai/v1/keys/upgrade/{tier}"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.limitguard.ai/v1/keys/upgrade/{tier}', 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.limitguard.ai/v1/keys/upgrade/{tier}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-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"
"net/http"
"io"
)
func main() {
url := "https://api.limitguard.ai/v1/keys/upgrade/{tier}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
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.limitguard.ai/v1/keys/upgrade/{tier}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.limitguard.ai/v1/keys/upgrade/{tier}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"key_id": "<string>",
"previous_tier": "<string>",
"new_tier": "<string>",
"monthly_limit": 123,
"payment_amount_usdc": 123,
"credited_usd": 123,
"balance_usd": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Upgrade Key
Buy prepaid balance via x402 USDC payment (#434).
The x402 price is credited 1:1 to the key’s prepaid balance and the tier label is set to the higher of the current and purchased tier (the label selects burst limits in rate_limit.py; it never downgrades). Repeat purchases are allowed. Each priced call is then debited at the price in the pricing table.
The x402 middleware handles payment verification before this handler runs. Send X-API-Key header to identify which key to credit.
Ladder prices: indie 29,starter99, growth 299,pro999.
curl --request POST \
--url https://api.limitguard.ai/v1/keys/upgrade/{tier} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.limitguard.ai/v1/keys/upgrade/{tier}"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.limitguard.ai/v1/keys/upgrade/{tier}', 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.limitguard.ai/v1/keys/upgrade/{tier}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-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"
"net/http"
"io"
)
func main() {
url := "https://api.limitguard.ai/v1/keys/upgrade/{tier}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
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.limitguard.ai/v1/keys/upgrade/{tier}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.limitguard.ai/v1/keys/upgrade/{tier}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"key_id": "<string>",
"previous_tier": "<string>",
"new_tier": "<string>",
"monthly_limit": 123,
"payment_amount_usdc": 123,
"credited_usd": 123,
"balance_usd": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Path Parameters
Response
Successful Response
Response after buying prepaid balance via x402 on POST /v1/keys/upgrade/{tier}.
Key identifier (SHA-256 hash prefix)
Tier label before this purchase
Tier label after this purchase (never lower than before)
Monthly request ceiling for the tier label (an abuse cap, not prepaid calls)
Amount paid in USDC
USD credited to the prepaid balance by this payment (1:1)
Prepaid balance after this credit