> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. # JWT from Fern API key GET https://docs.example.com/api/fern-docs/get-jwt Get a JWT to access protected documentation endpoints, optionally scoped to specific roles. Reference: https://buildwithfern.com/learn/docs/fern-api-reference/get-jwt ## Authentication - `FERN_API_KEY` header (required) — Fern API key, from `fern token`. ## Request ### Headers - `ROLES` (string, optional) — Comma-separated list of roles (e.g., "botanist,seedling"). Sets roles for returned JWT if provided, otherwise, roles are empty. - `x-fern-host` (string, optional) — Domain (required on preview URLs) ## Response ### 200 Successfully generated JWT - `fern_token` (string, required) — JWT token for authenticating subsequent requests - `roles` (list of string, required) — Roles included in the JWT ## Errors ### 400 Bad Request Error Bad request (local preview, self-hosted, or SSO environment) - `error` (string, optional) ### 401 Unauthorized Error Unauthorized (missing or invalid API key) - `error` (string, optional) ### 403 Forbidden Error Forbidden (API key does not belong to this domain's Fern organization) - `error` (string, optional) ## Examples **Response** ```json { "fern_token": "string", "roles": [ "string" ] } ```