Skip to content

Endpoint

POST /api/v2/ingest

The V2 ingest endpoint is the primary entry point for all event data flowing into Contox. It accepts events from the MCP server, CLI, VS Code extension, and any custom integration.

Authentication

This endpoint uses HMAC-SHA256 signatures for authentication. See HMAC Signing for the complete signing process.

Required headers

HeaderDescription
Content-TypeMust be application/json
X-Contox-ProjectYour project ID
X-Contox-TimestampUnix timestamp used in signature
X-Contox-SignatureHMAC-SHA256 signature prefixed with sha256=

Request body

FieldTypeRequiredDescription
eventstringYesEvent type identifier
payloadobjectYesEvent-specific data

Event types

The following event types are accepted:

EventDescription
session_saveSave session work with summary and changes
scan_resultCodebase scan results
git_digestGit commit digest data
context_updateContext creation or update
memory_operationMemory CRUD operation

Example request

bash
curl -X POST https://contox.dev/api/v2/ingest \
  -H "Content-Type: application/json" \
  -H "X-Contox-Project: proj_abc123" \
  -H "X-Contox-Timestamp: 1705312200" \
  -H "X-Contox-Signature: sha256=a1b2c3d4..." \
  -d '{
    "event": "session_save",
    "payload": {
      "summary": "Implemented user authentication with JWT",
      "changes": [
        {
          "category": "implementation",
          "title": "JWT auth middleware",
          "content": "Added auth middleware at src/middleware/auth.ts"
        }
      ]
    }
  }'

Response

The endpoint returns 202 Accepted on success, indicating the event has been queued for processing:

json
{
  "eventId": "evt_abc123def456",
  "sessionId": "sess_xyz789"
}
FieldTypeDescription
eventIdstringUnique identifier for the ingested event
sessionIdstringThe session this event was associated with

Event processing

Ingested events are processed asynchronously:

  1. The raw event is stored immediately
  2. Associated blobs (diffs, content) are uploaded to storage
  3. The event is linked to an existing session or a new session is created (sessions have a 4-hour window)
  4. Events remain as raw data until enrichment is triggered

Enrichment is triggered separately via the session enrich endpoint.

Error responses

StatusErrorCause
400Invalid request bodyMalformed JSON or missing required fields
401Invalid signatureHMAC signature verification failed
401Timestamp expiredTimestamp older than 5 minutes
404Project not foundInvalid project ID
429Rate limit exceededToo many requests

Next steps