Claves de API
Regenerar clave de API
Rota LA API key del alcance que llama: el producto mantiene UNA clave por alcance, no varias. La clave anterior deja de funcionar y la nueva (campo key) se devuelve SOLO UNA VEZ, con status 201.
- Una clave de número rota la clave predeterminada de ese número (
ps_number_). - Una clave de workspace (la principal o una con nombre, incluso cuando se acota con
x-whatsapp-number-id) rota la clave principal del workspace (ps_workspace_); las claves con nombre siguen funcionando. - Una clave de cuenta con
x-workspace-idrota la clave principal de ese workspace; el usuario debe ser el OWNER (apikeys:reveal). - Un token OAuth/MCP consentido para todo el workspace también rota la clave principal, solo mientras el usuario sea el OWNER en vivo (
403 OAUTH_SECRET_REQUIRES_OWNER), registrado primero en un log de auditoría (500 OAUTH_SECRET_AUDIT_UNAVAILABLEsi no se puede escribir el registro). - Un token consentido para números específicos, o una clave de cuenta de un miembro restringido a algunos números, recibe
403 NUMBERS_GRANT_NOT_ALLOWED.
POST
/
v1
/
api-keys
/
regenerate
Regenerar API key
curl --request POST \
--url https://pilotstatus.com.br/v1/api-keys/regenerate \
--header 'x-api-key: <api-key>'import requests
url = "https://pilotstatus.com.br/v1/api-keys/regenerate"
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://pilotstatus.com.br/v1/api-keys/regenerate', 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/api-keys/regenerate",
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://pilotstatus.com.br/v1/api-keys/regenerate"
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://pilotstatus.com.br/v1/api-keys/regenerate")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/api-keys/regenerate")
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{
"id": "key_03HZX...",
"name": "Default",
"key": "ps_THIS_IS_SHOWN_ONLY_ONCE",
"keyPrefix": "ps_abcd",
"keyLast4": "wxyz",
"scope": "number",
"whatsappNumberId": "num_01HZX...",
"createdAt": "2026-06-28T10:00:00.000Z"
}{
"error": "No WhatsApp number is associated with this API key"
}{
"error": "Unauthorized"
}¿Esta página le ayudó?
⌘I
Regenerar API key
curl --request POST \
--url https://pilotstatus.com.br/v1/api-keys/regenerate \
--header 'x-api-key: <api-key>'import requests
url = "https://pilotstatus.com.br/v1/api-keys/regenerate"
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://pilotstatus.com.br/v1/api-keys/regenerate', 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/api-keys/regenerate",
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://pilotstatus.com.br/v1/api-keys/regenerate"
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://pilotstatus.com.br/v1/api-keys/regenerate")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/api-keys/regenerate")
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{
"id": "key_03HZX...",
"name": "Default",
"key": "ps_THIS_IS_SHOWN_ONLY_ONCE",
"keyPrefix": "ps_abcd",
"keyLast4": "wxyz",
"scope": "number",
"whatsappNumberId": "num_01HZX...",
"createdAt": "2026-06-28T10:00:00.000Z"
}{
"error": "No WhatsApp number is associated with this API key"
}{
"error": "Unauthorized"
}