Quickstart
Make your first Cloak API call in a minute.
1. Get an API key (optional)
Cloak has a keyless free tier — you can call the API with no key at all. A key simply raises your daily limits (see Authentication).
To create one, open the developer dashboard, sign in, and click Create key. The key is shown once — copy it somewhere safe; you won't see it again.
No key? No problem.
Every example below works without the Authorization header. Drop it to use
the free per-IP tier while you're trying things out.
2. Detect PII in a PDF
/v1/detect takes a PDF as multipart/form-data (form field file) and returns
per-page preview images plus a list of detected regions. Matched text is
deliberately not returned, so the response is not itself a PII surface.
curl -X POST https://beforemay-redact.fly.dev/v1/detect \
-H "Authorization: Bearer $CLOAK_API_KEY" \
-F "file=@statement.pdf"const form = new FormData();
form.append("file", file); // a File/Blob — e.g. from an <input type="file">
const res = await fetch("https://beforemay-redact.fly.dev/v1/detect", {
method: "POST",
headers: {
// optional — omit for the keyless free tier
Authorization: `Bearer ${process.env.CLOAK_API_KEY}`,
},
body: form,
});
const { pages, detections } = await res.json();
console.log(`${detections.length} PII regions across ${pages.length} page(s)`);A detection looks like this:
{
"detections": [
{
"id": "d0",
"page": 0,
"bbox": [72.1, 118.4, 168.9, 131.0],
"entity_type": "TFN",
"score": 0.98,
"source": "label",
"masked": true
}
]
}3. Get a redacted PDF back
/v1/redact takes the same file field plus an optional options field (a JSON
string). The response body is the redacted PDF (application/pdf).
curl -X POST https://beforemay-redact.fly.dev/v1/redact \
-H "Authorization: Bearer $CLOAK_API_KEY" \
-F "file=@statement.pdf" \
-F 'options={"style":"pattern"}' \
-o redacted.pdfstyle is one of pattern (black + hatch, the default), blackout (solid black),
or label (colored box tagged with the entity type).
Next
- Authentication — free tier vs keyed limits.
- Rate limits & errors — what happens at the cap.
- Full API reference.