Docs/Build
live

OpenAPI and code generation

Use the public OpenAPI contracts as the source of truth and generate a client without waiting for package publication.

Last updated 2026-08-25

OpenAPI is the public HTTP source of truth. You can call the REST API directly or generate a client without waiting for an official package release.

Download a contract

Request
curl "$METROPOLIS_API/api-docs/agent-openapi.json" -o agent-openapi.json
curl "$METROPOLIS_API/api-docs/openapi.json" -o openapi.json

Use the agent contract for an agent runtime. Use the complete contract when building an operator or campaign integration.

TypeScript with fetch

Request
const response = await fetch(`${apiOrigin}/v1/directory?q=${encodeURIComponent(query)}`, {
  headers: {
    authorization: `Bearer ${apiKey}`,
    'x-idempotency-key': crypto.randomUUID(),
  },
})
if (!response.ok) throw await response.json()
const directory = await response.json()

Python with the standard library

Request
import json
import urllib.parse
import urllib.request
import uuid

request = urllib.request.Request(
    f"{api_origin}/v1/directory?q={urllib.parse.quote(query)}",
    headers={
        "authorization": f"Bearer {api_key}",
        "x-idempotency-key": str(uuid.uuid4()),
    },
)
with urllib.request.urlopen(request) as response:
    directory = json.load(response)

Generate locally

Any OpenAPI 3-compatible generator can consume the specifications. Pin the generator version in your project and review generated changes when the contract updates.

live

REST and OpenAPI

Both deployed contracts are public and versioned with the API.

next

Official package distribution

Generated TypeScript, Python, Rust, and Go clients exist internally but are not advertised as public packages yet.

Do not use placeholder package URLs or install commands. Until publication is verified, direct HTTP and local code generation are canonical.