---
title: "read_test_signin_code"
description: "Generated reference for the management action read_test_signin_code: its description, access metadata, payload contract, and registration status."
slug: /reference/actions/read-test-signin-code
order: 71
visibility: public
redirects_from: []
---

# read\_test\_signin\_code

Generated automatically from the [published contract sources](/cloud/reference/about/#contract-sources).

A script calls this action over HTTPS at `POST https://tzcloud.turnzero.ai/v1/read_test_signin_code`, with a bearer credential and the action's payload as the JSON body. It also accepts `GET`. An MCP connection lists this action as the tool `tzcloud_read_test_signin_code`.

OAuth access tokens and minted tokens, including the turnzero command's computer token, are bearer credentials. The action determines which kinds, scopes and grants it accepts ([Sign-in, sessions, and tokens](/cloud/concepts/sign-in-sessions-and-tokens/)).

**Build metadata:** Registered in this build. Registration describes the default dispatcher in this build. It does not guarantee that a caller has the required credential or grant, that a tool is listed for that connection, or that the required service is configured.

## Contract description

Read the unspent sign\-in codes for one of your test end users, newest first, instead of a mailbox\. First start sign\-in for that address at the realm's test sign\-in page, returned by `add_test_end_users`, or its email sign\-in page\. Without a start, no code is held\. Pass `binding` to select one start\. A code lasts ten minutes, allows five attempts and confirms only in the browser that started sign\-in\. The call works only for your account and application\. On production or `workforce` realms, a minted token needs `test_end_users`\. Your session needs none\.

## More about this action

The `environment` argument is required: pass `development` or `production`, the environment whose realm you address\. The development realm exists only after `create_environment` has turned development on\.

Under the workforce audience, a minted token reads them on a realm only with the `test_end_users` grant\. The read works while the platform's `TEST_END_USERS` setting is off\. Every read is recorded as an action, and no code is written to any record\.

An `end_user` matching no id or label is refused `no_such_end_user`\. An `email` reaching no unexpired test end user is refused `not_test_end_user`, as is a real or expired user\. Use the id, label or address returned by `add_test_end_users`; create the user afresh if expired\. While `TEST_END_USERS` is off, the read still works but no code is held\.

## Access and action metadata

```json
{
  "name": "read_test_signin_code",
  "resource": "realm",
  "tier": "observe",
  "surface": "tzcloud",
  "addresses": [
    "tzcloud"
  ],
  "product": "cloud",
  "summary": "Read the unspent emailed sign-in codes held for one test end user of one realm of your account's own application, by `end_user` or `email`, `application` and `environment` both required. They come newest first, each with its issued and expiry instants, its binding hash, and the attempts remaining. Where `binding` gives your own binding hash (base64url of the SHA-256 of the binding cookie's value), you get that one ticket's code alone. Admitted to the account's session, its account-wide token, or a token bounded to that application and to no other credential, `super_admin` widening it to no other account's application. On a production realm, and on a workforce application's realm, it admits the session and a token carrying `test_end_users`, any other minted token refused `test_end_users_not_admitted`. Refused `not_test_end_user` for a user who is not an unexpired test end user of the realm; readable while `TEST_END_USERS` reads `off`, every read one action record, and no code reaching any record.",
  "annotations": {
    "readOnlyHint": true,
    "destructiveHint": false,
    "openWorldHint": false,
    "idempotentHint": true
  }
}
```

## MCP catalog entry

```json
{
  "name": "read_test_signin_code",
  "title": "Read test sign-in code",
  "tier": "observe",
  "summary": "Read the unspent sign-in codes for one of your test end users, newest first, instead of a mailbox. First start sign-in for that address at the realm's test sign-in page, returned by `add_test_end_users`, or its email sign-in page. Without a start, no code is held. Pass `binding` to select one start. A code lasts ten minutes, allows five attempts and confirms only in the browser that started sign-in. The call works only for your account and application. On production or `workforce` realms, a minted token needs `test_end_users`. Your session needs none.",
  "owners": [
    "ACS-L0-21",
    "ACS-L0-20",
    "ACS-L0-12",
    "PLD-L0-40"
  ],
  "scenario": "ACS-L0-21"
}
```

## request

| JSON pointer | Description and constraints |
|---|---|
| "" \(root\) | Type: object<br>Required fields: \["application","environment"\]<br>Additional properties: false |
| /<wbr>properties/<wbr>application | Your account's application `id` from `list_applications`, not its name or label\.<br><br>Type: string |
| /<wbr>properties/<wbr>environment | Required\. The environment whose realm the call addresses, `development` or `production`\.<br><br>Type: string<br>Pattern: ^\(development\|production\)$ |
| /<wbr>properties/<wbr>end\_user | Test user id or label from `add_test_end_users`, or use `email`, never both; no matching id or label draws `no_such_end_user`\.<br><br>Type: string |
| /<wbr>properties/<wbr>email | Test user fixture\-domain email, lowercased; use it or `end_user`, never both\. Without an unexpired match, refused `not_test_end_user`\.<br><br>Type: string<br>Format: email |
| /<wbr>properties/<wbr>binding | Optional: your own binding hash, base64url of the SHA\-256 of the binding cookie's value the sign\-in start set, selecting that ticket's code alone; leave it out and you get every unspent code, newest first\.<br><br>Type: string |

## response

| JSON pointer | Description and constraints |
|---|---|
| "" \(root\) | Type: object<br>Required fields: \["contract\_version","realm","end\_user","codes"\]<br>Additional properties: false |
| /<wbr>properties/<wbr>contract\_version | Required value: 1 |
| /<wbr>properties/<wbr>realm | The realm identifier: the application id for production, `<id>:development` for development\.<br><br>Type: string |
| /<wbr>properties/<wbr>end\_user | The test end user the codes are held for\.<br><br>Type: string |
| /<wbr>properties/<wbr>codes | The unspent codes the route holds for the user, newest first; empty where none is held, where every code is spent or expired, or where `binding` matches no held ticket\.<br><br>Type: array |
| /<wbr>properties/<wbr>codes/<wbr>items | Type: object<br>Required fields: \["code","issued\_at","expires\_at","binding","attempts\_remaining"\] |
| /<wbr>properties/<wbr>codes/<wbr>items/<wbr>properties/<wbr>code | The six\-digit code you type on the code page\.<br><br>Type: string<br>Pattern: ^\[0\-9\]\{6\}$ |
| /<wbr>properties/<wbr>codes/<wbr>items/<wbr>properties/<wbr>issued\_at | Type: string |
| /<wbr>properties/<wbr>codes/<wbr>items/<wbr>properties/<wbr>expires\_at | The ticket's expiry, ten minutes after the start\.<br><br>Type: string |
| /<wbr>properties/<wbr>codes/<wbr>items/<wbr>properties/<wbr>binding | The ticket's binding hash, the browser that started the sign\-in\.<br><br>Type: string |
| /<wbr>properties/<wbr>codes/<wbr>items/<wbr>properties/<wbr>attempts\_remaining | The confirmations the code still admits, five at issue\.<br><br>Type: integer<br>Minimum: 0 |
| /<wbr>properties/<wbr>detail | Type: string |

## Complete payload contract

```json
{
  "request": {
    "type": "object",
    "required": [
      "application",
      "environment"
    ],
    "properties": {
      "application": {
        "type": "string",
        "description": "Your account's application `id` from `list_applications`, not its name or label."
      },
      "environment": {
        "type": "string",
        "pattern": "^(development|production)$",
        "description": "Required. The environment whose realm the call addresses, `development` or `production`."
      },
      "end_user": {
        "type": "string",
        "description": "Test user id or label from `add_test_end_users`, or use `email`, never both; no matching id or label draws `no_such_end_user`."
      },
      "email": {
        "type": "string",
        "format": "email",
        "description": "Test user fixture-domain email, lowercased; use it or `end_user`, never both. Without an unexpired match, refused `not_test_end_user`."
      },
      "binding": {
        "type": "string",
        "description": "Optional: your own binding hash, base64url of the SHA-256 of the binding cookie's value the sign-in start set, selecting that ticket's code alone; leave it out and you get every unspent code, newest first."
      }
    },
    "additionalProperties": false
  },
  "response": {
    "type": "object",
    "required": [
      "contract_version",
      "realm",
      "end_user",
      "codes"
    ],
    "properties": {
      "contract_version": {
        "const": 1
      },
      "realm": {
        "type": "string",
        "description": "The realm identifier: the application id for production, `<id>:development` for development."
      },
      "end_user": {
        "type": "string",
        "description": "The test end user the codes are held for."
      },
      "codes": {
        "type": "array",
        "description": "The unspent codes the route holds for the user, newest first; empty where none is held, where every code is spent or expired, or where `binding` matches no held ticket.",
        "items": {
          "type": "object",
          "required": [
            "code",
            "issued_at",
            "expires_at",
            "binding",
            "attempts_remaining"
          ],
          "properties": {
            "code": {
              "type": "string",
              "pattern": "^[0-9]{6}$",
              "description": "The six-digit code you type on the code page."
            },
            "issued_at": {
              "type": "string"
            },
            "expires_at": {
              "type": "string",
              "description": "The ticket's expiry, ten minutes after the start (ACS-L0-12)."
            },
            "binding": {
              "type": "string",
              "description": "The ticket's binding hash, the browser that started the sign-in."
            },
            "attempts_remaining": {
              "type": "integer",
              "minimum": 0,
              "description": "The confirmations the code still admits, five at issue (ACS-L0-12)."
            }
          }
        }
      },
      "detail": {
        "type": "string"
      }
    },
    "additionalProperties": false
  }
}
```

## Shared contracts

- [Refusals](/cloud/reference/refusals/): every refusal, by surface, with its cause and its remedy
- [schemas/wire\_error\.schema\.json](/cloud/reference/sources/schemas/wire-error-schema/)
- [schemas/wire\_errors\.json](/cloud/reference/sources/schemas/wire-errors/)
- [schemas/action\_payloads\.json](/cloud/reference/sources/schemas/action-payloads/) (includes shared shapes)
- [management\_api\_contract\.md](/cloud/reference/sources/management-api-contract/)
