# On-Off Approvals API (ok.onoffgroup.com)

Submit content for approval programmatically — built so a script or Claude Code
can send marketing content for review without pasting screenshots.

## Auth

Get a token: log in at https://ok.onoffgroup.com → **API access** → Generate token.
Send it on every call:

    Authorization: Bearer ok_...

## Create an approval request

    POST https://ok.onoffgroup.com/api/requests
    Content-Type: application/json

    {
      "title": "August content calendar — week 2",
      "note": "Optional note shown to the reviewer before they start.",
      "items": [
        { "kind": "html",  "title": "Aug 10 · LinkedIn post", "body": "<style>...</style><div>full HTML of one post — rendered as-is in a sandboxed frame</div>" },
        { "kind": "text",  "title": "Caption", "body": "Plain-text caption or copy." },
        { "kind": "link",  "title": "Full doc", "body": "https://docs.google.com/..." },
        { "kind": "image", "title": "Visual",  "body": "/uploads/<from the upload endpoint>" }
      ]
    }

Response: `{ "id": 12, "share_url": "https://ok.onoffgroup.com/r/<secret>" }`

Send the `share_url` to the reviewer (e.g. Phil) — no login needed on their side.
They see one item at a time and approve / request changes / comment on each.

Guidelines for good items:
- **One post = one item.** Don't submit a whole calendar as a single blob — the
  point of the tool is card-by-card review. Split it.
- `html` items should be self-contained (inline styles or a `<style>` block);
  scripts never run. External https images/fonts are allowed.
- Titles like `"Aug 10 (Mon) · LinkedIn — Launch post"` make review much easier.
- Limits: 100 items per request, 500 KB per item.

## Upload an image (for `kind: "image"` items)

    POST https://ok.onoffgroup.com/api/uploads
    Content-Type: image/png        (or image/jpeg, image/gif, image/webp)
    <raw image bytes, max 8 MB>

Response: `{ "path": "/uploads/abc123.png" }` — use that as an item's `body`.

## Check the review result

    GET https://ok.onoffgroup.com/api/requests/<id>

Returns status (`pending` | `completed`), the reviewer's name, and every item
with its `verdict` (`approved` | `changes`) and `comment`. Poll it, or just wait
for the completion email — the requester is emailed when the review is done.

## List your requests

    GET https://ok.onoffgroup.com/api/requests
