Wait for OTP
Use this skill when an AI agent has triggered an OTP-bearing email (e.g. by submitting a sign-up or login form) and needs to read the code before it expires.
When to use
- Agent just requested an OTP via a sign-up or 2FA flow
- Agent needs to extract a numeric or alphanumeric code from incoming email
- You want to avoid writing polling logic
Prerequisites
- A Lumbox inbox ID (see the
create-lumbox-inboxskill) - The inbox address must have been provided to the service that sends the OTP
LUMBOX_API_KEYenvironment variable set
Steps
Call the long-poll endpoint. Lumbox holds the connection open until an OTP arrives, then returns it:
curl "https://api.lumbox.co/v1/inboxes/$INBOX_ID/otp?timeout=60" \ -H "X-API-Key: $LUMBOX_API_KEY"The
timeoutquery param controls max wait time in seconds (default 30, max 120).Read the response. The API returns the extracted code and the email it came from:
{ "otp": "847291", "email_id": "eml_9a2b...", "received_at": "2026-04-18T10:30:22.123Z" }Use the code. Submit
otpinto the form/API field that's waiting for it.
Tips
- If
timeoutelapses with no email, the endpoint returns204 No Content. Re-call to extend the wait. - Lumbox extracts codes via regex tuned for 4-8 digit numeric, alphanumeric, and format-with-dash codes.
- For magic links instead of OTPs, call
/v1/inboxes/:id/waitand read the parsed links. - Backup codes and expiry timestamps are also extracted into the email record.
Related skills
create-lumbox-inbox- provision the inbox firstsend-email- reply to the OTP sender or confirm receipt