cURL
curl -sS -X POST "https://phosra-api-sandbox-production.up.railway.app/api/v1/developers/orgs/org_01HXV2K8Z3QJ5N6P7R8S9T0U1V/keys/key_01HXV3M9A4RK6P7Q8S9T0U1V2W/regenerate" \
-H "Authorization: Bearer $PHOSRA_SESSION_TOKEN"const BASE = "https://phosra-api-sandbox-production.up.railway.app/api/v1";
const res = await fetch(`${BASE}/developers/orgs/org_01HXV2K8Z3QJ5N6P7R8S9T0U1V/keys/key_01HXV3M9A4RK6P7Q8S9T0U1V2W/regenerate`, {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.PHOSRA_SESSION_TOKEN}`,
},
});
console.log(res.status, await res.json());
import os, requests
BASE = "https://phosra-api-sandbox-production.up.railway.app/api/v1"
res = requests.post(
f"{BASE}/developers/orgs/org_01HXV2K8Z3QJ5N6P7R8S9T0U1V/keys/key_01HXV3M9A4RK6P7Q8S9T0U1V2W/regenerate",
headers={"Authorization": f"Bearer {os.environ['PHOSRA_SESSION_TOKEN']}"},
)
print(res.status_code, res.json())
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
base := "https://phosra-api-sandbox-production.up.railway.app/api/v1"
req, _ := http.NewRequest("POST", base+"/developers/orgs/org_01HXV2K8Z3QJ5N6P7R8S9T0U1V/keys/key_01HXV3M9A4RK6P7Q8S9T0U1V2W/regenerate", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("PHOSRA_SESSION_TOKEN"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(resp.Status, string(out))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://phosra-api-sandbox-production.up.railway.app/api/v1/developers/orgs/{orgId}/keys/{keyId}/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 => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://phosra-api-sandbox-production.up.railway.app/api/v1/developers/orgs/{orgId}/keys/{keyId}/regenerate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://phosra-api-sandbox-production.up.railway.app/api/v1/developers/orgs/{orgId}/keys/{keyId}/regenerate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "33211807-5a8c-46db-ab7e-96bfa0a4a0b5",
"org_id": "ef35953a-44f5-473a-a86f-1341163fa40e",
"name": "docs-dx24-regen",
"key_prefix": "phosra_test_f3e67094",
"environment": "test",
"scopes": [
"read:children",
"read:policies"
],
"created_by": "06c5090f-ea5b-4841-a611-e8c9d67df0c5",
"created_at": "2026-07-06T09:24:17.407347592Z",
"key": "phosra_test_f3e6709484d961a872f06e459a77e668d946f4317a3f1a26b276788e589b6bd9"
}{
"error": "Bad Request",
"message": "invalid org ID",
"code": 400
}{
"error": "Unauthorized",
"message": "missing authorization header",
"code": 401
}{
"error": "Forbidden",
"message": "insufficient role for this action",
"code": 403
}{
"error": "Not Found",
"message": "API key not found",
"code": 404
}{
"error": "Too Many Requests",
"message": "rate limit exceeded",
"code": 429
}{
"error": "Internal Server Error",
"message": "internal error",
"code": 500
}API Keys
Regenerate API key
Issues a new secret for the given key, invalidating the previous secret. The raw secret (key) is returned only in this response.
POST
/
developers
/
orgs
/
{orgId}
/
keys
/
{keyId}
/
regenerate
cURL
curl -sS -X POST "https://phosra-api-sandbox-production.up.railway.app/api/v1/developers/orgs/org_01HXV2K8Z3QJ5N6P7R8S9T0U1V/keys/key_01HXV3M9A4RK6P7Q8S9T0U1V2W/regenerate" \
-H "Authorization: Bearer $PHOSRA_SESSION_TOKEN"const BASE = "https://phosra-api-sandbox-production.up.railway.app/api/v1";
const res = await fetch(`${BASE}/developers/orgs/org_01HXV2K8Z3QJ5N6P7R8S9T0U1V/keys/key_01HXV3M9A4RK6P7Q8S9T0U1V2W/regenerate`, {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.PHOSRA_SESSION_TOKEN}`,
},
});
console.log(res.status, await res.json());
import os, requests
BASE = "https://phosra-api-sandbox-production.up.railway.app/api/v1"
res = requests.post(
f"{BASE}/developers/orgs/org_01HXV2K8Z3QJ5N6P7R8S9T0U1V/keys/key_01HXV3M9A4RK6P7Q8S9T0U1V2W/regenerate",
headers={"Authorization": f"Bearer {os.environ['PHOSRA_SESSION_TOKEN']}"},
)
print(res.status_code, res.json())
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
base := "https://phosra-api-sandbox-production.up.railway.app/api/v1"
req, _ := http.NewRequest("POST", base+"/developers/orgs/org_01HXV2K8Z3QJ5N6P7R8S9T0U1V/keys/key_01HXV3M9A4RK6P7Q8S9T0U1V2W/regenerate", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("PHOSRA_SESSION_TOKEN"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(resp.Status, string(out))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://phosra-api-sandbox-production.up.railway.app/api/v1/developers/orgs/{orgId}/keys/{keyId}/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 => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://phosra-api-sandbox-production.up.railway.app/api/v1/developers/orgs/{orgId}/keys/{keyId}/regenerate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://phosra-api-sandbox-production.up.railway.app/api/v1/developers/orgs/{orgId}/keys/{keyId}/regenerate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "33211807-5a8c-46db-ab7e-96bfa0a4a0b5",
"org_id": "ef35953a-44f5-473a-a86f-1341163fa40e",
"name": "docs-dx24-regen",
"key_prefix": "phosra_test_f3e67094",
"environment": "test",
"scopes": [
"read:children",
"read:policies"
],
"created_by": "06c5090f-ea5b-4841-a611-e8c9d67df0c5",
"created_at": "2026-07-06T09:24:17.407347592Z",
"key": "phosra_test_f3e6709484d961a872f06e459a77e668d946f4317a3f1a26b276788e589b6bd9"
}{
"error": "Bad Request",
"message": "invalid org ID",
"code": 400
}{
"error": "Unauthorized",
"message": "missing authorization header",
"code": 401
}{
"error": "Forbidden",
"message": "insufficient role for this action",
"code": 403
}{
"error": "Not Found",
"message": "API key not found",
"code": 404
}{
"error": "Too Many Requests",
"message": "rate limit exceeded",
"code": 429
}{
"error": "Internal Server Error",
"message": "internal error",
"code": 500
}Authorizations
Path Parameters
Response
Key regenerated. The new raw secret (key) is returned only in this response and the previous secret stops working immediately. key_prefix changes to match the new secret. (Body captured verbatim from the live sandbox.)
An API key. The secret is returned only once at create/regenerate (see DeveloperApiKeyWithSecret).