{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/onplana-com/json-schema/onplana-com-api-token-schema.json",
  "title": "ApiToken",
  "description": "A Personal Access Token (PAT) for programmatic API access.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/onplana-com-openapi.json#/components/schemas/ApiToken",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string",
      "description": "Human-readable label for this token"
    },
    "tokenPrefix": {
      "type": "string",
      "description": "First 12 chars of the token (e.g. \"pat_AbCdEfGh\") - safe to display"
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "PROJECTS_READ",
          "PROJECTS_WRITE",
          "TASKS_READ",
          "TASKS_WRITE",
          "MEMBERS_READ",
          "WEBHOOKS_MANAGE",
          "TIMESHEETS_READ",
          "TIMESHEETS_WRITE",
          "COMPLIANCE_READ",
          "REPORTS_READ",
          "AUDIT_READ",
          "PLAYGROUND_READ",
          "PLAYGROUND_WRITE",
          "MCP_AGENT",
          "WILDCARD"
        ]
      }
    },
    "organizationId": {
      "type": "string",
      "format": "uuid"
    },
    "orgPlan": {
      "type": "string",
      "description": "Plan snapshot at creation time"
    },
    "expiresAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "lastUsedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "organization": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        }
      }
    }
  },
  "required": [
    "id",
    "name",
    "tokenPrefix",
    "scopes",
    "organizationId",
    "createdAt"
  ]
}