canonical: https://jentic.com/apis/lakera.ai/lakera

# Lakera API

The Lakera API screens prompts and model output for security threats such as prompt injection, unsafe content, and data leakage, exposing guard and policy operations over a REST interface. It lets you send content to be screened, retrieve the detailed detection results, and validate a security policy configuration. Requests carry a bearer token and return structured JSON your application can act on before passing text to a model.

## For AI agents

Screen prompts and model output for prompt injection and unsafe content, read detailed detection results, and validate policy configuration with Lakera. Covers 4 endpoints across guard and policy operations.

## Scope

Does not host or run language models itself. Use for screening prompts and content against security policies only.

## Capabilities

- Screen a prompt or model output for threats through the guard operation
- Retrieve the detailed detection results for screened content
- Check whether a security policy configuration is healthy
- Validate a policy configuration before applying it

## Use cases

### AI Guardrail via Jentic

An AI agent can screen its own inputs and outputs through Lakera without a developer wiring the API by hand. Through Jentic the agent searches for the guard operation by intent, receives the Lakera endpoint and its input schema, and calls it with the bearer token injected at execution time. This lets a team add a screening step to an agent pipeline that runs directly against Lakera.

Example prompt: Search Jentic for 'screen content for threats', load the operation schema, and call POST `/v2/guard` on each prompt before it reaches the model

### Prompt Injection Screening

Applications that pass user text to a language model need to catch prompt injection before it reaches the model. The Lakera API screens each message and flags injection attempts, so a gateway can block or sanitize the request. This keeps untrusted input from steering the model off its intended task.

Example prompt: Call POST `/v2/guard` with the incoming prompt and reject the request when the response flags an injection

### Policy Configuration Validation

Security teams that manage screening policies need to confirm a configuration is valid before it goes live. The Lakera API lints a policy and reports its health, so a CI step can catch a broken configuration before deployment. This prevents a misconfigured policy from silently letting unsafe content through.

Example prompt: Call POST `/v2/policies/lint` on the candidate policy and POST `/v2/policies/health` to confirm it is valid before rollout

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/v2/guard` | Screen content for threats |
| POST | `/v2/guard/results` | Get detailed detection results |
| POST | `/v2/policies/health` | Check policy configuration health |
| POST | `/v2/policies/lint` | Validate policy configuration |

## Key resources

- **Guard** — Screen content for threats and read detection results
- **Policies** — Check policy health and validate policy configuration

## Why Jentic

- **Setup:** Wiring the Lakera API by hand means setting the bearer token on every request and calling the guard and policy endpoints with the right request bodies yourself. Through Jentic you install once, import Lakera from the API Directory, store the token once, and your agent calls it.
- **Permission scoping:** Lakera exposes four operations and no resource ids in the path, so scoping is by operation: you can allow content screening while withholding policy management. You choose which operations the agent may call, so a screening-only agent never touches policy configuration.
- **Credential handling:** Your Lakera token is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'screen content for threats' or 'validate a policy', and Jentic returns the matching Lakera operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **OpenAI** — Language models whose inputs and outputs Lakera screens
- **Anthropic** — Language models whose inputs and outputs Lakera screens
- **Hugging Face** — Open models including content-moderation and safety classifiers

## FAQ

### What authentication does the Lakera API use?

The Lakera API authenticates with a bearer token in the Authorization header, as declared in its OpenAPI spec. Through Jentic the token is stored encrypted by your own Jentic One instance and injected at execution time, so it never enters the agent's prompt, logs, or context.

### Can I screen prompts for injection with the Lakera API?

Yes. Call POST `/v2/guard` with the incoming prompt or model output, and the response flags threats such as prompt injection and unsafe content. Call POST `/v2/guard/results` when you need the detailed detection breakdown for a screened message.

### What are the rate limits for the Lakera API?

The OpenAPI spec does not specify rate limits. Check the Lakera API documentation at https://docs.lakera.ai for current limits before screening high volumes of traffic.

### How do I add Lakera screening to my agent through Jentic?

Search Jentic for 'screen content for threats', which resolves to the POST `/v2/guard` operation, and Jentic returns its input schema so your agent can call it on each prompt. Credentials are injected at call time from your own instance. To run it on your own infrastructure, install Jentic One from its GitHub repo.

### Can I restrict what my agent is allowed to do with the Lakera API?

Yes. Lakera exposes four operations with no resource ids in the path, so you scope by operation: allow content screening such as POST `/v2/guard` while withholding policy management like POST `/v2/policies/lint`, and every call the agent makes is logged by your own instance. You add operations to the allowed set only when you decide to.

### Is there a Lakera MCP server?

You don't need an MCP server to give your agent Lakera. Jentic connects it directly from the API Directory: import Lakera, store your token once, and your agent calls the guard and policy operations on demand without loading another server's tool definitions into its context.
