Prompt Leak Detection

The Prompt Leak Detection API lets organization admins score user-submitted text against a system prompt. A high token overlap between the user text and the system prompt may indicate that the user is trying to extract or reproduce the system instructions.

Authentication and authorization

Prompt leak endpoints require a Clerk JWT or a valid organization access token. Only organization owners and admins can create checks or list historical checks.

Base URL

Endpoints

Scoring algorithm

The scorer tokenizes both the user text and the system prompt, then computes the fraction of user tokens that also appear in the system prompt. The result is a score between 0.0 and 1.0. A configurable threshold (default 0.3) turns the score into a boolean flagged signal.

Create a check

Request body

Response

List historical checks

Response

Query parameters

Request/response fields

Error codes