{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/citation-co/json-schema/citation-co-connection-schema.json",
  "title": "Connection",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/citation-co-openapi.json#/components/schemas/Connection",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "user_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "workspace_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "documents:read",
          "documents:write",
          "sources:read",
          "sources:write",
          "exports:read",
          "ai:write",
          "checks:write",
          "files:write",
          "sharing:read",
          "sharing:write",
          "comments:read",
          "comments:write",
          "webhooks:write"
        ]
      }
    },
    "expires_at": {
      "type": "string"
    },
    "limits": {
      "type": "object",
      "properties": {
        "key_per_minute": {
          "type": "number"
        },
        "account_per_minute": {
          "type": "number"
        },
        "running_jobs": {
          "type": "number"
        },
        "queued_jobs": {
          "type": "number"
        },
        "ai_words": {
          "type": "number"
        },
        "ai_sources": {
          "type": "number"
        },
        "output_words": {
          "type": "number"
        },
        "check_words": {
          "type": "number"
        },
        "check_sources": {
          "type": "number"
        },
        "file_bytes": {
          "type": "number"
        }
      },
      "required": [
        "key_per_minute",
        "account_per_minute",
        "running_jobs",
        "queued_jobs",
        "ai_words",
        "ai_sources",
        "output_words",
        "check_words",
        "check_sources",
        "file_bytes"
      ]
    }
  },
  "required": [
    "id",
    "user_id",
    "workspace_id",
    "scopes",
    "expires_at",
    "limits"
  ]
}