Skip to content

Authentication

Every request to the API carries an API token. A token acts as the person who created it, in one organization, with that person’s access.

  1. In Lyra, open Settings → API tokens.
  2. Give the token a name that says where it will be used, such as Sync script.
  3. Pick when it expires: 30 days, 90 days, 1 year or No expiry. 90 days is the default. A shorter time limits the damage if the token leaks.
  4. Click Create token.
  5. Copy the token now. Lyra shows it only once and keeps only a hash of it, so nobody can see it again, not even you.

Tokens start with lyra_pat_.

A token belongs to the organization you were in when you created it. To work in two organizations, create a token in each.

Send it in the Authorization header of every request:

Terminal window
curl https://app.lyra-docs.com/api/v1/me \
-H "Authorization: Bearer $LYRA_TOKEN"

GET /me is a quick way to check a token. It answers with you, the organization and the token:

{
"id": "01a237c4-f581-73f7-ba96-b7f0e0868dc4",
"name": "Sam",
"email": "sam@example.com",
"organization": { "id": "01a237c6-4b08-70a5-aae5-5841df10d92c", "name": "Acme", "role": "admin" },
"token": { "id": "01a237c7-57cc-76f4-a833-68cbb161491d", "expiresAt": "2027-01-01T17:22:20.748Z" }
}

Only API tokens work on /api/v1. The cookie your browser signs in with doesn’t, and neither do the sign-ins AI agents get through MCP.

A token works in three places: the API under /api/v1, MCP at /mcp, and file downloads at /api/files/<id>. Every other address in Lyra, such as the ones the web app calls, answers a token with 401 unauthorized. Those addresses change with the web app, so build on /api/v1.

A token can do what you can do in its organization, and nothing more:

  • It sees the pages you can see, and changes the ones you can edit. A request for a page you can’t open answers 404, the same as for a page that doesn’t exist.
  • Changes show in page history under your name.
  • Before a token changes a page, Lyra saves the page as a version, so you can put the earlier version back from page history.
  • The API has no endpoints for sharing pages, inviting people or changing settings. Do those in Lyra.

Treat a token like a password.

  • Keep it in an environment variable or a secret manager, not in your code.
  • Don’t put it in a web page or an app that other people can open.
  • Use one token per script, so you can revoke one without stopping the others.

Because tokens start with lyra_pat_, secret scanners can find one that ended up in code by mistake. If that happens, revoke it right away.

A token stops working, and every request with it answers 401 unauthorized, when:

  • you revoke it
  • it expires
  • you’re removed from its organization
  • the organization is deleted
  • your account is deleted
  1. Open Settings → API tokens. Each token shows when it was created, when it was last used and when it expires.
  2. Click Revoke next to the token and confirm.

Anything using the token loses access right away.