On this page

Developer documentation

Go from signup to a production review

Ogat applies reusable, plain-language rules to your product inputs and returns a structured decision your code can act on. This guide starts with one working request, then covers interactive forms, response handling, limits, and webhooks.

API base URLhttps://api.ogat.ai/functions/v1

Authenticate with Authorization: Bearer ogt_… (app-scoped API key). All endpoints are POST with Content-Type: application/json.

Building with an agent? Give it the agent guide and OpenAPI specification.

Start here

Core concepts

An organization contains apps. Each app contains policies that define inputs, rules, and decision settings. A submission is one filled instance of a policy. You can review individual inputs as they are filled (review-input / review-inputs) to give instant feedback before the form is complete. When everything is ready, review-submission (or its webhook) returns the product decision your code should act on.

  1. OrganizationYour team and billing boundary
  2. AppThe product using Ogat
  3. PolicyInputs, rules, and decision settings
  4. SubmissionOne set of values to review
  5. ReviewThe resulting decision and checks

Get started

From signup to your first review

This path mirrors console onboarding. If you already finished get-started, skip ahead to the API key and call. If you are mid-way, use the step that matches where you left off.

  1. Create an accountSign up and create or join an organization. Billing and team members live at the org level.
  2. Create an app and a policy In the console, open Get started and pick a template, or create an app and policy yourself. A policy needs the input keys you will send (for example website or message) and the plain-language rules each input must satisfy.

    Copy the policy handle from the policy page. Handles are unique within an app and go in the request’s policy field.

  3. Optional: run a test review in the console Onboarding nudges you to run a pre-filled test on the policy form. That uses the same review path as the API and confirms your rules before you wire anything up. Skip this if you already know the policy works.
  4. Create an API key Open Developers → API keys for the same app as the policy. Copy the ogt_… secret when it is shown — it is displayed once.
    Keep the key on your server. Never expose it in browser code, a mobile binary, source control, logs, or an agent prompt you do not trust. Never send third-party LLM keys to Ogat.
  5. Call review-submission For a backend job, agent action, or form submit, send the completed inputs in one request. Omitting submissionId creates the submission and reviews it together.
    curl -s https://api.ogat.ai/functions/v1/review-submission \
      -H "Authorization: Bearer ogt_…" \
      -H "Content-Type: application/json" \
      -d '{
      "policy": "your-policy-handle",
      "inputs": {
        "message": "Pay me directly on another app and I can ship it cheaper."
      }
    }'

    Replace your-policy-handle and the API key (ogt_…) in the example with values from the same app. For this example, your policy must contain an input whose key is message — or change that key (and value) to match an input on your policy.

    Response 200 — reject
    {
      "submissionId": "8f6a7b3c-1111-2222-3333-444444444444",
      "decision": "reject",
      "reasonCode": "required_input_failed",
      "inputs": [
        {
          "key": "message",
          "result": "fail",
          "checks": [
            {
              "rule": "Do not move payment off-platform",
              "result": "fail",
              "certainty": 88
            }
          ]
        }
      ]
    }

    Use the top-level decision for control flow. HTTP 200 means the review ran successfully. decision: "reject" or "needs_review" is a product outcome, not an API error.

Choose a path

Integration patterns

You always finish with review-submission when you need a product decision. How you get there depends on whether you review everything at once or field-by-field.

One-shot review

Send every input in a single call when the form or job is complete. No earlier calls required.

review-submission

Progressive review

Review fields as the user fills them (blur, step, or section), then finalize once. Reuse the same submissionId so unchanged checks are not re-billed.

review-input / review-inputs → review-submission

create-submission is optional on either path: use it when you want a submissionId before any review. Otherwise review-input, review-inputs, and review-submission can each create the submission when submissionId is omitted.

EndpointWhat it reviewsReturns decisionWebhooks
create-submissionNothing (stores values only)NoNo
review-inputOne inputNoNo
review-inputsKeys sent in this requestNoNo
review-submissionAll inputs that have valuesYesYes

Branch product logic on top-level decision only after review-submission (or a webhook from it). review-input and review-inputs return per-input results so you can guide the user before that final call.

Optional

Create a submission

POST /create-submission mints a platform submissionId and stores optional inputs, context, and data. The submission starts with status draft. This call does not run reviews or emit webhooks — skip it if the first review call can create the submission for you.

