{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/github/json-schema/github-copilot-space-schema.json",
  "title": "Space",
  "description": "A GitHub Copilot Space represents an interactive AI workspace where users can ask questions and get assistance.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/github-copilot-spaces-api-openapi.yml#/components/schemas/copilot-space",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "format": "int64",
      "description": "The unique identifier of the space."
    },
    "number": {
      "type": "integer",
      "description": "The number that identifies the space within its owner."
    },
    "name": {
      "type": "string",
      "description": "The display name of the space."
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "A description of the space."
    },
    "general_instructions": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 4000,
      "description": "General instructions for the Copilot Space."
    },
    "base_role": {
      "type": "string",
      "enum": [
        "reader",
        "writer",
        "admin",
        "no_access"
      ],
      "description": "The base role that determines default permissions.\n- `no_access`: No default access\n- `reader`: Default read permissions\n- `writer`: Default write permissions (organization spaces only)\n- `admin`: Default admin permissions (organization spaces only)"
    },
    "owner": {
      "anyOf": [
        {
          "$ref": "#/$defs/simple-user"
        },
        {
          "$ref": "#/$defs/organization-simple"
        }
      ],
      "description": "The user or organization that owns this space."
    },
    "creator": {
      "$ref": "#/$defs/simple-user"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time the space was created."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time the space was last updated."
    },
    "html_url": {
      "type": "string",
      "format": "uri",
      "description": "The HTML URL of the space."
    },
    "api_url": {
      "type": "string",
      "format": "uri",
      "description": "The API URL of the space."
    },
    "resources_attributes": {
      "type": "array",
      "description": "Resources attached to the space.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "The unique identifier of the resource."
          },
          "resource_type": {
            "type": "string",
            "enum": [
              "repository",
              "github_file",
              "free_text",
              "github_issue",
              "github_pull_request",
              "media_content",
              "uploaded_text_file"
            ],
            "description": "The type of resource."
          },
          "copilot_chat_attachment_id": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "The unique identifier of the chat attachment for uploaded files or media content."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "The date and time the resource was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "The date and time the resource was last updated."
          },
          "metadata": {
            "type": "object",
            "description": "Metadata specific to the resource type.",
            "properties": {
              "repository_id": {
                "type": "integer",
                "description": "Repository ID for repository or file resources."
              },
              "file_path": {
                "type": "string",
                "description": "File path for file resources."
              },
              "text": {
                "type": "string",
                "description": "Text content for free text resources."
              },
              "name": {
                "type": "string",
                "description": "Name for the resource."
              },
              "number": {
                "type": "integer",
                "description": "Issue or PR number."
              },
              "copilot_chat_attachment_id": {
                "type": "integer",
                "description": "Chat attachment ID for uploaded files or media."
              },
              "media_type": {
                "type": "string",
                "description": "Media type for media content resources."
              },
              "url": {
                "type": "string",
                "description": "URL for media content resources."
              },
              "height": {
                "type": "integer",
                "description": "Height for media content resources."
              },
              "width": {
                "type": "integer",
                "description": "Width for media content resources."
              }
            }
          }
        }
      }
    }
  },
  "required": [
    "id",
    "number",
    "name",
    "base_role",
    "owner",
    "creator",
    "created_at",
    "updated_at",
    "html_url",
    "api_url"
  ],
  "additionalProperties": false,
  "$defs": {
    "organization-simple": {
      "title": "Organization Simple",
      "description": "A GitHub organization.",
      "type": "object",
      "properties": {
        "login": {
          "type": "string"
        },
        "id": {
          "type": "integer"
        },
        "node_id": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "repos_url": {
          "type": "string",
          "format": "uri"
        },
        "events_url": {
          "type": "string",
          "format": "uri"
        },
        "hooks_url": {
          "type": "string"
        },
        "issues_url": {
          "type": "string"
        },
        "members_url": {
          "type": "string"
        },
        "public_members_url": {
          "type": "string"
        },
        "avatar_url": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "login",
        "url",
        "id",
        "node_id",
        "repos_url",
        "events_url",
        "hooks_url",
        "issues_url",
        "members_url",
        "public_members_url",
        "avatar_url",
        "description"
      ]
    },
    "simple-user": {
      "title": "Simple User",
      "description": "A GitHub user.",
      "type": "object",
      "properties": {
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "email": {
          "type": [
            "string",
            "null"
          ]
        },
        "login": {
          "type": "string"
        },
        "id": {
          "type": "integer",
          "format": "int64"
        },
        "node_id": {
          "type": "string"
        },
        "avatar_url": {
          "type": "string",
          "format": "uri"
        },
        "gravatar_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "html_url": {
          "type": "string",
          "format": "uri"
        },
        "followers_url": {
          "type": "string",
          "format": "uri"
        },
        "following_url": {
          "type": "string"
        },
        "gists_url": {
          "type": "string"
        },
        "starred_url": {
          "type": "string"
        },
        "subscriptions_url": {
          "type": "string",
          "format": "uri"
        },
        "organizations_url": {
          "type": "string",
          "format": "uri"
        },
        "repos_url": {
          "type": "string",
          "format": "uri"
        },
        "events_url": {
          "type": "string"
        },
        "received_events_url": {
          "type": "string",
          "format": "uri"
        },
        "type": {
          "type": "string"
        },
        "site_admin": {
          "type": "boolean"
        },
        "starred_at": {
          "type": "string"
        },
        "user_view_type": {
          "type": "string"
        }
      },
      "required": [
        "avatar_url",
        "events_url",
        "followers_url",
        "following_url",
        "gists_url",
        "gravatar_id",
        "html_url",
        "id",
        "node_id",
        "login",
        "organizations_url",
        "received_events_url",
        "repos_url",
        "site_admin",
        "starred_url",
        "subscriptions_url",
        "type",
        "url"
      ]
    }
  }
}