Ask endpoints
Create a question, wait for the answer with long polling, cancel it, and receive the signed callback.
These endpoints push a question to a device and hand the answer back. For a guided introduction and the MCP tools, see Ask and wait for an answer.
| Method | Path | What it does |
|---|---|---|
POST | /ask | Create a question and push it |
GET | /ask/{question_id} | Read the question, optionally waiting for the answer |
DELETE | /ask/{question_id} | Cancel the question |
POST /ask
Creates a question and pushes it to the device as a time-sensitive notification. Accepts JSON, form data, or query parameters. Query parameters win over the body. Counts as one push.
Prop
Type
curl https://opu.sh/ask \
-H "Content-Type: application/json" \
-d '{"device_key":"YOUR_KEY","title":"Merge PR #42?","options":["Merge","Close"],"callback_url":"https://example.com/opush"}'Response: 201 Created
{
"question_id": "q_aLvBJaVvMvbingXOp9eapf",
"answer_url": "https://opu.sh/ask/q_aLvBJaVvMvbingXOp9eapf",
"expires_at": "2026-11-04T10:30:00Z",
"callback_secret": "ocs_…"
}| Field | Description |
|---|---|
question_id | q_ plus 22 characters. It's also the secret for reading the answer. |
answer_url | Where to GET or DELETE the question |
expires_at | When the question expires |
callback_secret | Only when you passed callback_url. Use it to check the callback signature. |
GET /ask/{question_id}
Returns the question. With wait, the request stays open until the status is no longer pending or the time runs out.
| Query | Description |
|---|---|
wait | Seconds to wait, 0 to 50. Default 0 (reply right away). |
Response: 200 OK
{
"question_id": "q_aLvBJaVvMvbingXOp9eapf",
"status": "answered",
"title": "Merge PR #42?",
"body": null,
"options": ["Merge", "Close"],
"allow_text": false,
"created_at": "2026-11-04T09:30:00Z",
"expires_at": "2026-11-04T10:30:00Z",
"answer": { "option": "Merge", "option_index": 0, "text": null, "answered_at": "2026-11-04T09:30:41Z" }
}| Field | Description |
|---|---|
status | pending, answered, expired, or cancelled |
answer | null until answered. Otherwise option and option_index (both null for a text-only answer), text (null if none), and answered_at. |
Only the first answer is accepted. Questions are deleted 30 days after they were asked (once they have ended), and then return 404.
DELETE /ask/{question_id}
Cancels a pending question and removes its notification from the phone. Returns the question in the same format as GET. If the question had already ended, nothing changes and you get its current state.
Callback
When the question is answered, Opush sends one POST to callback_url:
POST /opush HTTP/1.1
Content-Type: application/json
User-Agent: Opush/1.0
X-Opush-Signature: sha256=5c1f…
{"question_id":"q_…","status":"answered","title":"Merge PR #42?", …}- The body is the same JSON as
GET /ask/{question_id}. X-Opush-Signatureissha256=plus the hex HMAC-SHA256 of the raw body, keyed withcallback_secret. Compare it in constant time. Examples are in Ask and wait.- It's sent once with a 10-second timeout and isn't retried. If you miss it, poll
GET /ask/{question_id}. - Expired and cancelled questions don't trigger a callback.
Errors
{ "error": { "code": "invalid_request", "message": "at most 4 options" } }| Status | Code | When |
|---|---|---|
400 | invalid_request | Missing device_key or title, invalid options, no options and no allow_text, timeout out of range, invalid callback_url, or a body that isn't a JSON object |
401 | Enterprise server with Basic Auth, without credentials (push response format) | |
404 | not_found | Unknown device key or question |
429 | rate_limited | Too many pushes. Wait for Retry-After |
503 | device_unreachable | The device can't be reached (open Opush on it) |
503 | upstream_error | The push failed, or the server is busy |