Skip to main content

Knowledge API

Endpoints for storing and retrieving knowledge base items.

List Knowledge Items

GET /v1/knowledge

Query Parameters

Parameter Type Description
projectId string Filter by project (optional)
prefix string Filter by key prefix (e.g., "api/")

Example

curl https://api.erold.dev/v1/knowledge \
  -H "Authorization: Bearer erold_xxx"

Response

{
  "data": [
    {
      "key": "architecture",
      "content": "Our app uses...",
      "projectId": null,
      "updatedAt": "2024-01-15T10:00:00Z"
    },
    {
      "key": "api/auth",
      "content": "Authentication uses...",
      "projectId": "proj_abc123",
      "updatedAt": "2024-01-14T09:00:00Z"
    }
  ]
}

Get Knowledge Item

GET /v1/knowledge/:key

Example

curl https://api.erold.dev/v1/knowledge/architecture \
  -H "Authorization: Bearer erold_xxx"

Set Knowledge Item

PUT /v1/knowledge/:key

Creates or updates a knowledge item.

Body

Field Type Required Description
content string Yes Knowledge content
projectId string No Scope to project (null for tenant-wide)

Example

curl -X PUT https://api.erold.dev/v1/knowledge/architecture \
  -H "Authorization: Bearer erold_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Our application uses a microservices architecture:\n- API Gateway: Kong\n- Services: Node.js with TypeScript\n- Database: PostgreSQL\n- Cache: Redis"
  }'

Delete Knowledge Item

DELETE /v1/knowledge/:key

Example

curl -X DELETE https://api.erold.dev/v1/knowledge/old-docs \
  -H "Authorization: Bearer erold_xxx"

Search Knowledge

GET /v1/knowledge/search

Query Parameters

Parameter Type Description
q string Search query
projectId string Limit search to project
limit number Max results (default: 10)

Example

curl "https://api.erold.dev/v1/knowledge/search?q=authentication" \
  -H "Authorization: Bearer erold_xxx"

Response

{
  "data": [
    {
      "key": "api/auth",
      "content": "Authentication uses JWT tokens...",
      "score": 0.95
    },
    {
      "key": "security/overview",
      "content": "Security includes authentication...",
      "score": 0.72
    }
  ]
}

Knowledge Key Conventions

Use forward slashes to create hierarchical keys:

  • architecture - Top-level overview
  • api/auth - API authentication docs
  • api/endpoints - API endpoint summary
  • coding/style - Code style guidelines
  • decisions/database - Database decision record

Next Steps