{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/layout-link/json-schema/layout-link-user-schema.json",
  "title": "User",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/layout-link-openapi.json#/components/schemas/User",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/UserId"
    },
    "status": {
      "type": "string"
    },
    "next": {
      "description": "The next step for this person. `verify`: a new number, or one whose only Layout account another application's verify made; a good verify code makes or joins the person's account. `connect`: the person signs in to Layout on this number themselves and you asked to deliver the link; send them to `connect.connectUrl`. `awaiting_user_approval`: the person signs in to Layout on this number themselves, and Layout texted them the approval link. `connected`: already connected, start building.",
      "type": "string",
      "enum": [
        "verify",
        "connect",
        "awaiting_user_approval",
        "connected"
      ]
    },
    "connect": {
      "description": "Present only when `next` is `connect`.",
      "type": "object",
      "properties": {
        "connectUrl": {
          "type": "string",
          "format": "uri"
        },
        "expiresInSec": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "connectUrl",
        "expiresInSec"
      ]
    },
    "awaitingApproval": {
      "description": "Present only when `next` is `awaiting_user_approval`.",
      "type": "object",
      "properties": {
        "phoneHint": {
          "type": "string"
        },
        "expiresInSec": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "expiresInSec"
      ]
    },
    "session": {
      "description": "Carries no token and authenticates nothing. Mint a build grant with POST /users/{userId}/grant.",
      "type": "object",
      "properties": {
        "scope": {
          "type": "string",
          "const": "build"
        },
        "expiresIn": {
          "description": "Seconds the build session lasts.",
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "scope",
        "expiresIn"
      ]
    },
    "handoffUrl": {
      "deprecated": true,
      "description": "Deprecated since 2026-10-21 and kept for older integrations. Do not send anyone here: verify the person with POST /users/{userId}/verify/start and POST /users/{userId}/verify, which makes their Layout account.",
      "type": "string",
      "format": "uri"
    }
  },
  "required": [
    "id",
    "status",
    "next",
    "session",
    "handoffUrl"
  ],
  "$defs": {
    "UserId": {
      "type": "string",
      "pattern": "^usr_[a-f0-9]{8,32}$"
    }
  }
}