NeuroAPI
API referenceAsk the agent POST

Ask the agent

Send a market research question and get the answer as one JSON document, or as a server-sent event (SSE) stream when stream=true.

Defaults: mode=smart, stream=false. In a stream (text/event-stream), each event is one JSON object with a type, and the next answer text is in data.answer.chunk.content. A successful stream ends with data: [DONE]\n\n. If the run fails before the answer is complete, the last event is {"type":"error","message":"agent run failed"}, no [DONE] follows, and the call isn't billed.

Optional system_prompt adds to the agent's instructions (it never overrides its persona or safety guardrails). Optional output_schema (a JSON Schema) makes the agent return a validated object in output (answer is then null, so exactly one is set); it requires stream=false.

Every response carries an X-Request-Id header that matches request_id in the response body. Quote it when reporting issues.

POST/agent/ask

Authorization

APIKeyHeader
X-API-Key<token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.neurobro.ai/api/v1/agent/ask" \  -H "Content-Type: application/json" \  -d '{    "mode": "smart",    "prompt": "Summarize the latest macroeconomic outlook for the eurozone.",    "stream": false  }'
{
  "answer": "The European Central Bank held rates steady ...",
  "mode": "smart",
  "request_id": "8b3a2f0e-1d7e-4c6b-9b2a-f5e23a1c9d44",
  "usage": {
    "cached_tokens": 80,
    "completion_tokens": 256,
    "cost_units": 2,
    "prompt_tokens": 124
  }
}
{
  "detail": {
    "code": "mode_not_in_plan",
    "message": "Mode 'max' is not available on the 'starter' plan. Upgrade to access it."
  }
}
{
  "detail": "Invalid API key"
}
{
  "detail": {
    "code": "mode_not_in_plan",
    "message": "Mode 'max' is not available on the 'starter' plan. Upgrade to access it."
  }
}
{
  "detail": {
    "code": "mode_not_in_plan",
    "message": "Mode 'max' is not available on the 'starter' plan. Upgrade to access it."
  }
}
{
  "detail": {
    "code": "mode_not_in_plan",
    "message": "Mode 'max' is not available on the 'starter' plan. Upgrade to access it."
  }
}
{
  "detail": {
    "code": "mode_not_in_plan",
    "message": "Mode 'max' is not available on the 'starter' plan. Upgrade to access it."
  }
}
{
  "detail": {
    "code": "mode_not_in_plan",
    "message": "Mode 'max' is not available on the 'starter' plan. Upgrade to access it."
  }
}
{
  "detail": {
    "code": "mode_not_in_plan",
    "message": "Mode 'max' is not available on the 'starter' plan. Upgrade to access it."
  }
}
{
  "detail": "Invalid API key"
}
{
  "detail": {
    "code": "mode_not_in_plan",
    "message": "Mode 'max' is not available on the 'starter' plan. Upgrade to access it."
  }
}