{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/thread-page/json-schema/thread-page-connection-info-schema.json",
  "title": "ConnectionInfo",
  "x-generated": "2026-11-07",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/thread-page-openapi.json#/components/schemas/ConnectionInfo",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "access": {
      "$ref": "#/$defs/Access"
    },
    "permissions": {
      "$ref": "#/$defs/Permissions"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "When this token's term ends unless the owner renews it; it also stops after 90 days without a call (401 token_expired)."
    },
    "level": {
      "allOf": [
        {
          "$ref": "#/$defs/LevelEnum"
        }
      ],
      "description": "UI names: full Edit and organize, read_add Read and add, read Read only, append Add only, inbox Add to Inbox.\n\n* `full` - full\n* `read_add` - read_add\n* `read` - read\n* `append` - append\n* `inbox` - inbox"
    },
    "can": {
      "type": "string",
      "description": "What this level does, as the owner read it."
    },
    "cannot": {
      "type": "string",
      "description": "What it can't do."
    },
    "manage_url": {
      "type": "string",
      "format": "uri",
      "description": "Where the owner changes this connection's level: <origin>/app/settings/connections/<id>?access=<level>, where access proposes the next level up (none on Edit and organize). It changes only the level."
    },
    "paused_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the owner paused this connection, or null. While paused every other call but GET /operations/{operation_id} answers 409 connection_paused; tell the person they can resume it in Settings → Connections."
    },
    "shared_places": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SharedPlace"
      },
      "description": "Shared threads and folders the owner allowed this connection to write in."
    }
  },
  "required": [
    "access",
    "can",
    "cannot",
    "expires_at",
    "id",
    "level",
    "manage_url",
    "name",
    "paused_at",
    "permissions",
    "shared_places"
  ],
  "$defs": {
    "Access": {
      "type": "object",
      "properties": {
        "version": {
          "type": "integer"
        },
        "level": {
          "$ref": "#/$defs/LevelEnum"
        },
        "scope": {
          "$ref": "#/$defs/AccessScopeEnum"
        },
        "folder_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        },
        "thread_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        },
        "excluded_folder_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        },
        "excluded_thread_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "required": [
        "excluded_folder_ids",
        "excluded_thread_ids",
        "folder_ids",
        "level",
        "scope",
        "thread_ids",
        "version"
      ]
    },
    "AccessScopeEnum": {
      "enum": [
        "workspace",
        "selected"
      ],
      "type": "string",
      "description": "* `workspace` - workspace\n* `selected` - selected"
    },
    "EditNotesEnum": {
      "enum": [
        "none",
        "own",
        "all"
      ],
      "type": "string",
      "description": "* `none` - none\n* `own` - own\n* `all` - all"
    },
    "LevelEnum": {
      "enum": [
        "full",
        "read_add",
        "read",
        "append",
        "inbox"
      ],
      "type": "string",
      "description": "* `full` - full\n* `read_add` - read_add\n* `read` - read\n* `append` - append\n* `inbox` - inbox"
    },
    "Permissions": {
      "type": "object",
      "properties": {
        "read": {
          "type": "boolean"
        },
        "create_notes": {
          "type": "boolean"
        },
        "add_to_inbox": {
          "type": "boolean",
          "description": "POST /inbox/notes adds a note to the owner's Inbox: every plan (package IB)."
        },
        "edit_notes": {
          "allOf": [
            {
              "$ref": "#/$defs/EditNotesEnum"
            }
          ],
          "description": "own: only the notes it added, also after a person edited them (Read and add).\n\n* `none` - none\n* `own` - own\n* `all` - all"
        },
        "organize": {
          "type": "boolean",
          "description": "Threads, folders, pin and done (Edit and organize)."
        }
      },
      "required": [
        "add_to_inbox",
        "create_notes",
        "edit_notes",
        "organize",
        "read"
      ]
    },
    "SharedPlace": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/SharedPlaceTypeEnum"
        },
        "id": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "id",
        "type"
      ]
    },
    "SharedPlaceTypeEnum": {
      "enum": [
        "thread",
        "folder"
      ],
      "type": "string",
      "description": "* `thread` - thread\n* `folder` - folder"
    }
  }
}