Request
curl -s https://api.ogat.ai/functions/v1/create-submission \
  -H "Authorization: Bearer ogt_…" \
  -H "Content-Type: application/json" \
  -d '{
  "policy": "sender-id-registration",
  "inputs": {
    "company_name": "Acme Alerts",
    "website": "https://acme.com"
  }
}'
Response 200
{
  "submissionId": "8f6a7b3c-1111-2222-3333-444444444444",
  "status": "draft",
  "policy": "sender-id-registration"
}

Interactive forms

Review one input

POST /review-input evaluates a single input (for example on field blur). Omit submissionId to create a draft automatically. Returns one input object in the same shape as an entry in review-submission’s inputs array.

New checks use plan credits; an unchanged cached result does not. This call does not return a top-level decision, update submission status, or emit a webhook. A check fail is still HTTP 200.

Request
curl -s https://api.ogat.ai/functions/v1/review-input \
  -H "Authorization: Bearer ogt_…" \
  -H "Content-Type: application/json" \
  -d '{
  "policy": "sender-id-registration",
  "submissionId": "8f6a7b3c-1111-2222-3333-444444444444",
  "input": "website",
  "value": "https://acme.com"
}'
Response 200
{
  "submissionId": "8f6a7b3c-1111-2222-3333-444444444444",
  "input": {
    "key": "website",
    "result": "pass",
    "checks": [
      {
        "rule": "Website must look like a real business site",
        "result": "pass",
        "certainty": 92
      }
    ]
  }
}

Interactive forms

Review several inputs

POST /review-inputs evaluates multiple inputs in one call (for example a wizard step). Only the keys present in this request’s inputs are reviewed; previously stored values remain available for $placeholder interpolation.

Response is { submissionId, inputs } with no overall decision, status update, or webhook. Call review-submission to finalize. New checks use plan credits; if an input was already reviewed with the same value, the cached result is reused and does not consume credits again. Per-input pass / fail results are still HTTP 200.

Request
curl -s https://api.ogat.ai/functions/v1/review-inputs \
  -H "Authorization: Bearer ogt_…" \
  -H "Content-Type: application/json" \
  -d '{
  "policy": "sender-id-registration",
  "submissionId": "8f6a7b3c-1111-2222-3333-444444444444",
  "inputs": {
    "company_name": "Acme Alerts",
    "website": "https://acme.com"
  }
}'
Response 200
{
  "submissionId": "8f6a7b3c-1111-2222-3333-444444444444",
  "inputs": [
    {
      "key": "company_name",
      "result": "pass",
      "checks": [
        {
          "rule": "Company name looks like a real business",
          "result": "pass",
          "certainty": 90
        }
      ]
    },
    {
      "key": "website",
      "result": "pass",
      "checks": [
        {
          "rule": "Website must look like a real business site",
          "result": "pass",
          "certainty": 92
        }
      ]
    }
  ]
}

Primary endpoint

Review the whole submission

POST /review-submission is the final review. It merges any previously stored input values with this request’s inputs, reviews every input that has a value, returns top-level decision, updates submission status, and emits configured webhooks.

Omit submissionId to create and review in one call. Use it after progressive review-input / review-inputs calls, or alone for one-shot integrations. New checks use plan credits; if an input was already reviewed with the same value on this submission, the cached result is reused and does not consume credits again. If every input is already cached that way, finalizing costs no extra credits. You still get the product decision (and webhooks, if configured).

  • externalId stores your own reconciliation reference.
  • context and data drive conditional rules and $placeholders. See Context and data.
