Criar uma chave de workspace com nome
Gera uma chave ps_workspace_ COM NOME (nunca a principal), devolvida só nesta resposta. Proprietário ou Admin (apikeys:rotate). A chave fica registrada como criada pelo usuário da chave de conta e é revogada se ele sair do workspace. Até 50 chaves de workspace ativas (não revogadas) por workspace, contando a principal (409 WORKSPACE_KEY_LIMIT_REACHED, com limit).
Requer uma chave de conta (ps_account_, criada em Perfil → API). Chaves de workspace, de número e tokens OAuth/MCP recebem 403 ACCOUNT_KEY_REQUIRED. Enviado com 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
}Autorizações
Sua chave de API ps_
Parâmetros de caminho
Id do workspace, obtido em GET /v1/workspaces.
Corpo
De 1 a 60 caracteres, sem os espaços das pontas. Diz qual integração usa a chave.
"Bakery Downtown"
Resposta
Criada — apiKey.key volta só esta vez
Esta página foi útil?
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
}