REST API Reference

The Threadline REST API lets you manage persistent context for any user from any runtime. Every endpoint is authenticated with a bearer token.

Base URL & Auth

All requests are made to https://api.threadline.to and require a bearer token in the Authorization header.

curl https://api.threadline.to/v1/inject \
  -H "Authorization: Bearer tl_live_..." \
  -H "Content-Type: application/json"

Endpoints

POST/v1/inject

Build an enriched system prompt from a user's stored context.

POST/v1/update

Persist new facts and conversational turns into the user's context.

GET/v1/context/:userId

Retrieve the full structured context object for a user.

POST/v1/grants

Issue a scoped, time-bound grant to another agent or tool.

DELETE/v1/grants/:grantId

Revoke a grant immediately.

Example: Inject

POST /v1/inject
{
  "userId": "user_42",
  "basePrompt": "You are a helpful assistant."
}

// Response
{
  "injectedPrompt": "You are a helpful assistant.\n\nKnown facts about user_42:\n- Prefers concise replies\n- Lives in Berlin"
}

Example: Update

POST /v1/update
{
  "userId": "user_42",
  "userMessage": "I just moved to Lisbon.",
  "agentResponse": "Got it — welcome to Lisbon!"
}