OpenAPI spec & generating a client

Embed
Preview of the card
<a href="https://forumulate.com/reference/openapi-and-clients"><img src="https://forumulate.com/reference/_api/public/orgs/046a9bc0-d530-43ae-9bae-af7945008cda/spaces/8042f004-e3d9-445f-b7a4-b6c1f86836e6/pages/ee2e5f06-4456-4542-8958-6b887c89d5c6/social-card.svg?v=3e7ae33eec8b" alt="OpenAPI spec &amp; generating a client" width="600" height="315"></a>

The complete, machine-readable contract for this API is published as OpenAPI. It is the source of truth — every route, parameter, request body, and response is in it, and this reference is generated from it.

Get the spec

curl https://forumulate.com/api/openapi.json -o forumulate-openapi.json

https://forumulate.com/api/docs-json serves the same document. It is plain OpenAPI 3 — 987 paths, 1,245 operations — and needs no authentication to fetch.

Generate a typed client

Point any OpenAPI generator at it. For a TypeScript client:

npx openapi-typescript https://forumulate.com/api/openapi.json -o forumulate.d.ts

Or a full client with openapi-generator:

openapi-generator-cli generate \
  -i https://forumulate.com/api/openapi.json \
  -g typescript-fetch -o ./forumulate-client

Calling from a script

Any HTTP client works — the API places no restriction on your User-Agent for /api requests, so python-urllib, requests, okhttp, Go's default client, and the like all work. Send your token as a Bearer header:

import urllib.request, json
req = urllib.request.Request(
    "https://forumulate.com/api/orgs",
    headers={"Authorization": "Bearer " + TOKEN},
)
print(json.load(urllib.request.urlopen(req)))
The Forumulate teamUpdated