Skip to main content
GET
/
guardrails
/
{guardrailId}
Get a specific guardrail
curl --request GET \
  --url https://api.portkey.ai/v1/guardrails/{guardrailId} \
  --header 'x-portkey-api-key: <api-key>'
import requests

url = "https://api.portkey.ai/v1/guardrails/{guardrailId}"

headers = {"x-portkey-api-key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'x-portkey-api-key': '<api-key>'}};

fetch('https://api.portkey.ai/v1/guardrails/{guardrailId}', 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.portkey.ai/v1/guardrails/{guardrailId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-portkey-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://api.portkey.ai/v1/guardrails/{guardrailId}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("x-portkey-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.get("https://api.portkey.ai/v1/guardrails/{guardrailId}")
.header("x-portkey-api-key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.portkey.ai/v1/guardrails/{guardrailId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-portkey-api-key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "name": "<string>",
  "slug": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "last_updated_at": "2023-11-07T05:31:56Z",
  "owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "organisation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "updated_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "checks": [
    {
      "parameters": {
        "jwksUri": "<string>",
        "headerKey": "<string>",
        "cacheMaxAge": 86400,
        "clockTolerance": 5,
        "maxTokenAge": "1d",
        "algorithms": [
          "RS256"
        ]
      },
      "name": "<string>",
      "is_enabled": true
    }
  ],
  "actions": {
    "deny": false,
    "async": false,
    "on_success": {
      "feedback": {
        "value": 5,
        "weight": 1,
        "metadata": ""
      }
    },
    "on_fail": {
      "feedback": {
        "value": -5,
        "weight": 1,
        "metadata": ""
      }
    }
  }
}
{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"type": "<string>"
}
}
{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"type": "<string>"
}
}

Authorizations

x-portkey-api-key
string
header
required

Path Parameters

guardrailId
string
required

Guardrail UUID or slug (with guard_ prefix)

Response

Guardrail details retrieved successfully

id
string
required

Unique identifier of the guardrail

name
string
required

Name of the guardrail

slug
string
required

URL-friendly slug

created_at
string<date-time>
required

Creation timestamp

last_updated_at
string<date-time>
required

Last update timestamp

owner_id
string<uuid>
required

UUID of the user who created the guardrail

organisation_id
string<uuid>

Organisation UUID

workspace_id
string<uuid> | null

Workspace UUID (null for organisation-level guardrails)

status
enum<string>

Current status of the guardrail

Available options:
active,
archived
updated_by
string<uuid> | null

UUID of the user who last updated the guardrail

checks
object[]

Array of configured guardrail checks

actions
object

Actions to take when guardrail checks fail or pass

Last modified on March 25, 2026