API document

Host routes and invocation API

CodexDock exposes a conventional route surface for creating owner-scoped work, connecting local workers, claiming jobs, and reading completed results.

Routes

Default host endpoints

These paths are defaults, not the security boundary. A host can mount them elsewhere as long as discovery points the CLI to the right URLs.

MethodRoutePurpose
GET/api/codexdock/discoveryReturns the host endpoint manifest used by the CLI.
POST/api/codexdock/pairing/codeCreates a short-lived browser-scoped pairing code.
POST/api/codexdock/pairing/exchangeExchanges a pairing code for an owner-scoped worker token.
POST/api/codexdock/invokeCreates a pending owner-scoped invocation.
GET/api/codexdock/invocations/[invocationId]Reads invocation status and completed results for the owner.
POST/api/codexdock/worker/connectRegisters or refreshes a local worker connection.
GET/api/codexdock/worker/statusReports worker and queue status for operations.
POST/api/codexdock/worker/nextClaims the next matching pending invocation.
POST/api/codexdock/worker/resultSubmits a validated worker result.

Create work

One invocation lifecycle, four generation types.

The type controls the worker capability and result envelope. The host can attach business context through parameters.

Server-side invocation
const invocation = await codexdock.invoke({
  type: "generate_object",
  prompt: "Create four product cards.",
  parameters: { count: 4, usage: "product-preview" },
});

// {
//   invocationId: "inv_123",
//   status: "pending",
//   statusUrl: "/api/codexdock/invocations/inv_123"
// }
generate_texttext result

Captions, summaries, prompts, copy

generate_objectobject result

Structured UI data or domain objects

generate_filefile result

Markdown, source files, generated artifacts

generate_imageimage result

Thumbnails, avatars, visual assets