{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/revdoku-com/json-schema/revdoku-com-bucket-schema.json",
  "title": "Bucket",
  "description": "A bucket: the project of one docs site. It holds the files, the published site, the site analytics, and the support email address with its tickets. The dashboard calls it a site. Name it with title (the address part of email.address when title is null). Use id in API calls.",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/revdoku-com-openapi.json#/components/schemas/Bucket",
  "type": "object",
  "required": [
    "id",
    "account_id",
    "email",
    "archived",
    "version_id",
    "version_number",
    "metadata_version",
    "archive",
    "unarchive",
    "delete"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^bkt_"
    },
    "account_id": {
      "type": "string"
    },
    "title": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 255,
      "description": "Bucket title chosen by people. Defaults to the email username given at creation. Null when unset or when the caller cannot see email.address."
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true,
      "description": "Your application data. PATCH replaces the whole object."
    },
    "metadata_version": {
      "type": "string",
      "description": "Send as expected_metadata_version on PATCH. Changes only when description or metadata changes."
    },
    "email": {
      "$ref": "#/$defs/BucketEmail"
    },
    "archived": {
      "type": "boolean"
    },
    "archived_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "lock": {
      "$ref": "#/$defs/BucketLock"
    },
    "storage_bytes": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "files_count": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "description": "Current files."
    },
    "version_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Current bucket file-tree version. It changes when a sync copies new files from GitHub."
    },
    "version_number": {
      "type": "integer",
      "minimum": 0
    },
    "created_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "dashboard_url": {
      "type": "string",
      "format": "uri",
      "description": "Opens the bucket for signed-in members. It does not grant access."
    },
    "archive": {
      "$ref": "#/$defs/BucketAction"
    },
    "unarchive": {
      "$ref": "#/$defs/BucketAction"
    },
    "delete": {
      "$ref": "#/$defs/BucketAction"
    }
  },
  "$defs": {
    "BucketAction": {
      "type": "object",
      "properties": {
        "allowed": {
          "type": "boolean"
        },
        "blocked_reason": {
          "type": "string"
        },
        "required_action": {
          "type": "string"
        },
        "confirmation": {
          "type": "string",
          "description": "Delete only: send this value as confirmation in DELETE /v1/buckets/{bucket_id} after the user confirms."
        }
      },
      "required": [
        "allowed"
      ]
    },
    "BucketEmail": {
      "type": "object",
      "description": "The bucket's email address and whether it can receive and send now. Counts read the email index without reading content.",
      "required": [
        "message_count",
        "unread_count",
        "last_received_at",
        "receiving_enabled",
        "sending_enabled"
      ],
      "properties": {
        "address": {
          "type": "string",
          "description": "Primary address. Present when the credential has write access to the bucket. Show it after the title."
        },
        "message_count": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "minimum": 0,
          "description": "Emails currently stored. Null while the email index is being prepared."
        },
        "unread_count": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "minimum": 0,
          "description": "Stored emails with shared unread status. Null while the email index is being prepared."
        },
        "last_received_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Receipt time of the latest saved email; null before the first email."
        },
        "receiving_enabled": {
          "type": "boolean",
          "description": "Whether the address can receive email now."
        },
        "receiving_blocked_reason": {
          "type": "string",
          "description": "Why receiving is unavailable. Omitted when receiving_enabled is true."
        },
        "sending_enabled": {
          "type": "boolean",
          "description": "Whether the bucket can send replies now."
        },
        "sending_blocked_reason": {
          "type": "string",
          "description": "Why sending is unavailable. Omitted when sending_enabled is true."
        }
      }
    },
    "BucketLock": {
      "type": "object",
      "required": [
        "locked"
      ],
      "properties": {
        "locked": {
          "type": "boolean"
        },
        "locked_until": {
          "type": "string",
          "format": "date-time"
        },
        "kind": {
          "type": "string",
          "description": "For example bucket_delete while a permanent delete runs."
        },
        "message": {
          "type": "string"
        },
        "progress": {
          "type": "object",
          "additionalProperties": true
        },
        "locked_by": {
          "$ref": "#/$defs/FileActor"
        },
        "locked_by_api_key": {
          "$ref": "#/$defs/FileKey"
        }
      }
    },
    "FileActor": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string"
        }
      }
    },
    "FileKey": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "token_type": {
          "type": "string"
        }
      }
    }
  }
}