{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/observeinc/json-schema/observeinc-api-token-resource-schema.json",
  "title": "ApiTokenObject",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/observeinc-service-accounts-api-openapi.yml#/components/schemas/ApiToken-Resource",
  "type": "object",
  "required": [
    "id",
    "label",
    "description",
    "expiration",
    "createdBy",
    "createdAt",
    "updatedBy",
    "updatedAt",
    "disabled"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "label": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "expiration": {
      "$ref": "#/$defs/Time"
    },
    "createdBy": {
      "$ref": "#/$defs/User"
    },
    "createdAt": {
      "$ref": "#/$defs/Time"
    },
    "updatedBy": {
      "$ref": "#/$defs/User"
    },
    "updatedAt": {
      "$ref": "#/$defs/Time"
    },
    "disabled": {
      "type": "boolean"
    },
    "scopes": {
      "type": "array",
      "description": "The token's effective scopes. An empty/omitted list means the token is unscoped.",
      "items": {
        "$ref": "#/$defs/ApiTokenScope"
      }
    },
    "secret": {
      "type": "string",
      "description": "The secret for the API token. Only returned on create."
    }
  },
  "$defs": {
    "ApiTokenScope": {
      "type": "string",
      "enum": [
        "api:read",
        "api:write",
        "unscoped"
      ]
    },
    "ObjectId": {
      "type": "string",
      "format": "ObjectId"
    },
    "Time": {
      "type": "string",
      "format": "RFC3339"
    },
    "User": {
      "title": "User",
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "title": "User Identifier",
          "$ref": "#/$defs/ObjectId"
        },
        "label": {
          "title": "User Label",
          "type": "string"
        },
        "timezone": {
          "type": "string"
        },
        "locale": {
          "type": "string"
        }
      }
    }
  }
}