API Reference
The Nexus REST API lets you ingest traces and spans from any language or framework. No SDK required — every endpoint accepts plain JSON over HTTPS.
https://nexus.keylightdigital.dev
Authentication
Required on all /api/v1/* endpoints
Pass your API key as a Bearer token in the Authorization header on every request.
Authorization: Bearer nxs_a1b2c3d4e5f6...
Getting an API key
- Create a free account — no credit card required
- Go to Dashboard → API Keys
- Click Create new key and give it a name
- Copy the key — it is shown exactly once
- Store it in your environment:
NEXUS_API_KEY=nxs_...
Rate Limits & Plan Limits
Limits reset on the 1st of each calendar month (UTC)
| Limit | Free | Pro ($9/mo) |
|---|---|---|
| Traces / month | 1,000 | 50,000 |
| Agents | 1 | Unlimited |
| Trace retention | 30 days | 90 days |
| Email alerts (error / timeout) | — | Included |
Rate limit responses
429 Too Many Requests — monthly trace limit reached:
{
"error": "Monthly trace limit reached. Upgrade to Pro.",
"limit": 1000,
"current": 1001,
"upgrade_url": "/dashboard/billing"
}
403 Forbidden — agent limit reached (Free plan):
{
"error": "Free plan limited to 1 agent",
"upgrade_url": "/dashboard/billing"
}
Error Codes
All error responses include a JSON body with an error field
| Code | Meaning | Example response |
|---|---|---|
| 400 | Invalid request — missing or malformed fields | {"error":"Validation failed","fields":{"agent_id":"Required"}} |
| 401 | Missing, invalid, or revoked API key | {"error":"Invalid API key"} |
| 403 | Plan limit reached (agent count on Free plan) | {"error":"Free plan limited to 1 agent","upgrade_url":"/dashboard/billing"} |
| 404 | Trace not found or not owned by this key | {"error":"Trace not found"} |
| 429 | Monthly trace limit reached | {"error":"Monthly trace limit reached...","limit":1000,"current":1001} |
| 500 | Internal server error — transient, safe to retry | {"error":"Internal server error"} |
/api/v1/traces
Create a new trace. Agents are auto-created on first use — no separate registration step required.
Requires authentication · Returns 201 Created
Request body
{
"agent_id": "my-assistant",
"name": "user-query-2026-04-06",
"status": "running",
"started_at": "2026-04-06T12:00:00Z",
"ended_at": null,
"metadata": { "user_id": "u_123" }
}
Response 201
{
"trace_id": "f47ac10b-58cc-4372-..."
}
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
| agent_id | string | Yes | Your agent's identifier (e.g. my-assistant). Auto-created on first use. |
| name | string | Yes | Human-readable trace name — the task or query being handled. |
| status | string | Yes | running · success · error · timeout |
| started_at | string | Yes | ISO 8601 timestamp — 2026-04-06T12:00:00Z |
| ended_at | string | null | No | ISO 8601 end timestamp. Omit or set null while trace is running. |
| metadata | object | null | No | Arbitrary JSON — stored and displayed in trace viewer. |
curl example
curl -s -X POST https://nexus.keylightdigital.dev/api/v1/traces \
-H "Authorization: Bearer $NEXUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "my-assistant",
"name": "user-query",
"status": "running",
"started_at": "2026-04-06T12:00:00Z"
}'
# Response
# {"trace_id":"f47ac10b-58cc-4372-..."}
Error responses
/api/v1/traces/:trace_id/spans
Add a span to an existing trace. Spans represent individual sub-steps — LLM calls, tool uses, sub-agent invocations, or any discrete unit of work.
Requires authentication · Returns 201 Created
Request body
{
"name": "llm-call",
"status": "ok",
"started_at": "2026-04-06T12:00:01Z",
"ended_at": "2026-04-06T12:00:02Z",
"input": { "prompt": "Summarize this..." },
"output": { "text": "Here is a summary..." },
"error": null,
"parent_span_id": null
}
Response 201
{
"span_id": "a1b2c3d4-e5f6-..."
}
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Span label — e.g. llm-call, tool-use, retrieval |
| status | string | Yes | ok · error |
| started_at | string | Yes | ISO 8601 timestamp |
| ended_at | string | null | No | ISO 8601 end timestamp |
| input | any | null | No | Arbitrary JSON — prompt text, tool arguments, etc. |
| output | any | null | No | Arbitrary JSON — model response, tool result, etc. |
| error | string | null | No | Error message string when status is error |
| parent_span_id | string | null | No | ID of a parent span — enables nested waterfall display |
curl example
curl -s -X POST https://nexus.keylightdigital.dev/api/v1/traces/TRACE_ID/spans \
-H "Authorization: Bearer $NEXUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "llm-call",
"status": "ok",
"started_at": "2026-04-06T12:00:01Z",
"ended_at": "2026-04-06T12:00:02Z",
"input": { "prompt": "Summarize this document" },
"output": { "text": "Here is the summary..." }
}'
# Response
# {"span_id":"a1b2c3d4-e5f6-..."}
Error responses
/api/v1/traces/:trace_id
Finalize a trace — update its status and set the end time. All fields are optional; only provided fields are updated.
Requires authentication · Returns 200 OK · Triggers Pro email alert on error/timeout
Request body
{
"status": "success",
"ended_at": "2026-04-06T12:00:05Z"
}
Response 200
{
"ok": true
}
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
| status | string | No | running · success · error · timeout |
| ended_at | string | null | No | ISO 8601 end timestamp |
curl example
curl -s -X PATCH https://nexus.keylightdigital.dev/api/v1/traces/TRACE_ID \
-H "Authorization: Bearer $NEXUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"status": "success", "ended_at": "2026-04-06T12:00:05Z"}'
# Response
# {"ok":true}
Error responses
/api/v1/traces/:trace_id
Retrieve a trace by ID, including all its spans. Useful for verifying ingestion or building custom UIs.
Requires authentication · Returns 200 OK
Response 200
{
"id": "f47ac10b-58cc-4372-...",
"agent_id": "my-assistant",
"name": "user-query-2026-04-06",
"status": "success",
"started_at": "2026-04-06T12:00:00Z",
"ended_at": "2026-04-06T12:00:05Z",
"metadata": { "user_id": "u_123" },
"spans": [
{
"id": "a1b2c3d4-...",
"name": "llm-call",
"status": "ok",
"started_at": "2026-04-06T12:00:01Z",
"ended_at": "2026-04-06T12:00:02Z",
"input": { "prompt": "..." },
"output": { "text": "..." },
"error": null,
"parent_span_id": null
}
]
}
curl example
curl -s https://nexus.keylightdigital.dev/api/v1/traces/TRACE_ID \ -H "Authorization: Bearer $NEXUS_API_KEY" # Returns the full trace object with spans array
Error responses
/health
Health check endpoint. No authentication required. Returns 200 OK when the service is up.
Public · No authentication required · Returns 200 OK
Response 200
{
"status": "ok"
}
curl example
curl -s https://nexus.keylightdigital.dev/health
# Response
# {"status":"ok"}
API Playground
Try the API directly from your browser. Enter your API key, pick an endpoint, and hit Send.
Your key is stored in sessionStorage — cleared automatically when you close the tab.
Create a trace first with POST /api/v1/traces, then paste the id from the response here.