Skip to main content

Base URLs

EnvironmentAPIMCP
Productionhttps://api.3ngram.aihttps://mcp.3ngram.ai/mcp
Self-hostedhttp://localhost:8000http://localhost:8001/mcp

Authentication

All API requests (except auth endpoints) require a JWT access token:
Authorization: Bearer {access_token}
Obtain tokens via 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)

{
  "id": "uuid",
  "title": "Document Title",
  "created_at": "2026-02-02T12:00:00Z"
}

Success (list)

{
  "results": [...],
  "total": 100,
  "query": "search term"
}

Error

{
  "detail": "Human-readable error message"
}

HTTP status codes

CodeMeaning
200OK
201Created
204No Content (successful delete)
400Bad request
401Missing or invalid token
403Valid token, no permission
404Not found or not owned
422Validation error
500Server 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