API reference
Every procedure of the Trialmile server, generated from the oRPC OpenAPI export.
The pages in this section are generated at build time from apps/fumadocs/openapi/trialmile.json,
the OpenAPI document exported from the oRPC router in packages/api. Nothing here is written by hand:
run bun run openapi in apps/fumadocs after changing a procedure, or let bun run build do it.
Calling the API
Every procedure is a POST with a JSON body under the /api-reference prefix of the server:
curl -X POST http://localhost:3720/api-reference/campaigns/list \
-H "Content-Type: application/json" \
--cookie "better-auth.session_token=…" \
-d '{}'- Authentication: a Better Auth session cookie (
/api/auth/*). Organization-scoped procedures use the session's active organization; the caller must be a member. - Admin:
admin.*requires theadminrole.dev.*additionally requiresDEV_TOOLS=1and is absent onstage/prod. - Errors: oRPC error envelopes (
UNAUTHORIZED,FORBIDDEN,NOT_FOUND,BAD_REQUEST, …). Cross-organization ids answerNOT_FOUND. - Soft deletes:
deletesetsdeleted_at,restoreclears it;list/getacceptincludeDeleted.
The same document backs the server's own reference at http://localhost:3720/api-reference (/spec.json for the raw spec).