> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenetlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API overview

> The Judge API wire protocol at judge.tenetlabs.com — REST + SSE, bearer auth, snake_case throughout.

**Base URL**: `https://judge.tenetlabs.com`. JSON in, JSON out — except the stream endpoint, which speaks Server-Sent Events.

Use the raw API when your harness isn't Python. If it is, the [SDK](https://docs.tenetlabs.com/sdk/tenet-client.md) already handles auth, retries, fail-closed semantics, and the request envelope — don't rebuild those.

## Auth

Every endpoint except `GET /health` requires a bearer token: an API key or an M2M token.

```bash theme={null}
Authorization: Bearer sk_tenet_...   # API key from platform.tenetlabs.com — /decide, /decide/stream
Authorization: Bearer <jwt>          # M2M token, audience https://sdk.tenetlabs.com — every endpoint
```

API keys work on the decide endpoints only. `GET /ready`, `/health/warm` and `GET /v1/config` require an M2M token. See [Authentication](https://docs.tenetlabs.com/authentication.md). A missing or invalid bearer returns `401` ([Errors](#errors)).

The SDK also stamps `X-Tenet-Api-Version: 0.4` on every `/decide` request (sync, async, streaming), declaring the send-side wire contract it speaks. The SDK sets it for you; raw integrations don't need it. [Read-intent & wire contract](https://docs.tenetlabs.com/concepts/read-intent.md).

## Endpoints

| Endpoint | Shape | Use when |
| - | - | - |
| `POST /decide` | Sync request → verdict | The default. Blocks until decided — a guard hit or an operational ask makes no model call; everything else waits on one judge call. |
| `POST /decide/stream` | SSE, verdict-first | A user-visible interaction blocks on the verdict. [Guide](https://docs.tenetlabs.com/guides/streaming.md). |
| `POST /voice/decide/stream` | SSE | Judging a voice-agent turn — transcript rails + acoustic detectors. Research preview. [Guide](https://docs.tenetlabs.com/guides/voice.md). |
| `GET /health` | Probe | Liveness. No auth. |
| `GET /ready`, `/health/warm` | Probes | Readiness — config loaded, the service can decide. Both require a bearer token: without one they return `401`, which may carry no [error envelope](#errors). |
| `GET /v1/config` | Non-secret config introspection | Debugging which surfaces, config version, and PII detection tier are live. `pii_tier.tier` is a string; `regex_only` means detection is degraded. Requires a bearer token. |

`/eeo/*` paths 308-redirect to their unprefixed equivalents (`/eeo/decide` → `/decide`, etc.) and the redirect preserves method and body across the hop. Use the unprefixed path directly.

Pick by how you consume the result: sync `/decide` by default; `/decide/stream` when a user-visible interaction should react to a block as early as possible. For backfills and audits, send each item to `/decide` from your own queue.

### Batch API (retired)

The file-based batch surface — `POST /files`, `POST /batches`, `GET /batches/{batch_id}`, `GET /files/{file_id}/content`, and their `/eeo/...` aliases — was retired in September 2026. For an authenticated caller, every one of those routes returns `410 Gone` in the [error envelope](#errors):

```json theme={null}
{
  "code": "batch_api_retired",
  "message": "The EEO batch API (/files, /batches) was retired in September 2026. Send each decision to POST /decide instead. ...",
  "docs_url": "...",
  "request_id": "req_..."
}
```

A request without a bearer token gets `401`, not `410`. **Migration:** send each item to `POST /decide`. Branch on the `410` status or `code`, not the message text.

## Request envelope

```json theme={null}
{
  "surface": "resume_triage",
  "messages": [{"role": "user", "content": "find recent grads"}],
  "context": {
    "recruiter_prompt": "find recent grads",
    "candidate_content": null
  },
  "phase": "tool_pre",
  "session_id": "conv-8841"
}
```

The fields that determine judgment quality:

* **`surface`** — what kind of recruiting action this is: `resume_triage` | `job_ad_drafting` | `candidate_ranking` | `interview_question_gen` | `candidate_outreach`. The judge reads it with the request to frame the ask, so pick it **per request** from the user's current intent — never hardwire one value for all traffic. The example above is a screening ask, hence `resume_triage`. Full guidance, per-surface examples, and the chat-product mapping: [Surfaces](https://docs.tenetlabs.com/concepts/surfaces.md).
* **`context.recruiter_prompt`** — the user's actual ask, verbatim. Required for full safety-pattern coverage.
* **`context.candidate_content`** — resume/candidate text, whenever the action involves one. Omitting it disables candidate-side protections.
* **`context.tool_input` / `context.tool_description`** — on a tool phase, the parameters you're about to call with and what the tool requires. The judge reads them as facts and evaluates them; `context.tool_name` alone doesn't move a verdict. [Tool context](https://docs.tenetlabs.com/concepts/tool-context.md).
* **`session_id`** — stable per conversation; groups multi-turn evaluations into one [verdict trace](https://docs.tenetlabs.com/concepts/traces.md).
* **`domains`** — optional per-call narrowing of the entitled domain set. Omit for full coverage. See [Multi-verdict responses](https://docs.tenetlabs.com/concepts/multi-verdict.md#per-call-domain-narrowing).
* **`intent`** — optional top-level caller-asserted classification: `read` | `action` | `unknown`. The service's highest-precedence intent signal, recorded on the decision trace; the current judge doesn't change verdicts on it. Omit (or send `unknown`/`null`) for no assertion. A caller `read` is authoritative only at `phase="tool_post"` and advisory at `agent_input` — see the [read-intent contract](https://docs.tenetlabs.com/concepts/read-intent.md).
* **`workflow`** — optional trace-only label naming which of your integrations made the call (`resume-screener`, `recruiter-agent`). Lowercase slug, ≤64 chars; never affects the verdict. [Verdict traces](https://docs.tenetlabs.com/concepts/traces.md).
* **`mode`** — `judge` (default) or `guardrails`. See [Guardrails mode](#guardrails-mode).

### Message content

`messages[*].content` is a string or a list of text parts. Parts of type `text`, `input_text`, or `output_text` are concatenated **with no separator** and judged as one string, so include your own whitespace between parts:

```json theme={null}
{"role": "user", "content": [
  {"type": "text", "text": "Draft a job ad for a "},
  {"type": "text", "text": "senior backend engineer in Austin."}
]}
```

Any other part type — image, audio, file, tool block — is rejected rather than skipped, because the judge reads text only:

```json theme={null}
// 422
{
  "code": "VALIDATION_ERROR",
  "message": "messages: Value error, messages[0].content[1]: content part type 'image_url' is not supported. ...",
  ...
}
```

With more than one `user` message, the **last** is the request under judgment; earlier user turns are read as conversation context, so a turn that was already judged isn't flagged again inside every later request. A follow-up that carries out or refers back to an earlier ask ("yes, do it") is still judged against it.

Put retrieved or tool-returned text in a `role: "tool"` message. The judge reads tool-role content as untrusted, so an instruction inside it is treated as a possible injection rather than as the user's request.

> [!NOTE]
>
> All fields are `snake_case` — `session_id`, not `sessionId`. A camelCased field is silently ignored, not rejected, so a typo drops the field without an error.

## Response shape

`POST /decide` returns one envelope. Five root fields are always present:

```json theme={null}
{
  "verdict": "exclude",
  "severity": "high",
  "latency_ms": 11,
  "decision_id": "0123456789abcdef0123456789abcdef",
  "findings": [ /* one entry per evaluated domain */ ]
}
```

`decision_id` is the decision's 32-hex correlation key — log it, and quote it when reporting a verdict ([Verdict traces](https://docs.tenetlabs.com/concepts/traces.md#the-correlation-key)). `route_reason` and `degraded` are added on `route_to_human` verdicts ([Route provenance](https://docs.tenetlabs.com/concepts/decisions.md#route-provenance)), `caveat` on `include_with_caveats`.

Per-domain detail — `verdict`, `severity`, `enforcement`, `rule_ids`, `risk_labels`, `evidence_span` — lives on each `findings[]` entry. A domain can appear on more than one finding (one `pii` finding per detected type), so the set of domains that ran is `{f["domain"] for f in findings}`.

Which domains enforce depends on your plan (see [Tier entitlements](https://docs.tenetlabs.com/concepts/multi-verdict.md#tier-entitlements)). PII detection runs on every request regardless of plan and lands as a `pii` finding. Disclosure and prompt injection collapse onto a single `safety` finding on the wire; per-sub-domain detail lives in that finding's `sub_findings` array. EEO is the always-present spine for plans that include it.

The top-level `verdict` carries the **merged most-restrictive** judgment across findings whose `enforcement` is `enforce` — an integration that branches only on `verdict` and `severity` is safe by construction. Read `findings[]` for per-domain audit logs and visibility into audit-only signals.

### PII redaction

PII detection runs before the EEO judge and the safety rails. Any detected PII span — except an age, which the judge needs to read — is redacted out of the request **before** any third-party LLM sees it (the judge, the risk screener, and every safety rail consume placeholder-substituted text). Text the service returns carries the placeholders (`<EMAIL_1>`, `<PERSON_1>`, …) and PII findings carry a masked preview; detected values are not returned. The placeholder → original map isn't returned, and the SDK doesn't rehydrate placeholders — map them back on your side if you render that text to users. [Full posture](https://docs.tenetlabs.com/concepts/multi-verdict.md#pii-redaction-posture).

Full rules — merge ordering, unknown-verdict normalization, the `safety` bundle, entitlement-driven bundles: [Multi-verdict responses](https://docs.tenetlabs.com/concepts/multi-verdict.md).

## Guardrails mode

Send `"mode": "guardrails"` when you want PII redaction and injection/exfil screening without an EEO judgment. The EEO judge doesn't run; the response carries the PII and `safety` findings plus `redacted` — your own `messages` and `context` with each detected PII value replaced by a typed placeholder:

```json theme={null}
// request
{
  "mode": "guardrails",
  "messages": [{"role": "user", "content": "Email the offer to jane.doe@example.com and call her at 512-555-0142."}]
}

// response
{
  "verdict": "include",
  "severity": "none",
  "latency_ms": 15,
  "decision_id": "fedcba9876543210fedcba9876543210",
  "findings": [
    {"domain": "pii", "rule_ids": ["pii:email_address"], "verdict": "include_with_caveats", "enforcement": "audit_only", "evidence_span": "j***@example.com", ...},
    {"domain": "pii", "rule_ids": ["pii:us_phone"], "verdict": "include_with_caveats", "enforcement": "audit_only", "evidence_span": "****0142", ...}
  ],
  "redacted": {
    "messages": [{"role": "user", "content": "Email the offer to <EMAIL_1> and call her at <PHONE_1>."}],
    "context": {}
  }
}
```

The top-level `verdict` reflects only the checks that ran — it is not a hiring judgment. Guardrails mode is `/decide` only: `/decide/stream` returns `400` for it.

## Errors

Errors share one envelope. Branch on `code` — except on a `401`, which can arrive without the envelope, so branch on the status there. Quote `request_id` (also sent as the `X-Tenet-Request-Id` header) when reporting a problem.

Each `docs_url` resolves to this table.

```json theme={null}
{
  "code": "VALIDATION_ERROR",
  "message": "`domains` must be omitted or a non-empty list",
  "docs_url": "...",
  "request_id": "req_0123456789abcdef0123456789abcdef"
}
```

| Status | `code` | Meaning |
| - | - | - |
| `400` | `BAD_REQUEST` | Malformed request — for example `mode: "guardrails"` on `/decide/stream` |
| `401` | `UNAUTHENTICATED` | Missing or invalid token. Some `401` responses carry no error envelope, so branch on the status code |
| `410` | `batch_api_retired` | [Retired batch route](#batch-api-retired) |
| `429` | `RATE_LIMITED` / `QUOTA_EXCEEDED` | Per-minute rate limit or the account's monthly limit reached. Wait the `Retry-After` header's seconds (also `retry_after` in the body) before retrying; don't retry in a tight loop. On `/decide/stream` the 429 arrives before any SSE event |
| `422` | `VALIDATION_ERROR` | An empty `domains` list, a malformed `workflow`, or a [non-text content part](#message-content); `message` names the problem |
| `503` | `SERVICE_UNAVAILABLE` | Service temporarily unavailable |

When the judge can't answer, your request doesn't 5xx — you get a normal `200` with `verdict: "route_to_human"`, `route_reason: "infra_degraded"`, and `degraded: true`. Treat that as "the judge declined to decide," not as an allow.

## Links

* [Authentication](https://docs.tenetlabs.com/authentication.md)
* [Surfaces — choosing `surface` per request](https://docs.tenetlabs.com/concepts/surfaces)
* [How the Judge decides — response vocabulary](https://docs.tenetlabs.com/concepts/decisions.md)
* [Streaming guide](https://docs.tenetlabs.com/guides/streaming.md)
* [SDKs: tenet-client](https://docs.tenetlabs.com/sdk/tenet-client.md) · [tenet-langchain](https://docs.tenetlabs.com/sdk/tenet-langchain.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.