Bearer Authentication β Overview
Bearer Authentication secures DocuWriter.aiβs REST API by requiring clients to present a valid token with each request. Tokens follow the standard Authorization: Bearer scheme. This approach enables stateless, scalable authentication without sessions or cookies.
π What Is Bearer Authentication?
- A token-based scheme where clients include a secret token in the HTTP
Authorizationheader. - The server verifies the token on every request, granting access if valid.
- Ideal for APIsβno need to manage server-side session state.
ποΈ How Tokens Are Issued
Manage account -> API Tokens
π§ Using Bearer Tokens
Include your token in every API call:
curl https://app.docuwriter.ai/api/user \
-H "Authorization: Bearer your_personal_access_token"
- If the token is missing or invalid, the API returns 401 Unauthorized.
- If the token is valid but the user lacks permissions, the API returns 403 Forbidden.
π¦ Protected Endpoints
| HTTP Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/user |
Retrieve authenticated userβs profile | β Yes |
| POST | /api/my-generations |
List userβs documentation generations | β Yes |
| GET | /api/spaces |
List userβs Spaces | β Yes |
| POST | /api/spaces/{space}/search |
Search within a Space | β Yes |
| GET | /api/spaces/{space}/documents/{item} |
Show a document in a Space | β Yes |
| POST | /api/spaces/{space}/documents |
Create a new document in a Space | β Yes |
| PUT | /api/spaces/{space}/documents/{item} |
Update a document in a Space | β Yes |
| DELETE | /api/spaces/{space}/documents/{item} |
Delete a document in a Space | β Yes |
| POST | /api/generate-code-documentation |
Generate code documentation for a file | β Yes |
| POST | /api/generate-multi-file-documentation |
Generate docs for multiple files | β Yes |
| β¦ | and many more generation, management, webhook, and feedback endpoints | β¦ | β Yes |
(All /api/ routes require a valid Bearer token.)*
π Status Codes
| Status Code | Meaning |
|---|---|
| 200 OK | Request succeeded |
| 201 Created | Resource created (e.g., documentation generated) |
| 401 Unauthorized | Missing or invalid Bearer token |
| 403 Forbidden | Valid token, but insufficient permissions |
| 404 Not Found | Resource not found |
| 422 Unprocessable Entity | Validation errors on request payload |
Updated