Quickstart: curl
Ask a human from any language with two HTTP calls: create the ask, then wait for the decision.
Everything here is plain HTTPS and JSON against https://api.logu.dev.
1. Get an API key#
Create an agent in the Logu app (Agents): its first API key (lg_…) is shown once. While you
build, use a test API key (lg_test_…, the agent's menu → Add a test API key): it works the
same, but nobody's phone is notified.
export LOGU_API_KEY=lg_...
curl -s https://api.logu.dev/v1/me -H "Authorization: Bearer $LOGU_API_KEY"
GET /v1/me says which agent and workspace the API key is, whether it's a test API key, and its
limits.
2. Ask#
curl -s https://api.logu.dev/v1/asks \
-H "Authorization: Bearer $LOGU_API_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: deploy-4821" \
-d '{"project":"shop","title":"Deploy v1.4 to production?","body":"3 commits since v1.3",
"timeoutSeconds":3600,"defaultOption":"decline"}'
The answer (201) is the ask, waiting, with its id (ask_…). The workspace's Owners and
Deciders get it by push, browser notifications, email, Telegram, Slack and WhatsApp (each one they turned on). defaultOption: "decline"
makes it fail closed: if nobody decides within timeoutSeconds, it's declined.
3. Wait for the decision#
curl -s "https://api.logu.dev/v1/asks/ask_.../wait?timeout=50" \
-H "Authorization: Bearer $LOGU_API_KEY"
Each call waits up to 50 seconds. Repeat while status is waiting; then proceed only if
status is decided, decision.optionId is approve and decision.decidedVia is not timeout (a
default option applied because nobody answered is never an approval):
while :; do
ask=$(curl -s "https://api.logu.dev/v1/asks/$ID/wait?timeout=50" -H "Authorization: Bearer $LOGU_API_KEY")
[ "$(echo "$ask" | jq -r .status)" != "waiting" ] && break
done
echo "$ask" | jq -e '.status == "decided" and .decision.optionId == "approve" and .decision.decidedVia != "timeout"' >/dev/null && ./deploy.sh
4. Events and metrics#
curl -s https://api.logu.dev/v1/events -H "Authorization: Bearer $LOGU_API_KEY" \
-H "Content-Type: application/json" -d '{"project":"shop","title":"Deploy finished","icon":"🚀"}'
curl -s https://api.logu.dev/v1/metrics -H "Authorization: Bearer $LOGU_API_KEY" \
-H "Content-Type: application/json" -d '{"project":"shop","metric":"orders","value":42}'
Next#
- Every operation, with examples: API reference.
- When something goes wrong, branch on
error.code: Errors. - A server that should hear about every ask and event: Webhooks.