{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/roku/json-schema/roku-personal-access-token-created-schema.json",
  "title": "PersonalAccessTokenCreated",
  "description": "Response when a new PAT is created - includes the actual token",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/roku-personal-access-tokens-api-openapi.yml#/components/schemas/PersonalAccessTokenCreated",
  "properties": {
    "token": {
      "type": "string",
      "maxLength": 2048,
      "minLength": 1,
      "title": "Token",
      "description": "The actual token - save this, it won't be shown again!"
    },
    "token_info": {
      "$ref": "#/$defs/PersonalAccessTokenOut"
    }
  },
  "type": "object",
  "required": [
    "token",
    "token_info"
  ],
  "$defs": {
    "PersonalAccessTokenOut": {
      "properties": {
        "id": {
          "type": "integer",
          "title": "Id",
          "description": "The unique identifier of the personal access token"
        },
        "name": {
          "type": "string",
          "maxLength": 255,
          "minLength": 3,
          "title": "Name",
          "description": "A descriptive name for the token"
        },
        "description": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "minLength": 0
            },
            {
              "type": "null"
            }
          ],
          "title": "Description",
          "description": "Optional description for the token"
        },
        "scopes": {
          "items": {
            "type": "string",
            "maxLength": 255,
            "minLength": 3,
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
          },
          "type": "array",
          "title": "Scopes",
          "description": "List of scopes that define the token's permissions"
        },
        "version": {
          "type": "integer",
          "title": "Version",
          "description": "Version number of the token format"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At",
          "description": "When the token was created"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "title": "Expires At",
          "description": "When the token expires"
        },
        "last_used_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Used At",
          "description": "When the token was last used"
        },
        "revoked_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Revoked At",
          "description": "When the token was revoked, if applicable"
        },
        "status": {
          "$ref": "#/$defs/PersonalAccessTokenStatus",
          "readOnly": true
        }
      },
      "type": "object",
      "required": [
        "id",
        "name",
        "scopes",
        "version",
        "created_at",
        "expires_at",
        "status"
      ],
      "title": "PersonalAccessTokenOut"
    },
    "PersonalAccessTokenStatus": {
      "type": "string",
      "enum": [
        "active",
        "expired",
        "revoked"
      ],
      "title": "PersonalAccessTokenStatus"
    }
  }
}