curl --request POST \
--url https://api.portkey.ai/v1/guardrails \
--header 'Content-Type: application/json' \
--header 'x-portkey-api-key: <api-key>' \
--data '
{
"name": "JWT Authentication Guard",
"organisation_id": "550e8400-e29b-41d4-a716-446655440001",
"checks": [
{
"id": "default.jwt",
"parameters": {
"jwksUri": "https://example.com/.well-known/jwks.json",
"headerKey": "Authorization",
"algorithms": [
"RS256"
],
"cacheMaxAge": 86400,
"clockTolerance": 5,
"maxTokenAge": "1d"
}
}
],
"actions": {
"onFail": "block",
"message": "Invalid JWT token"
}
}
'{
"id": "<string>",
"slug": "<string>",
"version_id": "<string>"
}Creates a new guardrail with specified checks and actions
curl --request POST \
--url https://api.portkey.ai/v1/guardrails \
--header 'Content-Type: application/json' \
--header 'x-portkey-api-key: <api-key>' \
--data '
{
"name": "JWT Authentication Guard",
"organisation_id": "550e8400-e29b-41d4-a716-446655440001",
"checks": [
{
"id": "default.jwt",
"parameters": {
"jwksUri": "https://example.com/.well-known/jwks.json",
"headerKey": "Authorization",
"algorithms": [
"RS256"
],
"cacheMaxAge": 86400,
"clockTolerance": 5,
"maxTokenAge": "1d"
}
}
],
"actions": {
"onFail": "block",
"message": "Invalid JWT token"
}
}
'{
"id": "<string>",
"slug": "<string>",
"version_id": "<string>"
}Name of the guardrail
"Content Safety Check"
Array of guardrail checks to apply
1Show child attributes
Identifier of the guardrail check type
default.jwt, default.modelWhitelist, default.isAllLowerCase, default.regexMatch, default.sentenceCount, default.wordCount, default.characterCount, default.jsonSchema, default.jsonKeys, default.contains, default.validUrls, default.containsCode, default.webhook, default.endsWith, default.alluppercase, default.requiredMetadataKeys, portkey.moderateContent, portkey.language, portkey.pii, portkey.gibberish, sydelabs.sydeguard, aporia.validateProject, pillar.scanPrompt, pillar.scanResponse, patronus.phi, patronus.pii, patronus.isConcise, patronus.isHelpful, patronus.isPolite, patronus.noApologies, patronus.noGenderBias, patronus.noRacialBias, patronus.retrievalAnswerRelevance, patronus.toxicity, patronus.custom, mistral.moderateContent, pangea.textGuard, pangea.pii, bedrock.guard, promptfoo.guard, promptfoo.pii, promptfoo.harm, acuvity.scan, lasso.classify, azure.contentSafety, azure.pii, panw-prisma-airs.intercept Configuration parameters specific to the check type
Show child attributes
JWKS URI of the JWT token
Header key to check for the JWT token
Cache max age in seconds
Clock tolerance in seconds
Max token age
Algorithms to check for the JWT token
Custom name for this specific check instance
Whether this check is enabled
Actions to take when guardrail checks fail or pass
Show child attributes
Whether to deny the request when guardrail check fails
Whether the guardrail check should be performed asynchronously
Actions to take when guardrail check passes
Show child attributes
Feedback configuration for successful checks
Actions to take when guardrail check fails
Show child attributes
Feedback configuration for failed checks
Workspace UUID (required if organisation_id not provided and not using API key)
Organisation UUID (required if workspace_id not provided and not using API key)
Was this page helpful?