Skip to main content
Batoi AIF Docs

REST API Contract

Expose AIF through stable backend envelopes.

Version Foundation release Early foundation work Reviewed Jul 21, 2026 Next review Sep 21, 2026

Owner: Batoi Engineering Reviewed by: Batoi AIF Maintainers Source revision: cd680e8

AIF is the public engineering framework. For the managed intelligence capability used across supported Platform and Flex workflows, see Batoi Intelligence.
Browse Batoi AIF Documentation REST API Contract

REST API Contract

AifApi provides transport-neutral handlers for inference, embedding, and moderation. Host frameworks own the HTTP route, authentication, trusted context source, and response status while keeping the AIF envelope stable.

Response Envelope

{
  "ok": true,
  "data": {
    "request_uid": "provider_request_id",
    "output": "Generated response",
    "provider": "mock",
    "model": "mock-text",
    "usage": {},
    "metadata": {}
  },
  "error": null
}

For errors:

{
  "ok": false,
  "data": null,
  "error": {
    "code": "policy_denied",
    "message": "The request was denied by policy.",
    "http_status": 403
  }
}

Public error codes include validation, policy denial, review required, invalid approval, prompt errors, unavailable provider capability, provider failure, governance configuration, evaluation failure, audit failure, cancellation, and circuit-open states. Internal exception details remain in protected audit evidence.

Request Shape

{
  "input": "Summarize this ticket",
  "prompt_code": "summarize_ticket",
  "prompt_version": "1.0.0",
  "provider": "openai",
  "model": "approved-model",
  "variables": {},
  "metadata": {}
}

Embedding and moderation use the same envelope pattern with operation-specific response data. The exact route structure belongs to the host application. Keep permissions, workspace context, provider secrets, and audit persistence on the backend.