{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "imports-v2/spaces.json",
  "title": "Spaces",
  "description": "A space: the top-level container of boards, folders and documents, such as \"KPI Program\". Spaces can be nested through `parent_ref`, and the spaces, folders and documents with the same parent share one list, ordered by `sort_order`; a space without a parent is created under the space you choose in the importer. Give boards to a space with `space_boards` and people and groups with `tree_entity_roles`. Imported spaces are open only to the people and groups given access, so list everyone who should see the space.",
  "type": "object",
  "properties": {
    "external_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "description": "Your own identifier of the record, for example `k-mrr`, unique within the resource across all of its files and case sensitive. Other records refer to this one by it. The import also keeps it as the external id of the object it creates."
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "description": "Name of the space, for example `KPI Program`. Up to 256 characters."
    },
    "parent_ref": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "spaces",
            "folders",
            "documents"
          ]
        },
        "external_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "required": [
        "resource",
        "external_id"
      ],
      "additionalProperties": false,
      "x-refs": [
        "spaces",
        "folders",
        "documents"
      ],
      "description": "Where a nested space sits: an object with `resource` (`spaces`, `folders` or `documents`) and the `external_id` of that record. Leave it out for a top-level space."
    },
    "key": {
      "type": "string",
      "pattern": "^[A-Z][A-Z0-9_]{1,15}$",
      "description": "The prefix of the card keys this space issues, for example `KPI_MRD_X7Q4`: 2 to 16 characters, capital letters, digits and underscore, starting with a letter; a hyphen is not allowed. Leave it out when no card key comes from this space. The card keys that use it are the `key` of `cards`, and the counter that numbers the next card of the space continues after the highest number among them. A key is unique among spaces and folders together, and a key the target company already uses is replaced by a new one."
    },
    "sort_order": {
      "type": "number",
      "exclusiveMinimum": 0,
      "description": "Position among the records next to it; a smaller number goes first and it must be greater than 0. Left out, the record goes to the end of the list.",
      "x-default-text": "the end of the list"
    },
    "author_ref": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "maxLength": 512,
      "x-ref": "users",
      "description": "The user who created the record, by the external_id of a `users` record, for example `u-ava`. Leave it out or use null when the author is unknown or has left."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
      "description": "When the record was created, with a time zone, for example `2026-01-12T09:30:00Z`.",
      "x-default-text": "source.exported_at of the manifest"
    }
  },
  "required": [
    "external_id",
    "title"
  ],
  "additionalProperties": false
}
