1. Document APIs
  2. Authentication

Every interactive API page needs an authentication strategy. In Docsalot, you can set that once in layout.json or override it on an individual page.

​
Configure auth globally

Most projects should define a default auth method in layout.json.

{
  "api": {
    "auth": {
      "method": "bearer"
    }
  }
}

For the current Docsalot CLI API, bearer auth is the right default.

​
Override auth per page

Set authMethod in page frontmatter when one endpoint needs different behavior than the rest of the site.

---
title: "Health check"
api: "GET /status"
authMethod: "none"
---

Page-level auth overrides the global layout.json setting.

​
Supported auth methods

  • bearer
  • basic
  • key
  • none

Use none for public endpoints after you have already configured a default auth method globally.

​
Rename auth inputs

Basic auth usually prompts for username and password, but you can relabel those inputs if your API uses different terms.

layout.json
{
  "api": {
    "auth": {
      "method": "basic",
      "name": "user-id:user-key"
    }
  }
}

If you only need a single API key field, use key and omit the colon.

layout.json
{
  "api": {
    "auth": {
      "method": "key",
      "name": "my-api-key"
    }
  }
}

​
Local Docsalot testing

For local preview against the Docsalot CLI API:

  • temporarily point api.baseUrl at http://localhost:3000/api/cli/v1
  • use a local CLI token as Bearer <token>
  • test GET /auth/user first before trying write endpoints

If the playground still sends requests to an old host, hard refresh the docs preview and clear any persisted playground state in the browser.