> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gork.email/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Message Verification

> Retrieve the OTP code or magic verification link detected in an inbound message.

Gorkmail automatically analyzes every inbound email (after Agent Shield sanitization) for verification signals: one-time codes and verification links that services send during account signup, login, or password reset. This endpoint returns the structured result so your agent can complete verification without parsing raw email bodies.

### Response

<ResponseField name="data" type="object">
  <ResponseField name="messageId" type="string">
    The message the verification was detected in (`msg_...`).
  </ResponseField>

  <ResponseField name="type" type="string">
    `otp`, `magic_link`, or `otp_and_magic_link`.
  </ResponseField>

  <ResponseField name="confidence" type="string">
    `high` (trigger keyword adjacent to the code/link) or `medium`.
  </ResponseField>

  <ResponseField name="otp" type="object">
    <ResponseField name="code" type="string">
      The extracted one-time code (4–8 characters, numeric or alphanumeric).
    </ResponseField>

    <ResponseField name="expiresAt" type="string">
      ISO 8601 expiry derived from phrasing like "expires in 10 minutes", when present.
    </ResponseField>

    <ResponseField name="providerHint" type="string">
      Sending domain of the verification email (e.g. `github.com`).
    </ResponseField>
  </ResponseField>

  <ResponseField name="magicLink" type="object">
    <ResponseField name="url" type="string">
      The verification/confirmation URL extracted from the email.
    </ResponseField>

    <ResponseField name="expiresAt" type="string">
      ISO 8601 expiry, when the email states one.
    </ResponseField>

    <ResponseField name="providerHint" type="string">
      Sending domain of the verification email.
    </ResponseField>
  </ResponseField>

  <ResponseField name="evidence" type="object">
    <ResponseField name="subject" type="string">
      Subject line of the message.
    </ResponseField>

    <ResponseField name="keyword" type="string">
      The trigger phrase that matched (e.g. `verification code`).
    </ResponseField>
  </ResponseField>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET https://api.gork.email/v1/messages/msg_908123acdf/verification \
    -H "Authorization: Bearer gork_live_YOUR_KEY"
  ```

  ```typescript TypeScript theme={null}
  import { GorkClient } from "@gork/sdk"

  const client = new GorkClient({ apiKey: process.env.GORK_API_KEY })

  const verification = await client.messages.getVerification("msg_908123acdf")

  if (verification.type === "otp") {
    console.log("OTP code:", verification.otp?.code)
    // → "728491"
  }
  ```

  ```python Python theme={null}
  from gork import GorkClient

  client = GorkClient()  # reads GORK_KEY / GORK_API_KEY

  verification = client.get_message_verification("msg_908123acdf")
  print(verification["otp"]["code"])
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "data": {
      "messageId": "msg_908123acdf",
      "type": "otp",
      "confidence": "high",
      "otp": {
        "code": "728491",
        "expiresAt": "2026-09-08T13:04:56.789Z",
        "providerHint": "github.com"
      },
      "evidence": {
        "subject": "[GitHub] Please verify your device",
        "keyword": "verification code"
      }
    }
  }
  ```
</ResponseExample>

<Note>
  Detection runs on **sanitized** content — prompt-injection payloads, zero-width characters, and hidden text are stripped by Agent Shield *before* verification analysis, so a cloaked or spoofed code cannot poison the result. Unsubscribe links and social share links are explicitly excluded from magic-link detection.
</Note>

<Warning>
  Returns `404 verification_not_found` when the message has no detectable verification signal. Auto-replies (out-of-office etc.) never carry verification data.
</Warning>
