For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Lakera DashboardBook a Demo
HomeOverviewGuidesAPI ReferenceChangelogSupport
HomeOverviewGuidesAPI ReferenceChangelogSupport
  • Overview
    • API Overview
    • Guard
    • Guard Results
    • Kubernetes Probes
  • Lakera API
  • Platform API
      • POSTCreate policy
      • GETGet policy
      • PUTUpdate policy
      • DELDelete policy
LogoLogo
Lakera DashboardBook a Demo
Platform APIPolicies

Create policy

POST
https://platform.lakera.ai/api/v1-beta/policies
POST
/api/v1-beta/policies
$curl -X POST https://platform.lakera.ai/api/v1-beta/policies \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "name": "string",
> "policy_mode": "IO",
> "input_detectors": [
> {
> "type": "prompt_attack",
> "threshold": "l1_confident"
> }
> ],
> "output_detectors": [
> {
> "type": "prompt_attack",
> "threshold": "l1_confident"
> }
> ]
>}'
200Successful
1{
2 "status": "ok",
3 "message": "string",
4 "id": "string",
5 "data": {
6 "name": "string",
7 "policy_mode": "IO",
8 "input_detectors": [
9 {
10 "type": "prompt_attack",
11 "threshold": "l1_confident",
12 "allowed_domains": [
13 "my-trusted-domain.com",
14 "another-safe-domain.com"
15 ]
16 }
17 ],
18 "output_detectors": [
19 {
20 "type": "prompt_attack",
21 "threshold": "l1_confident",
22 "allowed_domains": [
23 "my-trusted-domain.com",
24 "another-safe-domain.com"
25 ]
26 }
27 ]
28 }
29}
Create a new policy configuration
Was this page helpful?
Previous

Get policy

Next
Built with

Authentication

AuthorizationBearer

Bearer authentication using API key. Generate an API key from the Lakera platform. Example: Bearer sk_123…

Request

This endpoint expects an object.
namestringRequired
A descriptive name for the policy
policy_modeenumRequired
Set to "IO" for screening model inputs and outputs
Allowed values:
input_detectorslist of objectsRequired
List of detector configurations to apply to LLM inputs
output_detectorslist of objectsRequired
List of detector configurations to apply to LLM outputs

Response

Policy created successfully
statusenum
Response status
Allowed values:
messagestring

Human-readable response message

idstring
Policy ID
dataobject
Policy details