Asks · waitForAsk
Wait for the decision (long-poll)
GET /v1/asks/{id}/wait
Holds the request until the ask settles, or for timeout seconds (at most 50), then returns the ask either way. Waiting never changes the ask's expiry. A workspace holds at most 150 waits open at once (5 per ask): over that, the answer is immediate, waiting, with a Retry-After header. A hub that can't take the wait answers 503 overloaded with Retry-After; nothing is lost.
- Who may call it
- Agents (API key); humans: every member
- Server
- https://api.logu.dev
Parameters#
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | required | The ask's id (ask_…). · e.g. ask_01K7DQ3M2V8H4N6R9T1W3Y5B7C |
timeout | query | integer | optional | Seconds to hold the request while the ask is waiting (1–50). · e.g. 50 |
Logu-Workspace | header | string | optional | Humans only: the workspace to act in (default: your personal workspace). Agents always act in their API key's workspace. · e.g. wsp_01K7D7Y8Z0B2D4F6H8K0M2P4R6 |
Example#
curl -s "https://api.logu.dev/v1/asks/ask_01K7DQ3M2V8H4N6R9T1W3Y5B7C/wait" \
-H "Authorization: Bearer $LOGU_API_KEY"
Responses#
200
The ask: settled, or still waiting when the wait ran out.
Response fields
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | required | |
project | string | required | |
channel | string | null | required | |
title | string | required | |
body | string | null | required | |
icon | string | null | required | |
url | string | null | required | |
options | AskOption[] | required | |
options[].id | string | required | 1–64 chars · pattern ^[a-z0-9][a-z0-9._-]*$ |
options[].label | string | required | 1–64 chars |
options[].style | "primary" | "danger" | "default" | required | |
allowText | boolean | required | |
status | "waiting" | "decided" | "timed_out" | "withdrawn" | required | |
decision | Decision | null | required | |
decision.optionId | string | null | required | |
decision.text | string | null | required | |
decision.decidedVia | "app" | "link" | "telegram" | "slack" | "whatsapp" | "rule" | "timeout" | required | |
decision.decidedAt | string | required | date-time |
decision.decidedBy | MemberRef | null | required | |
decision.decidedBy.id | string | required | |
decision.decidedBy.name | string | required | |
decision.ruleId | string | null | optional | |
defaultOption | string | null | optional | Applied as the decision if nobody decides before expiresAt (then decision.decidedVia is timeout: never an approval); null: it ends timed_out. Agents can't set an approving one (id approve or style primary) on new asks. |
expiresAt | string | required | date-time |
createdAt | string | required | date-time |
metadata | object | null | required | Free-form context stored with the item, up to 8,192 characters of JSON. thread (a short string, such as a Claude Code session id or a Codex thread id) is the one key Logu reads: events that share it are shown together as one thread in the app. |
agent | AgentRef | null | required | |
agent.id | string | required | |
agent.name | string | required | |
attachments | Attachment[] | required | Its images, in order, each with a signed url that works for about an hour. |
attachments[].id | string | required | |
attachments[].url | string | required | A signed link to the image that works without credentials for about an hour (re-read the ask or event for a fresh one). Members can always fetch it with GET /v1/attachments/{id}. |
attachments[].contentType | "image/png" | "image/jpeg" | "image/webp" | "image/gif" | required | |
attachments[].size | integer | required | Bytes. |
attachments[].width | integer | null | required | Pixels, when Logu could read them from the image's header. |
attachments[].height | integer | null | required | Pixels, when Logu could read them from the image's header. |
attachments[].name | string | null | required | The file name it was uploaded with, if any (the image's alt text in the app). |
test | boolean | required | Sent with a test API key (lg_test_…): shown in the app and decided there like any other, but never delivered (no push, browser notification, email or Telegram). Its callback is sent. |
escalation | object | null | optional | |
escalation.at | string | required | date-time |
escalation.to | MemberRef[] | required | |
escalation.to[].id | string | required | |
escalation.to[].name | string | required |
Errors#
Every error is {"error":{"code","message","hint","docUrl","requestId"}}: branch on code. See Errors.
| Status | Code | Meaning |
|---|---|---|
| 400 | bad_request | The request is malformed or a field is invalid (see issues). |
| 401 | unauthorized | No credentials, or the API key or session is invalid or revoked. |
| 403 | forbidden | The caller is authenticated but may not do this (wrong role, or an API key on a human-only endpoint). |
| 403 | workspace_suspended | The workspace was suspended by Logu (usually for abuse or a violation of the terms). Its API keys and connectors stop working and nothing is delivered for it; its members can still sign in, read and export their data. |
| 404 | not_found | No such route, or the resource doesn't exist in your workspace. |
| 429 | rate_limited | This API key sent too many requests, or a human did too much too fast: sign-in attempts, workspaces created in a day, or a global daily cap on new accounts was reached. |
| 500 | internal_error | Something went wrong on Logu's side. |
| 503 | overloaded | The workspace's realtime hub is overloaded, so this request (a long-poll wait or the stream) was shed. |