Request
curl -s https://api.ogat.ai/functions/v1/review-submission \
  -H "Authorization: Bearer ogt_…" \
  -H "Content-Type: application/json" \
  -d '{
  "policy": "sender-id-registration",
  "inputs": {
    "company_name": "Acme Alerts",
    "website": "https://acme.com",
    "use_case": "Customer notifications"
  }
}'
Response 200 — approve
{
  "submissionId": "8f6a7b3c-1111-2222-3333-444444444444",
  "decision": "approve",
  "inputs": [
    {
      "key": "website",
      "result": "pass",
      "checks": [
        {
          "rule": "Website must look like a real business site",
          "result": "pass",
          "certainty": 92
        }
      ]
    }
  ]
}
Response 200 — needs_review
{
  "submissionId": "8f6a7b3c-1111-2222-3333-444444444444",
  "decision": "needs_review",
  "reasonCode": "low_certainty",
  "inputs": [
    {
      "key": "website",
      "result": "pass",
      "reasonCode": "low_certainty",
      "checks": [
        {
          "rule": "Website is relevant to the stated use case",
          "result": "pass",
          "certainty": 62,
          "reasonCode": "low_certainty"
        }
      ]
    }
  ]
}
Response 200 — reject
{
  "submissionId": "8f6a7b3c-1111-2222-3333-444444444444",
  "decision": "reject",
  "reasonCode": "required_input_failed",
  "inputs": [
    {
      "key": "message",
      "result": "fail",
      "checks": [
        {
          "rule": "Do not move payment off-platform",
          "result": "fail",
          "certainty": 88
        }
      ]
    }
  ]
}

All three outcomes above are HTTP 200. Reject and needs-review are review results, not transport or validation failures.

Request body

Input shapes

create-submission, review-inputs, and review-submission accept inputs in either of these forms. Prefer the object map.

Recommended — object map
{
  "company_name": "Acme",
  "website": "https://acme.com"
}
Also accepted — key/value array
[
  { "key": "company_name", "value": "Acme" },
  { "key": "website", "value": "https://acme.com" }
]

Values are coerced to strings. null / omitted entries are skipped. Anything else (a bare string, number, …) returns 400 with inputs must be an object or an array of { key, value } objects.

review-input uses a single input key plus value instead of an inputs map.

Request body

Context and data

Besides inputs, review calls accept optional context and data objects. They are merged into the submission (later calls overwrite earlier keys). They are not reviewed as inputs themselves.

Context

context selects which rules run. In the console, conditional rules use Only when conditions on submission context keys. At review time Ogat compares those conditions to the context object you send. If a condition does not match, that rule is skipped for the input.

That lets one policy cover several situations without duplicating inputs. For example, an online marketplace listing policy might always check the title and description for banned items, but only require a shipping or return-policy rule when the listing is for physical goods. A social app might always check posts for harassment, but only apply advertising rules when the post is marked as promoted.

Send the situation as context, for example:

{
  "listingType": "physical_goods",
  "sellerTier": "new"
}

Then configure a rule as “Only when listingType is physical_goods”. It runs for that request, and is skipped when listingType is something else (or missing). Rules without an Only-when condition still run for every review.

Data

data fills $placeholders in rule text (and related rule config). Write rules like “Description must mention $store_name”, then pass:

{
  "store_name": "Acme Market",
  "support_email": "help@acme.com"
}

Placeholder lookup merges data with the submission’s input values; if the same key exists in both, the input value wins. If a required $placeholder is still missing, that rule waits and the input can come back skipped with reasonCode: waiting_for_data.

Together

A typical progressive or one-shot request can include all three:

{
  "policy": "marketplace-listing",
  "inputs": {
    "title": "Vintage camera",
    "description": "Barely used, ships next day."
  },
  "context": {
    "listingType": "physical_goods"
  },
  "data": {
    "store_name": "Acme Market"
  }
}

inputs are what you evaluate. context decides which rules apply. data fills dynamic parts of rule text without turning those values into separate reviewed inputs.

Control flow

Read the response

Three distinct signals. Do not treat a check pass as “confident enough to accept,” and do not branch your product on an individual check. Top-level decision appears only on review-submission (and webhooks). HTTP 200 only means the review completed; always read decision (or per-input results from review-input / review-inputs).

FieldMeaning
inputs[].result / checks[].resultDid the rule criteria match? (pass | fail; input also skipped)
certaintyConfidence 0–100. Independent of result.
decisionProduct action: approve | reject | needs_review

Submission reasonCode (omitted when it would only be ok):

reasonCodeTypical decision
omittedapprove
required_input_failedreject
optional_input_failedneeds_review
low_certaintyneeds_review
too_many_optional_failuresreject (advanced optional-failure limit)

Input and check reasonCode values include low_certainty and waiting_for_data (skipped input).

Example: all checks can be pass with reasonCode: low_certainty while top-level decision is needs_review. Escalate for a human instead of auto-approving.

Operate safely

Errors, limits, and retries

Treat HTTP status and review outcome separately. A completed review returns 200 even when checks fail or decision is reject / needs_review. Non-2xx means the request itself failed (bad input, auth, quota, or server error).

