Crear una clave con nombre del espacio de trabajo
Genera una clave ps_workspace_ CON NOMBRE (nunca la principal), que se devuelve solo en esta respuesta. Owner o Admin (apikeys:rotate). La clave queda registrada como creada por el usuario de la clave de cuenta: quitar a ese usuario del workspace se detiene con 409 MEMBER_HAS_API_KEYS hasta que el OWNER decida revocarla o conservarla. Un cuerpo que no es un objeto JSON se lee como vacío (400 NAME_REQUIRED). Hasta 50 claves de workspace vigentes (no revocadas) por workspace, incluida la principal (409 WORKSPACE_KEY_LIMIT_REACHED, con limit).
Requiere una clave de cuenta (ps_account_, creada en Perfil → API). Las claves de workspace, las claves de número y los tokens OAuth/MCP reciben 403 ACCOUNT_KEY_REQUIRED. Se envía con Cache-Control: no-store.
curl --request POST \
--url https://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-keys \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Bakery Downtown"
}
'import requests
url = "https://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-keys"
payload = { "name": "Bakery Downtown" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Bakery Downtown'})
};
fetch('https://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-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://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-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' => 'Bakery Downtown'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-keys"
payload := strings.NewReader("{\n \"name\": \"Bakery Downtown\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-keys")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Bakery Downtown\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Bakery Downtown\"\n}"
response = http.request(request)
puts response.read_body{
"apiKey": {
"id": "cmh2ab7770004ak8example9m",
"name": "Billing integration",
"key": "ps_workspace_4e8b0d2f6a1c3e5b7d9f0a2c4e6b8d0f1a3c5e7b9d0fa1c0",
"prefix": "ps_workspace_",
"last4": "a1c0",
"isPrimary": false,
"createdAt": "2026-10-28T09:15:00.000Z"
}
}{
"error": "The name is required | O nome é obrigatório",
"code": "NAME_REQUIRED"
}{
"error": "Invalid API key"
}{
"error": "This endpoint requires an account API key (ps_account_…), created in Profile → API. Workspace keys, number keys and OAuth tokens cannot use it | Este endpoint exige uma API key de conta (ps_account_…), criada em Perfil → API. Chaves de workspace, de número e tokens OAuth não podem usá-lo",
"code": "ACCOUNT_KEY_REQUIRED"
}{
"error": "This workspace already has 50 API keys, which is the limit | Este workspace já tem 50 API keys, que é o limite",
"code": "WORKSPACE_KEY_LIMIT_REACHED",
"limit": 50
}Cuerpo
Respuesta
Creado: apiKey.key se devuelve solo esta vez
¿Esta página le ayudó?
curl --request POST \
--url https://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-keys \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Bakery Downtown"
}
'import requests
url = "https://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-keys"
payload = { "name": "Bakery Downtown" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Bakery Downtown'})
};
fetch('https://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-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://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-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' => 'Bakery Downtown'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-keys"
payload := strings.NewReader("{\n \"name\": \"Bakery Downtown\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-keys")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Bakery Downtown\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/workspaces/{workspaceId}/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Bakery Downtown\"\n}"
response = http.request(request)
puts response.read_body{
"apiKey": {
"id": "cmh2ab7770004ak8example9m",
"name": "Billing integration",
"key": "ps_workspace_4e8b0d2f6a1c3e5b7d9f0a2c4e6b8d0f1a3c5e7b9d0fa1c0",
"prefix": "ps_workspace_",
"last4": "a1c0",
"isPrimary": false,
"createdAt": "2026-10-28T09:15:00.000Z"
}
}{
"error": "The name is required | O nome é obrigatório",
"code": "NAME_REQUIRED"
}{
"error": "Invalid API key"
}{
"error": "This endpoint requires an account API key (ps_account_…), created in Profile → API. Workspace keys, number keys and OAuth tokens cannot use it | Este endpoint exige uma API key de conta (ps_account_…), criada em Perfil → API. Chaves de workspace, de número e tokens OAuth não podem usá-lo",
"code": "ACCOUNT_KEY_REQUIRED"
}{
"error": "This workspace already has 50 API keys, which is the limit | Este workspace já tem 50 API keys, que é o limite",
"code": "WORKSPACE_KEY_LIMIT_REACHED",
"limit": 50
}