curl --request POST \
--url https://api.pyai.com/v1/sandbox/keys \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"referral_token": "<string>"
}
'import requests
url = "https://api.pyai.com/v1/sandbox/keys"
payload = {
"label": "<string>",
"referral_token": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({label: '<string>', referral_token: '<string>'})
};
fetch('https://api.pyai.com/v1/sandbox/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.pyai.com/v1/sandbox/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([
'label' => '<string>',
'referral_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.pyai.com/v1/sandbox/keys"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"referral_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.pyai.com/v1/sandbox/keys")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"referral_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/sandbox/keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"<string>\",\n \"referral_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"object": "sandbox.key",
"api_key": "<string>",
"environment": "test",
"expires_at": 123,
"base_url": "<string>",
"key_id": "<string>",
"org_id": "<string>",
"project_id": "<string>",
"scopes": [
"hear:transcribe",
"hear:stream",
"hear:configure",
"transcribe:jobs",
"speak:synthesize",
"omni:session",
"amd:detect",
"amd:configure",
"amd:read",
"cast:render",
"recap:configure",
"recap:read"
],
"docs": "<string>",
"note": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}Mint a sandbox key (no auth)
Create a free, instant pyai_test_ sandbox key with no human steps, no email, no password, no card. Built for AI coding agents (Cursor, Lovable, Claude Code, Codex) and the PyAI MCP server’s create_sandbox_key tool, so agent-generated code runs on its first execution instead of stalling at a credential wall. The key is a normal sandbox key: it skips the credit gate (never returns 402), includes Hear/Speak/Omni/AMD/Recap starter scopes, enables Recap on the new org, expires automatically, and is bounded by a daily usage cap. Public and unauthenticated; rate-limited per source network. Treat the returned key as an opaque secret (read it from an env var). For production, create a live key in the console. May be disabled on some deployments (returns 404).
curl --request POST \
--url https://api.pyai.com/v1/sandbox/keys \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"referral_token": "<string>"
}
'import requests
url = "https://api.pyai.com/v1/sandbox/keys"
payload = {
"label": "<string>",
"referral_token": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({label: '<string>', referral_token: '<string>'})
};
fetch('https://api.pyai.com/v1/sandbox/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.pyai.com/v1/sandbox/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([
'label' => '<string>',
'referral_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.pyai.com/v1/sandbox/keys"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"referral_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.pyai.com/v1/sandbox/keys")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"referral_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/sandbox/keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"<string>\",\n \"referral_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"object": "sandbox.key",
"api_key": "<string>",
"environment": "test",
"expires_at": 123,
"base_url": "<string>",
"key_id": "<string>",
"org_id": "<string>",
"project_id": "<string>",
"scopes": [
"hear:transcribe",
"hear:stream",
"hear:configure",
"transcribe:jobs",
"speak:synthesize",
"omni:session",
"amd:detect",
"amd:configure",
"amd:read",
"cast:render",
"recap:configure",
"recap:read"
],
"docs": "<string>",
"note": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}Body
Response
A freshly minted sandbox key.
sandbox.key The plaintext pyai_test_... secret. Shown once, store it in an env var.
test Key expiry, Unix epoch milliseconds.
REST base URL to use with this key.
Starter scopes: Hear, Speak, Omni, AMD, Recap, and Cast.
[
"hear:transcribe",
"hear:stream",
"hear:configure",
"transcribe:jobs",
"speak:synthesize",
"omni:session",
"amd:detect",
"amd:configure",
"amd:read",
"cast:render",
"recap:configure",
"recap:read"
]