Error bodies always include a human-readable error string. Some also include a machine-readable code and related fields.

StatusMeaningWhat to do
200Review completedRead decision / per-input results. Do not treat as auto-approve.
400Invalid requestFix the body, policy handle, input key, or value.
401Auth failedSend a valid, non-revoked ogt_… key as a Bearer token.
403Wrong app or policyUse a key and policy handle from the same app.
429Rate or credit limit Inspect code: rate_limited means slow down; credit_quota_exceeded means wait for reset, top up, or upgrade.
500Server errorRetry with backoff. Log the response without logging your API key.
400
{
  "error": "policy is required"
}
401
{
  "error": "Invalid API key"
}
429 rate_limited
{
  "error": "Too many reviews. Try again in a moment.",
  "code": "rate_limited",
  "reviewsPerMinuteLimit": 20
}
429 credit_quota_exceeded
{
  "error": "Free includes 1000 credits per month. Upgrade to continue.",
  "code": "credit_quota_exceeded",
  "creditsUsed": 1000,
  "creditsLimit": 1000,
  "topupRemaining": 0,
  "remainingCapacity": 0,
  "autoTopupEnabled": false,
  "planSlug": "free",
  "resetsAt": "2026-11-01T00:00:00.000Z"
}
Retries can consume credits. The API does not currently accept an idempotency key. A retry without an existing submissionId can create and review another submission. Retry only ambiguous transport or server failures, use exponential backoff, and reuse a known submissionId when your workflow has one. Do not retry 400, 401, 403, or credit-quota errors in a loop.

New review work counts toward the organization’s plan credits; reused unchanged cached checks do not. Free includes 1,000 credits each month. Throughput limits vary by plan.

Events

Webhooks

Register a URL in the console under Developers → Webhooks. After review-submission completes, we POST the same public decision fields plus event and policy. review-input and review-inputs do not fire webhooks.

HeaderValue
Content-Typeapplication/json
X-Ogat-Eventreview.completed or review.needs_review
X-Ogat-SignatureHMAC-SHA256 of the raw body, lowercase hex, using the endpoint secret
  • review.completed — approve or reject
  • review.needs_review — human review recommended

Choose which events each endpoint receives in the console. Subscriptions are exact: only the events you select are delivered. Inspect X-Ogat-Event or the payload’s event field.

Read the raw request body before parsing JSON. Recompute the HMAC with your stored secret and compare it to X-Ogat-Signature with a timing-safe comparison. We never send the secret in the POST.

Verify in Node.js
import { createHmac, timingSafeEqual } from "node:crypto";

export function verifyOgatWebhook(rawBody, signature, secret) {
  const expected = createHmac("sha256", secret)
    .update(rawBody)
    .digest("hex");
  const received = Buffer.from(signature || "", "hex");
  const wanted = Buffer.from(expected, "hex");

  return received.length === wanted.length &&
    timingSafeEqual(received, wanted);
}
Example payload
{
  "event": "review.needs_review",
  "submissionId": "8f6a7b3c-1111-2222-3333-444444444444",
  "policy": "sender-id-registration",
  "decision": "needs_review",
  "reasonCode": "low_certainty",
  "inputs": [
    {
      "key": "website",
      "result": "pass",
      "reasonCode": "low_certainty",
      "checks": [
        {
          "rule": "Website is relevant to the stated use case",
          "result": "pass",
          "certainty": 62,
          "reasonCode": "low_certainty"
        }
      ]
    }
  ]
}

Return a 2xx response promptly. Ogat records non-2xx deliveries, but automatic retries are not currently guaranteed; make your receiver observable and reconcile missed events from your own review calls.

Before launch

Production checklist

  • Store the API key in a server-side secret manager, and plan for key rotation.
  • Test known approve, reject, and needs-review cases for each policy you ship.
  • Branch on decision, and route needs_review to a human.
  • Handle 429 and 5xx responses with bounded retries. Do not retry in an unbounded loop.
  • Log submissionId for reconciliation. Never log API keys or webhook secrets.
  • If you use webhooks, verify X-Ogat-Signature against the raw body before acting.

API keys and webhooks never receive console-only fields such as costs, internal ids, or _trace. For exact schemas, use the OpenAPI specification.

Start building freeOpen console