Base URLs
| Environment | API | MCP |
|---|---|---|
| Production | https://api.3ngram.ai | https://mcp.3ngram.ai/mcp |
| Self-hosted | http://localhost:8000 | http://localhost:8001/mcp |
Authentication
All API requests (except auth endpoints) require a JWT access token:POST /api/auth/login. Access tokens expire in 15 minutes; use POST /api/auth/refresh to renew.
MCP connections use OAuth 2.0 (Streamable HTTP) or bearer tokens (legacy). See Security.
Response format
Success (single item)
Success (list)
Error
HTTP status codes
| Code | Meaning |
|---|---|
| 200 | OK |
| 201 | Created |
| 204 | No Content (successful delete) |
| 400 | Bad request |
| 401 | Missing or invalid token |
| 403 | Valid token, no permission |
| 404 | Not found or not owned |
| 422 | Validation error |
| 500 | Server error |
Rate limits
Auth endpoints are rate-limited via slowapi. MCP login is rate-limited to 5 attempts per 60 seconds per IP.OpenAPI spec
Interactive API docs are available at:- Swagger UI:
/docs - ReDoc:
/redoc - OpenAPI JSON:
/openapi.json