Skip to article
CogniTech.Docs

Internal HTTP API

Implemented same-origin authentication, conversation, strategy and market routes.

On this page

Common request and error conventions

These Route Handlers serve the CogniTech application. They are not versioned public third-party endpoints. Routes scoped to chat or strategies require a valid session cookie and matching x-cogni-wallet header. JSON mutations use application/json, validate request shape and enforce same-origin where specified. Path identifiers for persisted records are UUIDs. Error bodies use error.code and error.message. Invalid input is 400; unauthenticated is 401; origin rejection is 403; missing owned records are 404; conflicts can be 409; payload and rate limits can return 413 and 429; unavailable services may return 503.

http
POST /api/auth/nonce HTTP/1.1
Origin: http://localhost:3000
Content-Type: application/json

{"address":"<connected Elysium wallet address>"}
json
{"error":{"code":"sign_in_required","message":"Verify the connected wallet to access this chat."}}

Authentication

Method and pathInputResult
POST /api/auth/nonceaddressmessage containing the challenge to sign
POST /api/auth/verifymessage, signaturewallet, aiConfigured, maxMessageLength and session cookie
GET /api/auth/sessionexisting cookie if presentwallet or null, aiConfigured, maxMessageLength
POST /api/auth/logoutsame-origin requestok and revoked session cookie

Conversation and action routes

In this table, S is /api/chat/sessions and :id is a session UUID. Message and action IDs are independently scoped.

Method and pathInputResult
GET Sq and optional cursor from the previous responseOwned sessions and next cursor
POST SrequestId; optional imported user-message arrayNew or reused session
GET S/:idpath IDSession metadata
PATCH S/:idtitleUpdated session metadata
DELETE S/:idpath IDDeletion acknowledgment
GET S/:id/messagesoptional before sequence cursorOrdered messages and pagination
POST S/:id/messagesrequestId, message, optional timezone, local, regenerate UUIDNDJSON turn or existing request state as JSON
PATCH S/:id/messages/:messageId/feedbackfeedback positive, negative, or nullFeedback acknowledgment
PATCH /api/chat/actions/:actionIdstatus awaiting_review, cancelled, confirmed, failed or interruptedUpdated status; invalid transitions can conflict
json
{"requestId":"9da52e9c-b62e-4a1f-8a45-de83f030aff3","message":"Explain a Merkle root.","timezone":"UTC"}

Strategy routes

T is /api/strategies. The strategy ID is a path UUID. Edits and run mutations are subject to origin and rate checks.

Method and pathInputResult
GET TnoneOwned strategy summaries
POST TrequestId, optional registered templateStrategy ID, 201
GET T/:idpath IDOwned graph and revision
PATCH T/:idrevision and graph or nameSaved graph state; stale revisions can return 409
DELETE T/:idpath IDok
POST T/generaterequestId and promptNew strategy ID and optional message, 201
POST T/:id/assistprompt and checked graphStructured proposal or explanation
POST T/:id/duplicaterequestIdCopy ID, 201
GET / POST T/:id/versionsGET none; POST revisionVersion list or checkpoint ID, 201 for creation
POST T/:id/restorerevision and version UUIDRestored draft state
GET / POST T/:id/runsGET none; POST revision and optional nodeRun list or new run ID, 201 for creation
PATCH T/:id/runsstep event with run, node, order and status, or end event with run and statusok
GET T/quoteasset BTC, ETH or SOLValidated timestamped quote
POST T/:id/analyzetype research/analysis/decision, asset BTC/ETH/SOL or empty, topic, web, options array, and nullable public price or research contextNDJSON tool/progress and result or error
json
{"type":"step","run":"8c2d9a49-2b4c-4c44-8ac3-558d8076af43","node":"start","order":0,"status":"passed"}

See stream framing and database architecture.