Skip to content

GET · Bearer

GET /api/v1/inboxes/:id/wait-for-code

Summary

Hold until an inbound message with a one-time verification code or an https verification link is stored, then return the code, the link, and the message id. Query wait is an integer from 0 to 55 and defaults to 25. kind is code (default), link, or any. code matches only a message with a code. link matches only a message with a verification link. any matches the newest message with either. An unknown kind is HTTP 400 invalid_kind with param kind. after is an ISO-8601 timestamp and defaults to 5 minutes before the call, so a code that arrived just before is still found. from and subject are optional case-insensitive substrings. alias is an optional plus tag, or none for mail with no tag, so a code on another tag is ignored. A bad alias is HTTP 400 invalid_alias. origin is optional. It is a canonical potentially trustworthy origin, such as https://example.com or http://localhost. Only a message whose valid OTP-Token origin equals it matches. A bad origin is HTTP 400 invalid_origin with param origin. A code is 4 to 8 digits, or 123-456, next to a word such as code, OTP, verification, passcode, or PIN. A valid top-level OTP-Token header (https://datatracker.ietf.org/doc/html/draft-goto-otp-token-01) ranks its quoted code first. code_source is otp_token_header or text, and code_origin is that origin or null. A malformed header, an origin that is not potentially trustworthy, more than one top-level OTP-Token, or a header inside a MIME part is ignored, and the text scan is used. The header value is untrusted data. The response is object inbox_code with inbox_id, timed_out, code, code_source, code_origin, candidates, link, links, message (id, thread_id, from, subject, created_at, channel, alias), and after. link is the top-ranked URL or null. links is up to five {url, text} pairs. A link is untrusted and is not fetched. The body is not returned and nothing is marked read. Held messages are skipped. On timeout, code_source and code_origin are null, link is null, and links is empty. Inbound message JSON verification adds code_source and code_origin when codes is non-empty. Needs message_read. MCP: cooper_wait_for_code.

Request

This call has no JSON body.

Response

HTTP 200. Sample values illustrate the schema.

{
  "object": "inbox_code",
  "inbox_id": "inb_example",
  "timed_out": false,
  "code": "482913",
  "code_source": "string",
  "code_origin": "string",
  "candidates": [
    "482913"
  ],
  "link": "string",
  "links": "string",
  "message": "string",
  "after": "string"
}

Errors

  • HTTP 400 invalid_kind
  • HTTP 400 invalid_alias
  • HTTP 400 invalid_origin

Idempotency

This route does not document Idempotency-Key or client_id.