> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crovant.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API reference

> Authentication, conventions, and how this reference is produced.

The Crovant API is served from `https://crovant.com/api`. Every endpoint in the
**Endpoints** section is generated directly from the handlers that serve it, so
the reference cannot drift from the deployed behaviour.

## Authentication

Send your API key as a bearer token:

```bash theme={null}
curl https://crovant.com/api/events?workspaceId=YOUR_WORKSPACE_ID \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Keys are generated per workspace under **Configuration → API**. Portal requests
from a signed-in browser authenticate with a session cookie instead, so
endpoints accept either.

## Conventions

<AccordionGroup>
  <Accordion title="Workspace scoping">
    Most endpoints act on one workspace and require a `workspaceId` query
    parameter. Without it you get `400 Missing workspaceId`.
  </Accordion>

  <Accordion title="Responses">
    Responses are JSON. Errors carry an `error` field, and authorisation
    failures add a `reason` naming the check that failed — see
    [Troubleshooting](/troubleshooting).
  </Accordion>

  <Accordion title="Paths">
    `/api/<name>` is the current form. The legacy `/.netlify/functions/<name>`
    prefix resolves to the same handlers and still works, so existing
    integrations do not need changing.
  </Accordion>

  <Accordion title="Usage and billing">
    Calls are metered against the workspace named in the request. See
    [Billing and usage](/guides/billing-and-usage).
  </Accordion>
</AccordionGroup>

## How this reference is generated

`scripts/generate-openapi.mjs` reads the handler sources and derives each
endpoint's methods, query parameters and body fields, writing an OpenAPI
document consumed by this site. It runs as part of every build, so shipping a
handler change updates the reference with it.

<Note>
  Because the spec is inferred from source rather than hand-written, parameters
  are typed as strings and descriptions are derived from handler names. It is an
  accurate map of what exists; it is not a substitute for the guides when you
  need to know what an endpoint means.
</Note>

Administrative endpoints and the Stripe webhook are deliberately excluded — they
are not part of the public surface.
