Quickstart

Send your first masked prompt through the Privian gateway.

1. Get an API key

Sign in and create a gateway key from the dashboard. Keys are prefixedsk-gw_live_ (production) or sk-gw_test_ (non-production) and shown only once at creation time. Privian stores only the SHA-256 hash.

2. The endpoint

All requests target a single endpoint:

text
POST https://api.privian.io/v1/gateway

3. Send a request

bash
curl -sS -X POST https://api.privian.io/v1/gateway \
  -H "Authorization: Bearer $PRIVIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Email john@acme.com about Friday.",
    "model": "openai/gpt-5.5"
  }'

4. TypeScript

ts
const res = await fetch("https://api.privian.io/v1/gateway", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.PRIVIAN_API_KEY!}`,
  },
  body: JSON.stringify({
    prompt: "Email john@acme.com about Friday.",
    model: "openai/gpt-5.5",
  }),
});

const requestId = res.headers.get("x-request-id");
if (!res.ok) {
  const { error } = await res.json();
  throw new Error(`gateway ${error.code} (req=${requestId})`);
}
const { response, meta } = await res.json();
console.log(response, meta.entitiesDetected);

5. Python

python
import os, requests

r = requests.post(
    "https://api.privian.io/v1/gateway",
    headers={"Authorization": f"Bearer {os.environ['PRIVIAN_API_KEY']}"},
    json={"prompt": "Email john@acme.com about Friday.",
          "model": "openai/gpt-5.5"},
    timeout=30,
)
r.raise_for_status()
print(r.json()["response"])

What happened

  • Privian detected john@acme.com, replaced it with EMAIL_1 before any provider call.
  • The provider received the masked prompt only.
  • Privian rehydrated EMAIL_1 back to john@acme.com in the returned text.

Next