Jeremy
API Reference

Context

Query documentation chunks using semantic search.

GET /api/context

Retrieve relevant documentation chunks for a query. Uses vector embeddings for semantic search, with automatic fallback to keyword matching if Vectorize is unavailable.

Auth: read API key

Query Parameters

ParameterTypeRequiredDefaultDescription
libraryIdstringYesThe library to search within
querystringYesThe search query
topKnumberNo10Maximum number of chunks to return

Response

{
  "chunks": [
    {
      "id": "react:42",
      "title": "useState Hook",
      "content": "useState is a React Hook that lets you add a state variable...",
      "url": "https://react.dev/reference/react/useState",
      "tokenCount": 450
    }
  ],
  "libraryId": "react",
  "query": "how to use state"
}

When the response falls back to keyword matching (because Vectorize search failed), the response includes a fallback field:

{
  "chunks": [...],
  "libraryId": "react",
  "query": "how to use state",
  "fallback": true
}

Example

curl "https://jeremy-app.ian-muench.workers.dev/api/context?libraryId=react&query=useState+hook&topK=5" \
  -H "Authorization: Bearer jrmy_your_api_key_here"

Errors

StatusDescription
400libraryId or query parameter is missing
401Missing or invalid API key