{"meta":{"title":"Codespaces 的 REST API 终结点","intro":"使用 REST API 管理 GitHub Codespaces。","product":"REST API","breadcrumbs":[{"href":"/zh/rest","title":"REST API"},{"href":"/zh/rest/codespaces","title":"Codespaces"},{"href":"/zh/rest/codespaces/codespaces","title":"Codespaces"}],"documentType":"article"},"body":"# Codespaces 的 REST API 终结点\n\n使用 REST API 管理 GitHub Codespaces。\n\n## 关于 GitHub Codespaces\n\n可以使用 REST API 管理 Codespaces。 这些终结点适用于经过身份验证的用户、OAuth apps 和 GitHub Apps。 有关详细信息，请参阅“[Codespaces 文档](/zh/codespaces)”。\n\n> \\[!NOTE]\n> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.\n\n## List codespaces in a repository for the authenticated user\n\n```\nGET /repos/{owner}/{repo}/codespaces\n```\n\nLists the codespaces associated to a specified repository and the authenticated user.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **500** - Internal Error\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/codespaces\n```\n\n**Response schema (Status: 200):**\n\n* `total_count`: required, integer\n* `codespaces`: required, array of `Codespace`:\n  * `id`: required, integer, format: int64\n  * `name`: required, string\n  * `display_name`: string or null\n  * `environment_id`: required, string or null\n  * `owner`: required, `Simple User`:\n    * `name`: string or null\n    * `email`: string or null\n    * `login`: required, string\n    * `id`: required, integer, format: int64\n    * `node_id`: required, string\n    * `avatar_url`: required, string, format: uri\n    * `gravatar_id`: required, string or null\n    * `url`: required, string, format: uri\n    * `html_url`: required, string, format: uri\n    * `followers_url`: required, string, format: uri\n    * `following_url`: required, string\n    * `gists_url`: required, string\n    * `starred_url`: required, string\n    * `subscriptions_url`: required, string, format: uri\n    * `organizations_url`: required, string, format: uri\n    * `repos_url`: required, string, format: uri\n    * `events_url`: required, string\n    * `received_events_url`: required, string, format: uri\n    * `type`: required, string\n    * `site_admin`: required, boolean\n    * `starred_at`: string\n    * `user_view_type`: string\n  * `billable_owner`: required, `Simple User` (see above)\n  * `repository`: required, `Minimal Repository`:\n    * `id`: required, integer, format: int64\n    * `node_id`: required, string\n    * `name`: required, string\n    * `full_name`: required, string\n    * `owner`: required, `Simple User` (see above)\n    * `private`: required, boolean\n    * `html_url`: required, string, format: uri\n    * `description`: required, string or null\n    * `fork`: required, boolean\n    * `url`: required, string, format: uri\n    * `archive_url`: required, string\n    * `assignees_url`: required, string\n    * `blobs_url`: required, string\n    * `branches_url`: required, string\n    * `collaborators_url`: required, string\n    * `comments_url`: required, string\n    * `commits_url`: required, string\n    * `compare_url`: required, string\n    * `contents_url`: required, string\n    * `contributors_url`: required, string, format: uri\n    * `deployments_url`: required, string, format: uri\n    * `downloads_url`: required, string, format: uri\n    * `events_url`: required, string, format: uri\n    * `forks_url`: required, string, format: uri\n    * `git_commits_url`: required, string\n    * `git_refs_url`: required, string\n    * `git_tags_url`: required, string\n    * `git_url`: string\n    * `issue_comment_url`: required, string\n    * `issue_events_url`: required, string\n    * `issues_url`: required, string\n    * `keys_url`: required, string\n    * `labels_url`: required, string\n    * `languages_url`: required, string, format: uri\n    * `merges_url`: required, string, format: uri\n    * `milestones_url`: required, string\n    * `notifications_url`: required, string\n    * `pulls_url`: required, string\n    * `releases_url`: required, string\n    * `ssh_url`: string\n    * `stargazers_url`: required, string, format: uri\n    * `statuses_url`: required, string\n    * `subscribers_url`: required, string, format: uri\n    * `subscription_url`: required, string, format: uri\n    * `tags_url`: required, string, format: uri\n    * `teams_url`: required, string, format: uri\n    * `trees_url`: required, string\n    * `clone_url`: string\n    * `mirror_url`: string or null\n    * `hooks_url`: required, string, format: uri\n    * `svn_url`: string\n    * `homepage`: string or null\n    * `language`: string or null\n    * `forks_count`: integer\n    * `stargazers_count`: integer\n    * `watchers_count`: integer\n    * `size`: integer\n    * `default_branch`: string\n    * `open_issues_count`: integer\n    * `is_template`: boolean\n    * `topics`: array of string\n    * `has_issues`: boolean\n    * `has_projects`: boolean\n    * `has_wiki`: boolean\n    * `has_pages`: boolean\n    * `has_discussions`: boolean\n    * `has_pull_requests`: boolean\n    * `pull_request_creation_policy`: string, enum: `all`, `collaborators_only`\n    * `archived`: boolean\n    * `disabled`: boolean\n    * `visibility`: string\n    * `pushed_at`: string or null, format: date-time\n    * `created_at`: string or null, format: date-time\n    * `updated_at`: string or null, format: date-time\n    * `permissions`: object:\n      * `admin`: boolean\n      * `maintain`: boolean\n      * `push`: boolean\n      * `triage`: boolean\n      * `pull`: boolean\n    * `role_name`: string\n    * `temp_clone_token`: string\n    * `delete_branch_on_merge`: boolean\n    * `subscribers_count`: integer\n    * `network_count`: integer\n    * `code_of_conduct`: `Code Of Conduct`:\n      * `key`: required, string\n      * `name`: required, string\n      * `url`: required, string, format: uri\n      * `body`: string\n      * `html_url`: required, string or null, format: uri\n    * `license`: object or null:\n      * `key`: string\n      * `name`: string\n      * `spdx_id`: string\n      * `url`: string or null\n      * `node_id`: string\n    * `forks`: integer\n    * `open_issues`: integer\n    * `watchers`: integer\n    * `allow_forking`: boolean\n    * `web_commit_signoff_required`: boolean\n    * `security_and_analysis`: object or null:\n      * `advanced_security`: object:\n        * `status`: string, enum: `enabled`, `disabled`\n      * `code_security`: object:\n        * `status`: string, enum: `enabled`, `disabled`\n      * `dependabot_security_updates`: object:\n        * `status`: string, enum: `enabled`, `disabled`\n      * `secret_scanning`: object:\n        * `status`: string, enum: `enabled`, `disabled`\n      * `secret_scanning_push_protection`: object:\n        * `status`: string, enum: `enabled`, `disabled`\n      * `secret_scanning_non_provider_patterns`: object:\n        * `status`: string, enum: `enabled`, `disabled`\n      * `secret_scanning_ai_detection`: object:\n        * `status`: string, enum: `enabled`, `disabled`\n      * `secret_scanning_delegated_alert_dismissal`: object:\n        * `status`: string, enum: `enabled`, `disabled`\n      * `secret_scanning_delegated_bypass`: object:\n        * `status`: string, enum: `enabled`, `disabled`\n      * `secret_scanning_delegated_bypass_options`: object:\n        * `reviewers`: array of object\n    * `custom_properties`: object, additional properties allowed\n  * `machine`: required, any of:\n    * **null**\n    * **Codespace machine**\n      * `name`: required, string\n      * `display_name`: required, string\n      * `operating_system`: required, string\n      * `storage_in_bytes`: required, integer\n      * `memory_in_bytes`: required, integer\n      * `cpus`: required, integer\n      * `prebuild_availability`: required, string or null, enum: `none`, `ready`, `in_progress`, `null`\n  * `devcontainer_path`: string or null\n  * `prebuild`: required, boolean or null\n  * `created_at`: required, string, format: date-time\n  * `updated_at`: required, string, format: date-time\n  * `last_used_at`: required, string, format: date-time\n  * `state`: required, string, enum: `Unknown`, `Created`, `Queued`, `Provisioning`, `Available`, `Awaiting`, `Unavailable`, `Deleted`, `Moved`, `Shutdown`, `Archived`, `Starting`, `ShuttingDown`, `Failed`, `Exporting`, `Updating`, `Rebuilding`\n  * `url`: required, string, format: uri\n  * `git_status`: required, object:\n    * `ahead`: integer\n    * `behind`: integer\n    * `has_unpushed_changes`: boolean\n    * `has_uncommitted_changes`: boolean\n    * `ref`: string\n  * `location`: required, string, enum: `EastUs`, `SouthEastAsia`, `WestEurope`, `WestUs2`\n  * `idle_timeout_minutes`: required, integer or null\n  * `web_url`: required, string, format: uri\n  * `machines_url`: required, string, format: uri\n  * `start_url`: required, string, format: uri\n  * `stop_url`: required, string, format: uri\n  * `publish_url`: string or null, format: uri\n  * `pulls_url`: required, string or null, format: uri\n  * `recent_folders`: required, array of string\n  * `runtime_constraints`: object:\n    * `allowed_port_privacy_settings`: array of string or null\n  * `pending_operation`: boolean or null\n  * `pending_operation_disabled_reason`: string or null\n  * `idle_timeout_notice`: string or null\n  * `retention_period_minutes`: integer or null\n  * `retention_expires_at`: string or null, format: date-time\n  * `last_known_stop_notice`: string or null\n\n## Create a codespace in a repository\n\n```\nPOST /repos/{owner}/{repo}/codespaces\n```\n\nCreates a codespace owned by the authenticated user in the specified repository.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n#### Body parameters\n\n* **`ref`** (string)\n  Git ref (typically a branch name) for this codespace\n\n* **`location`** (string)\n  The requested location for a new codespace. Best efforts are made to respect this upon creation. Assigned by IP if not provided.\n\n* **`geo`** (string)\n  The geographic area for this codespace. If not specified, the value is assigned by IP. This property replaces location, which is closing down.\n  Can be one of: `EuropeWest`, `SoutheastAsia`, `UsEast`, `UsWest`\n\n* **`client_ip`** (string)\n  IP for location auto-detection when proxying a request\n\n* **`machine`** (string)\n  Machine type to use for this codespace\n\n* **`devcontainer_path`** (string)\n  Path to devcontainer.json config to use for this codespace\n\n* **`multi_repo_permissions_opt_out`** (boolean)\n  Whether to authorize requested permissions from devcontainer.json\n\n* **`working_directory`** (string)\n  Working directory for this codespace\n\n* **`idle_timeout_minutes`** (integer)\n  Time in minutes before codespace stops from inactivity\n\n* **`display_name`** (string)\n  Display name for this codespace\n\n* **`retention_period_minutes`** (integer)\n  Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days).\n\n### HTTP response status codes\n\n* **201** - Response when the codespace was successfully created\n\n* **202** - Response when the codespace creation partially failed but is being retried in the background\n\n* **400** - Bad Request\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example 1: Status Code 201\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/repos/OWNER/REPO/codespaces \\\n  -d '{\n  \"ref\": \"main\",\n  \"machine\": \"standardLinux32gb\"\n}'\n```\n\n**Response schema (Status: 201):**\n\n* `id`: required, integer, format: int64\n* `name`: required, string\n* `display_name`: string or null\n* `environment_id`: required, string or null\n* `owner`: required, `Simple User`:\n  * `name`: string or null\n  * `email`: string or null\n  * `login`: required, string\n  * `id`: required, integer, format: int64\n  * `node_id`: required, string\n  * `avatar_url`: required, string, format: uri\n  * `gravatar_id`: required, string or null\n  * `url`: required, string, format: uri\n  * `html_url`: required, string, format: uri\n  * `followers_url`: required, string, format: uri\n  * `following_url`: required, string\n  * `gists_url`: required, string\n  * `starred_url`: required, string\n  * `subscriptions_url`: required, string, format: uri\n  * `organizations_url`: required, string, format: uri\n  * `repos_url`: required, string, format: uri\n  * `events_url`: required, string\n  * `received_events_url`: required, string, format: uri\n  * `type`: required, string\n  * `site_admin`: required, boolean\n  * `starred_at`: string\n  * `user_view_type`: string\n* `billable_owner`: required, `Simple User` (see above)\n* `repository`: required, `Minimal Repository`:\n  * `id`: required, integer, format: int64\n  * `node_id`: required, string\n  * `name`: required, string\n  * `full_name`: required, string\n  * `owner`: required, `Simple User` (see above)\n  * `private`: required, boolean\n  * `html_url`: required, string, format: uri\n  * `description`: required, string or null\n  * `fork`: required, boolean\n  * `url`: required, string, format: uri\n  * `archive_url`: required, string\n  * `assignees_url`: required, string\n  * `blobs_url`: required, string\n  * `branches_url`: required, string\n  * `collaborators_url`: required, string\n  * `comments_url`: required, string\n  * `commits_url`: required, string\n  * `compare_url`: required, string\n  * `contents_url`: required, string\n  * `contributors_url`: required, string, format: uri\n  * `deployments_url`: required, string, format: uri\n  * `downloads_url`: required, string, format: uri\n  * `events_url`: required, string, format: uri\n  * `forks_url`: required, string, format: uri\n  * `git_commits_url`: required, string\n  * `git_refs_url`: required, string\n  * `git_tags_url`: required, string\n  * `git_url`: string\n  * `issue_comment_url`: required, string\n  * `issue_events_url`: required, string\n  * `issues_url`: required, string\n  * `keys_url`: required, string\n  * `labels_url`: required, string\n  * `languages_url`: required, string, format: uri\n  * `merges_url`: required, string, format: uri\n  * `milestones_url`: required, string\n  * `notifications_url`: required, string\n  * `pulls_url`: required, string\n  * `releases_url`: required, string\n  * `ssh_url`: string\n  * `stargazers_url`: required, string, format: uri\n  * `statuses_url`: required, string\n  * `subscribers_url`: required, string, format: uri\n  * `subscription_url`: required, string, format: uri\n  * `tags_url`: required, string, format: uri\n  * `teams_url`: required, string, format: uri\n  * `trees_url`: required, string\n  * `clone_url`: string\n  * `mirror_url`: string or null\n  * `hooks_url`: required, string, format: uri\n  * `svn_url`: string\n  * `homepage`: string or null\n  * `language`: string or null\n  * `forks_count`: integer\n  * `stargazers_count`: integer\n  * `watchers_count`: integer\n  * `size`: integer\n  * `default_branch`: string\n  * `open_issues_count`: integer\n  * `is_template`: boolean\n  * `topics`: array of string\n  * `has_issues`: boolean\n  * `has_projects`: boolean\n  * `has_wiki`: boolean\n  * `has_pages`: boolean\n  * `has_discussions`: boolean\n  * `has_pull_requests`: boolean\n  * `pull_request_creation_policy`: string, enum: `all`, `collaborators_only`\n  * `archived`: boolean\n  * `disabled`: boolean\n  * `visibility`: string\n  * `pushed_at`: string or null, format: date-time\n  * `created_at`: string or null, format: date-time\n  * `updated_at`: string or null, format: date-time\n  * `permissions`: object:\n    * `admin`: boolean\n    * `maintain`: boolean\n    * `push`: boolean\n    * `triage`: boolean\n    * `pull`: boolean\n  * `role_name`: string\n  * `temp_clone_token`: string\n  * `delete_branch_on_merge`: boolean\n  * `subscribers_count`: integer\n  * `network_count`: integer\n  * `code_of_conduct`: `Code Of Conduct`:\n    * `key`: required, string\n    * `name`: required, string\n    * `url`: required, string, format: uri\n    * `body`: string\n    * `html_url`: required, string or null, format: uri\n  * `license`: object or null:\n    * `key`: string\n    * `name`: string\n    * `spdx_id`: string\n    * `url`: string or null\n    * `node_id`: string\n  * `forks`: integer\n  * `open_issues`: integer\n  * `watchers`: integer\n  * `allow_forking`: boolean\n  * `web_commit_signoff_required`: boolean\n  * `security_and_analysis`: object or null:\n    * `advanced_security`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `code_security`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `dependabot_security_updates`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_push_protection`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_non_provider_patterns`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_ai_detection`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_delegated_alert_dismissal`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_delegated_bypass`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_delegated_bypass_options`: object:\n      * `reviewers`: array of objects:\n        * `reviewer_id`: required, integer\n        * `reviewer_type`: required, string, enum: `TEAM`, `ROLE`\n        * `mode`: string, enum: `ALWAYS`, `EXEMPT`, default: `\"ALWAYS\"`\n  * `custom_properties`: object, additional properties allowed\n* `machine`: required, any of:\n  * **null**\n  * **Codespace machine**\n    * `name`: required, string\n    * `display_name`: required, string\n    * `operating_system`: required, string\n    * `storage_in_bytes`: required, integer\n    * `memory_in_bytes`: required, integer\n    * `cpus`: required, integer\n    * `prebuild_availability`: required, string or null, enum: `none`, `ready`, `in_progress`, `null`\n* `devcontainer_path`: string or null\n* `prebuild`: required, boolean or null\n* `created_at`: required, string, format: date-time\n* `updated_at`: required, string, format: date-time\n* `last_used_at`: required, string, format: date-time\n* `state`: required, string, enum: `Unknown`, `Created`, `Queued`, `Provisioning`, `Available`, `Awaiting`, `Unavailable`, `Deleted`, `Moved`, `Shutdown`, `Archived`, `Starting`, `ShuttingDown`, `Failed`, `Exporting`, `Updating`, `Rebuilding`\n* `url`: required, string, format: uri\n* `git_status`: required, object:\n  * `ahead`: integer\n  * `behind`: integer\n  * `has_unpushed_changes`: boolean\n  * `has_uncommitted_changes`: boolean\n  * `ref`: string\n* `location`: required, string, enum: `EastUs`, `SouthEastAsia`, `WestEurope`, `WestUs2`\n* `idle_timeout_minutes`: required, integer or null\n* `web_url`: required, string, format: uri\n* `machines_url`: required, string, format: uri\n* `start_url`: required, string, format: uri\n* `stop_url`: required, string, format: uri\n* `publish_url`: string or null, format: uri\n* `pulls_url`: required, string or null, format: uri\n* `recent_folders`: required, array of string\n* `runtime_constraints`: object:\n  * `allowed_port_privacy_settings`: array of string or null\n* `pending_operation`: boolean or null\n* `pending_operation_disabled_reason`: string or null\n* `idle_timeout_notice`: string or null\n* `retention_period_minutes`: integer or null\n* `retention_expires_at`: string or null, format: date-time\n* `last_known_stop_notice`: string or null\n\n#### Example 2: Status Code 202\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/repos/OWNER/REPO/codespaces \\\n  -d '{\n  \"ref\": \"main\",\n  \"machine\": \"standardLinux32gb\"\n}'\n```\n\n**Response schema (Status: 202):**\n\n* `id`: required, integer, format: int64\n* `name`: required, string\n* `display_name`: string or null\n* `environment_id`: required, string or null\n* `owner`: required, `Simple User`:\n  * `name`: string or null\n  * `email`: string or null\n  * `login`: required, string\n  * `id`: required, integer, format: int64\n  * `node_id`: required, string\n  * `avatar_url`: required, string, format: uri\n  * `gravatar_id`: required, string or null\n  * `url`: required, string, format: uri\n  * `html_url`: required, string, format: uri\n  * `followers_url`: required, string, format: uri\n  * `following_url`: required, string\n  * `gists_url`: required, string\n  * `starred_url`: required, string\n  * `subscriptions_url`: required, string, format: uri\n  * `organizations_url`: required, string, format: uri\n  * `repos_url`: required, string, format: uri\n  * `events_url`: required, string\n  * `received_events_url`: required, string, format: uri\n  * `type`: required, string\n  * `site_admin`: required, boolean\n  * `starred_at`: string\n  * `user_view_type`: string\n* `billable_owner`: required, `Simple User` (see above)\n* `repository`: required, `Minimal Repository`:\n  * `id`: required, integer, format: int64\n  * `node_id`: required, string\n  * `name`: required, string\n  * `full_name`: required, string\n  * `owner`: required, `Simple User` (see above)\n  * `private`: required, boolean\n  * `html_url`: required, string, format: uri\n  * `description`: required, string or null\n  * `fork`: required, boolean\n  * `url`: required, string, format: uri\n  * `archive_url`: required, string\n  * `assignees_url`: required, string\n  * `blobs_url`: required, string\n  * `branches_url`: required, string\n  * `collaborators_url`: required, string\n  * `comments_url`: required, string\n  * `commits_url`: required, string\n  * `compare_url`: required, string\n  * `contents_url`: required, string\n  * `contributors_url`: required, string, format: uri\n  * `deployments_url`: required, string, format: uri\n  * `downloads_url`: required, string, format: uri\n  * `events_url`: required, string, format: uri\n  * `forks_url`: required, string, format: uri\n  * `git_commits_url`: required, string\n  * `git_refs_url`: required, string\n  * `git_tags_url`: required, string\n  * `git_url`: string\n  * `issue_comment_url`: required, string\n  * `issue_events_url`: required, string\n  * `issues_url`: required, string\n  * `keys_url`: required, string\n  * `labels_url`: required, string\n  * `languages_url`: required, string, format: uri\n  * `merges_url`: required, string, format: uri\n  * `milestones_url`: required, string\n  * `notifications_url`: required, string\n  * `pulls_url`: required, string\n  * `releases_url`: required, string\n  * `ssh_url`: string\n  * `stargazers_url`: required, string, format: uri\n  * `statuses_url`: required, string\n  * `subscribers_url`: required, string, format: uri\n  * `subscription_url`: required, string, format: uri\n  * `tags_url`: required, string, format: uri\n  * `teams_url`: required, string, format: uri\n  * `trees_url`: required, string\n  * `clone_url`: string\n  * `mirror_url`: string or null\n  * `hooks_url`: required, string, format: uri\n  * `svn_url`: string\n  * `homepage`: string or null\n  * `language`: string or null\n  * `forks_count`: integer\n  * `stargazers_count`: integer\n  * `watchers_count`: integer\n  * `size`: integer\n  * `default_branch`: string\n  * `open_issues_count`: integer\n  * `is_template`: boolean\n  * `topics`: array of string\n  * `has_issues`: boolean\n  * `has_projects`: boolean\n  * `has_wiki`: boolean\n  * `has_pages`: boolean\n  * `has_discussions`: boolean\n  * `has_pull_requests`: boolean\n  * `pull_request_creation_policy`: string, enum: `all`, `collaborators_only`\n  * `archived`: boolean\n  * `disabled`: boolean\n  * `visibility`: string\n  * `pushed_at`: string or null, format: date-time\n  * `created_at`: string or null, format: date-time\n  * `updated_at`: string or null, format: date-time\n  * `permissions`: object:\n    * `admin`: boolean\n    * `maintain`: boolean\n    * `push`: boolean\n    * `triage`: boolean\n    * `pull`: boolean\n  * `role_name`: string\n  * `temp_clone_token`: string\n  * `delete_branch_on_merge`: boolean\n  * `subscribers_count`: integer\n  * `network_count`: integer\n  * `code_of_conduct`: `Code Of Conduct`:\n    * `key`: required, string\n    * `name`: required, string\n    * `url`: required, string, format: uri\n    * `body`: string\n    * `html_url`: required, string or null, format: uri\n  * `license`: object or null:\n    * `key`: string\n    * `name`: string\n    * `spdx_id`: string\n    * `url`: string or null\n    * `node_id`: string\n  * `forks`: integer\n  * `open_issues`: integer\n  * `watchers`: integer\n  * `allow_forking`: boolean\n  * `web_commit_signoff_required`: boolean\n  * `security_and_analysis`: object or null:\n    * `advanced_security`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `code_security`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `dependabot_security_updates`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_push_protection`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_non_provider_patterns`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_ai_detection`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_delegated_alert_dismissal`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_delegated_bypass`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_delegated_bypass_options`: object:\n      * `reviewers`: array of objects:\n        * `reviewer_id`: required, integer\n        * `reviewer_type`: required, string, enum: `TEAM`, `ROLE`\n        * `mode`: string, enum: `ALWAYS`, `EXEMPT`, default: `\"ALWAYS\"`\n  * `custom_properties`: object, additional properties allowed\n* `machine`: required, any of:\n  * **null**\n  * **Codespace machine**\n    * `name`: required, string\n    * `display_name`: required, string\n    * `operating_system`: required, string\n    * `storage_in_bytes`: required, integer\n    * `memory_in_bytes`: required, integer\n    * `cpus`: required, integer\n    * `prebuild_availability`: required, string or null, enum: `none`, `ready`, `in_progress`, `null`\n* `devcontainer_path`: string or null\n* `prebuild`: required, boolean or null\n* `created_at`: required, string, format: date-time\n* `updated_at`: required, string, format: date-time\n* `last_used_at`: required, string, format: date-time\n* `state`: required, string, enum: `Unknown`, `Created`, `Queued`, `Provisioning`, `Available`, `Awaiting`, `Unavailable`, `Deleted`, `Moved`, `Shutdown`, `Archived`, `Starting`, `ShuttingDown`, `Failed`, `Exporting`, `Updating`, `Rebuilding`\n* `url`: required, string, format: uri\n* `git_status`: required, object:\n  * `ahead`: integer\n  * `behind`: integer\n  * `has_unpushed_changes`: boolean\n  * `has_uncommitted_changes`: boolean\n  * `ref`: string\n* `location`: required, string, enum: `EastUs`, `SouthEastAsia`, `WestEurope`, `WestUs2`\n* `idle_timeout_minutes`: required, integer or null\n* `web_url`: required, string, format: uri\n* `machines_url`: required, string, format: uri\n* `start_url`: required, string, format: uri\n* `stop_url`: required, string, format: uri\n* `publish_url`: string or null, format: uri\n* `pulls_url`: required, string or null, format: uri\n* `recent_folders`: required, array of string\n* `runtime_constraints`: object:\n  * `allowed_port_privacy_settings`: array of string or null\n* `pending_operation`: boolean or null\n* `pending_operation_disabled_reason`: string or null\n* `idle_timeout_notice`: string or null\n* `retention_period_minutes`: integer or null\n* `retention_expires_at`: string or null, format: date-time\n* `last_known_stop_notice`: string or null\n\n## List devcontainer configurations in a repository for the authenticated user\n\n```\nGET /repos/{owner}/{repo}/codespaces/devcontainers\n```\n\nLists the devcontainer.json files associated with a specified repository and the authenticated user. These files\nspecify launchpoint configurations for codespaces created within the repository.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **400** - Bad Request\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **500** - Internal Error\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/codespaces/devcontainers\n```\n\n**Response schema (Status: 200):**\n\n* `total_count`: required, integer\n* `devcontainers`: required, array of objects:\n  * `path`: required, string\n  * `name`: string\n  * `display_name`: string\n\n## Get default attributes for a codespace\n\n```\nGET /repos/{owner}/{repo}/codespaces/new\n```\n\nGets the default attributes for codespaces created by the user with the repository.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n* **`ref`** (string)\n  The branch or commit to check for a default devcontainer path. If not specified, the default branch will be checked.\n\n* **`client_ip`** (string)\n  An alternative IP for default location auto-detection, such as when proxying a request.\n\n### HTTP response status codes\n\n* **200** - Response when a user is able to create codespaces from the repository.\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/codespaces/new\n```\n\n**Response schema (Status: 200):**\n\n* `billable_owner`: `Simple User`:\n  * `name`: string or null\n  * `email`: string or null\n  * `login`: required, string\n  * `id`: required, integer, format: int64\n  * `node_id`: required, string\n  * `avatar_url`: required, string, format: uri\n  * `gravatar_id`: required, string or null\n  * `url`: required, string, format: uri\n  * `html_url`: required, string, format: uri\n  * `followers_url`: required, string, format: uri\n  * `following_url`: required, string\n  * `gists_url`: required, string\n  * `starred_url`: required, string\n  * `subscriptions_url`: required, string, format: uri\n  * `organizations_url`: required, string, format: uri\n  * `repos_url`: required, string, format: uri\n  * `events_url`: required, string\n  * `received_events_url`: required, string, format: uri\n  * `type`: required, string\n  * `site_admin`: required, boolean\n  * `starred_at`: string\n  * `user_view_type`: string\n* `defaults`: object:\n  * `location`: required, string\n  * `devcontainer_path`: required, string or null\n\n## Check if permissions defined by a devcontainer have been accepted by the authenticated user\n\n```\nGET /repos/{owner}/{repo}/codespaces/permissions_check\n```\n\nChecks whether the permissions defined by a given devcontainer configuration have been accepted by the authenticated user.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n* **`ref`** (string) (required)\n  The git reference that points to the location of the devcontainer configuration to use for the permission check. The value of ref will typically be a branch name (heads/BRANCH\\_NAME). For more information, see \"Git References\" in the Git documentation.\n\n* **`devcontainer_path`** (string) (required)\n  Path to the devcontainer.json configuration to use for the permission check.\n\n### HTTP response status codes\n\n* **200** - Response when the permission check is successful\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **422** - Validation failed, or the endpoint has been spammed.\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/codespaces/permissions_check\n```\n\n**Response schema (Status: 200):**\n\n* `accepted`: required, boolean\n\n## Create a codespace from a pull request\n\n```\nPOST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces\n```\n\nCreates a codespace owned by the authenticated user for the specified pull request.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n* **`pull_number`** (integer) (required)\n  The number that identifies the pull request.\n\n#### Body parameters\n\n* **`location`** (string)\n  The requested location for a new codespace. Best efforts are made to respect this upon creation. Assigned by IP if not provided.\n\n* **`geo`** (string)\n  The geographic area for this codespace. If not specified, the value is assigned by IP. This property replaces location, which is closing down.\n  Can be one of: `EuropeWest`, `SoutheastAsia`, `UsEast`, `UsWest`\n\n* **`client_ip`** (string)\n  IP for location auto-detection when proxying a request\n\n* **`machine`** (string)\n  Machine type to use for this codespace\n\n* **`devcontainer_path`** (string)\n  Path to devcontainer.json config to use for this codespace\n\n* **`multi_repo_permissions_opt_out`** (boolean)\n  Whether to authorize requested permissions from devcontainer.json\n\n* **`working_directory`** (string)\n  Working directory for this codespace\n\n* **`idle_timeout_minutes`** (integer)\n  Time in minutes before codespace stops from inactivity\n\n* **`display_name`** (string)\n  Display name for this codespace\n\n* **`retention_period_minutes`** (integer)\n  Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days).\n\n### HTTP response status codes\n\n* **201** - Response when the codespace was successfully created\n\n* **202** - Response when the codespace creation partially failed but is being retried in the background\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example 1: Status Code 201\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/codespaces \\\n  -d '{\n  \"repository_id\": 1,\n  \"ref\": \"main\"\n}'\n```\n\n**Response schema (Status: 201):**\n\nSame response schema as [Create a codespace in a repository](#create-a-codespace-in-a-repository).\n\n#### Example 2: Status Code 202\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/codespaces \\\n  -d '{\n  \"repository_id\": 1,\n  \"ref\": \"main\"\n}'\n```\n\n**Response schema (Status: 202):**\n\nSame response schema as [Create a codespace in a repository](#create-a-codespace-in-a-repository).\n\n## List codespaces for the authenticated user\n\n```\nGET /user/codespaces\n```\n\nLists the authenticated user's codespaces.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n* **`repository_id`** (integer)\n  ID of the Repository to filter on\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **500** - Internal Error\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/user/codespaces\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [List codespaces in a repository for the authenticated user](#list-codespaces-in-a-repository-for-the-authenticated-user).\n\n## Create a codespace for the authenticated user\n\n```\nPOST /user/codespaces\n```\n\nCreates a new codespace, owned by the authenticated user.\nThis endpoint requires either a repository\\_id OR a pull\\_request but not both.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Body parameters\n\n* **`repository_id`** (integer) (required)\n  Repository id for this codespace\n\n* **`ref`** (string)\n  Git ref (typically a branch name) for this codespace\n\n* **`location`** (string)\n  The requested location for a new codespace. Best efforts are made to respect this upon creation. Assigned by IP if not provided.\n\n* **`geo`** (string)\n  The geographic area for this codespace. If not specified, the value is assigned by IP. This property replaces location, which is closing down.\n  Can be one of: `EuropeWest`, `SoutheastAsia`, `UsEast`, `UsWest`\n\n* **`client_ip`** (string)\n  IP for location auto-detection when proxying a request\n\n* **`machine`** (string)\n  Machine type to use for this codespace\n\n* **`devcontainer_path`** (string)\n  Path to devcontainer.json config to use for this codespace\n\n* **`multi_repo_permissions_opt_out`** (boolean)\n  Whether to authorize requested permissions from devcontainer.json\n\n* **`working_directory`** (string)\n  Working directory for this codespace\n\n* **`idle_timeout_minutes`** (integer)\n  Time in minutes before codespace stops from inactivity\n\n* **`display_name`** (string)\n  Display name for this codespace\n\n* **`retention_period_minutes`** (integer)\n  Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days).\n\n* **`pull_request`** (object) (required)\n  Pull request number for this codespace\n  * **`pull_request_number`** (integer) (required)\n    Pull request number\n  * **`repository_id`** (integer) (required)\n    Repository id for this codespace\n\n### HTTP response status codes\n\n* **201** - Response when the codespace was successfully created\n\n* **202** - Response when the codespace creation partially failed but is being retried in the background\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example 1: Status Code 201\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/user/codespaces \\\n  -d '{\n  \"repository_id\": 1,\n  \"ref\": \"main\",\n  \"geo\": \"UsWest\"\n}'\n```\n\n**Response schema (Status: 201):**\n\nSame response schema as [Create a codespace in a repository](#create-a-codespace-in-a-repository).\n\n#### Example 2: Status Code 202\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/user/codespaces \\\n  -d '{\n  \"repository_id\": 1,\n  \"ref\": \"main\",\n  \"geo\": \"UsWest\"\n}'\n```\n\n**Response schema (Status: 202):**\n\nSame response schema as [Create a codespace in a repository](#create-a-codespace-in-a-repository).\n\n## Get a codespace for the authenticated user\n\n```\nGET /user/codespaces/{codespace_name}\n```\n\nGets information about a user's codespace.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`codespace_name`** (string) (required)\n  The name of the codespace.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **500** - Internal Error\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/user/codespaces/CODESPACE_NAME\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Create a codespace in a repository](#create-a-codespace-in-a-repository).\n\n## Update a codespace for the authenticated user\n\n```\nPATCH /user/codespaces/{codespace_name}\n```\n\nUpdates a codespace owned by the authenticated user. Currently only the codespace's machine type and recent folders can be modified using this endpoint.\nIf you specify a new machine type it will be applied the next time your codespace is started.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`codespace_name`** (string) (required)\n  The name of the codespace.\n\n#### Body parameters\n\n* **`machine`** (string)\n  A valid machine to transition this codespace to.\n\n* **`display_name`** (string)\n  Display name for this codespace\n\n* **`recent_folders`** (array of strings)\n  Recently opened folders inside the codespace. It is currently used by the clients to determine the folder path to load the codespace in.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PATCH \\\n  https://api.github.com/user/codespaces/CODESPACE_NAME \\\n  -d '{\n  \"machine\": \"standardLinux\"\n}'\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Create a codespace in a repository](#create-a-codespace-in-a-repository).\n\n## Delete a codespace for the authenticated user\n\n```\nDELETE /user/codespaces/{codespace_name}\n```\n\nDeletes a user's codespace.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`codespace_name`** (string) (required)\n  The name of the codespace.\n\n### HTTP response status codes\n\n* **202** - Accepted\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **500** - Internal Error\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/user/codespaces/CODESPACE_NAME\n```\n\n**Response schema (Status: 202):**\n\nobject\n\n## Export a codespace for the authenticated user\n\n```\nPOST /user/codespaces/{codespace_name}/exports\n```\n\nTriggers an export of the specified codespace and returns a URL and ID where the status of the export can be monitored.\nIf changes cannot be pushed to the codespace's repository, they will be pushed to a new or previously-existing fork instead.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`codespace_name`** (string) (required)\n  The name of the codespace.\n\n### HTTP response status codes\n\n* **202** - Accepted\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **422** - Validation failed, or the endpoint has been spammed.\n\n* **500** - Internal Error\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/user/codespaces/CODESPACE_NAME/exports\n```\n\n**Response schema (Status: 202):**\n\n* `state`: string or null\n* `completed_at`: string or null, format: date-time\n* `branch`: string or null\n* `sha`: string or null\n* `id`: string\n* `export_url`: string\n* `html_url`: string or null\n\n## Get details about a codespace export\n\n```\nGET /user/codespaces/{codespace_name}/exports/{export_id}\n```\n\nGets information about an export of a codespace.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`codespace_name`** (string) (required)\n  The name of the codespace.\n\n* **`export_id`** (string) (required)\n  The ID of the export operation, or latest. Currently only latest is currently supported.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/user/codespaces/CODESPACE_NAME/exports/EXPORT_ID\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Export a codespace for the authenticated user](#export-a-codespace-for-the-authenticated-user).\n\n## Create a repository from an unpublished codespace\n\n```\nPOST /user/codespaces/{codespace_name}/publish\n```\n\nPublishes an unpublished codespace, creating a new repository and assigning it to the codespace.\nThe codespace's token is granted write permissions to the repository, allowing the user to push their changes.\nThis will fail for a codespace that is already published, meaning it has an associated repository.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`codespace_name`** (string) (required)\n  The name of the codespace.\n\n#### Body parameters\n\n* **`name`** (string)\n  A name for the new repository.\n\n* **`private`** (boolean)\n  Whether the new repository should be private.\n  Default: `false`\n\n### HTTP response status codes\n\n* **201** - Created\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **422** - Validation failed, or the endpoint has been spammed.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/user/codespaces/CODESPACE_NAME/publish \\\n  -d '{\n  \"repository\": \"monalisa-octocat-hello-world-g4wpq6h95q\",\n  \"private\": false\n}'\n```\n\n**Response schema (Status: 201):**\n\n* `id`: required, integer, format: int64\n* `name`: required, string\n* `display_name`: string or null\n* `environment_id`: required, string or null\n* `owner`: required, `Simple User`:\n  * `name`: string or null\n  * `email`: string or null\n  * `login`: required, string\n  * `id`: required, integer, format: int64\n  * `node_id`: required, string\n  * `avatar_url`: required, string, format: uri\n  * `gravatar_id`: required, string or null\n  * `url`: required, string, format: uri\n  * `html_url`: required, string, format: uri\n  * `followers_url`: required, string, format: uri\n  * `following_url`: required, string\n  * `gists_url`: required, string\n  * `starred_url`: required, string\n  * `subscriptions_url`: required, string, format: uri\n  * `organizations_url`: required, string, format: uri\n  * `repos_url`: required, string, format: uri\n  * `events_url`: required, string\n  * `received_events_url`: required, string, format: uri\n  * `type`: required, string\n  * `site_admin`: required, boolean\n  * `starred_at`: string\n  * `user_view_type`: string\n* `billable_owner`: required, `Simple User` (see above)\n* `repository`: required, `Full Repository`:\n  * `id`: required, integer, format: int64\n  * `node_id`: required, string\n  * `name`: required, string\n  * `full_name`: required, string\n  * `owner`: required, `Simple User` (see above)\n  * `private`: required, boolean\n  * `html_url`: required, string, format: uri\n  * `description`: required, string or null\n  * `fork`: required, boolean\n  * `url`: required, string, format: uri\n  * `archive_url`: required, string\n  * `assignees_url`: required, string\n  * `blobs_url`: required, string\n  * `branches_url`: required, string\n  * `collaborators_url`: required, string\n  * `comments_url`: required, string\n  * `commits_url`: required, string\n  * `compare_url`: required, string\n  * `contents_url`: required, string\n  * `contributors_url`: required, string, format: uri\n  * `deployments_url`: required, string, format: uri\n  * `downloads_url`: required, string, format: uri\n  * `events_url`: required, string, format: uri\n  * `forks_url`: required, string, format: uri\n  * `git_commits_url`: required, string\n  * `git_refs_url`: required, string\n  * `git_tags_url`: required, string\n  * `git_url`: required, string\n  * `issue_comment_url`: required, string\n  * `issue_events_url`: required, string\n  * `issues_url`: required, string\n  * `keys_url`: required, string\n  * `labels_url`: required, string\n  * `languages_url`: required, string, format: uri\n  * `merges_url`: required, string, format: uri\n  * `milestones_url`: required, string\n  * `notifications_url`: required, string\n  * `pulls_url`: required, string\n  * `releases_url`: required, string\n  * `ssh_url`: required, string\n  * `stargazers_url`: required, string, format: uri\n  * `statuses_url`: required, string\n  * `subscribers_url`: required, string, format: uri\n  * `subscription_url`: required, string, format: uri\n  * `tags_url`: required, string, format: uri\n  * `teams_url`: required, string, format: uri\n  * `trees_url`: required, string\n  * `clone_url`: required, string\n  * `mirror_url`: required, string or null, format: uri\n  * `hooks_url`: required, string, format: uri\n  * `svn_url`: required, string, format: uri\n  * `homepage`: required, string or null, format: uri\n  * `language`: required, string or null\n  * `forks_count`: required, integer\n  * `stargazers_count`: required, integer\n  * `watchers_count`: required, integer\n  * `size`: required, integer\n  * `default_branch`: required, string\n  * `open_issues_count`: required, integer\n  * `is_template`: boolean\n  * `topics`: array of string\n  * `has_issues`: required, boolean\n  * `has_projects`: required, boolean\n  * `has_wiki`: required, boolean\n  * `has_pages`: required, boolean\n  * `has_discussions`: required, boolean\n  * `has_pull_requests`: boolean\n  * `pull_request_creation_policy`: string, enum: `all`, `collaborators_only`\n  * `archived`: required, boolean\n  * `disabled`: required, boolean\n  * `visibility`: string\n  * `pushed_at`: required, string, format: date-time\n  * `created_at`: required, string, format: date-time\n  * `updated_at`: required, string, format: date-time\n  * `permissions`: object:\n    * `admin`: required, boolean\n    * `maintain`: boolean\n    * `push`: required, boolean\n    * `triage`: boolean\n    * `pull`: required, boolean\n  * `allow_rebase_merge`: boolean\n  * `template_repository`: any of:\n    * **null**\n    * **Repository**\n      * `id`: required, integer, format: int64\n      * `node_id`: required, string\n      * `name`: required, string\n      * `full_name`: required, string\n      * `license`: required, any of:\n        * **null**\n        * **License Simple**\n          * `key`: required, string\n          * `name`: required, string\n          * `url`: required, string or null, format: uri\n          * `spdx_id`: required, string or null\n          * `node_id`: required, string\n          * `html_url`: string, format: uri\n      * `forks`: required, integer\n      * `permissions`: object:\n        * `admin`: required, boolean\n        * `pull`: required, boolean\n        * `triage`: boolean\n        * `push`: required, boolean\n        * `maintain`: boolean\n      * `owner`: required, `Simple User` (see above)\n      * `private`: required, boolean, default: `false`\n      * `html_url`: required, string, format: uri\n      * `description`: required, string or null\n      * `fork`: required, boolean\n      * `url`: required, string, format: uri\n      * `archive_url`: required, string\n      * `assignees_url`: required, string\n      * `blobs_url`: required, string\n      * `branches_url`: required, string\n      * `collaborators_url`: required, string\n      * `comments_url`: required, string\n      * `commits_url`: required, string\n      * `compare_url`: required, string\n      * `contents_url`: required, string\n      * `contributors_url`: required, string, format: uri\n      * `deployments_url`: required, string, format: uri\n      * `downloads_url`: required, string, format: uri\n      * `events_url`: required, string, format: uri\n      * `forks_url`: required, string, format: uri\n      * `git_commits_url`: required, string\n      * `git_refs_url`: required, string\n      * `git_tags_url`: required, string\n      * `git_url`: required, string\n      * `issue_comment_url`: required, string\n      * `issue_events_url`: required, string\n      * `issues_url`: required, string\n      * `keys_url`: required, string\n      * `labels_url`: required, string\n      * `languages_url`: required, string, format: uri\n      * `merges_url`: required, string, format: uri\n      * `milestones_url`: required, string\n      * `notifications_url`: required, string\n      * `pulls_url`: required, string\n      * `releases_url`: required, string\n      * `ssh_url`: required, string\n      * `stargazers_url`: required, string, format: uri\n      * `statuses_url`: required, string\n      * `subscribers_url`: required, string, format: uri\n      * `subscription_url`: required, string, format: uri\n      * `tags_url`: required, string, format: uri\n      * `teams_url`: required, string, format: uri\n      * `trees_url`: required, string\n      * `clone_url`: required, string\n      * `mirror_url`: required, string or null, format: uri\n      * `hooks_url`: required, string, format: uri\n      * `svn_url`: required, string, format: uri\n      * `homepage`: required, string or null, format: uri\n      * `language`: required, string or null\n      * `forks_count`: required, integer\n      * `stargazers_count`: required, integer\n      * `watchers_count`: required, integer\n      * `size`: required, integer\n      * `default_branch`: required, string\n      * `open_issues_count`: required, integer\n      * `is_template`: boolean, default: `false`\n      * `topics`: array of string\n      * `has_issues`: required, boolean, default: `true`\n      * `has_projects`: required, boolean, default: `true`\n      * `has_wiki`: required, boolean, default: `true`\n      * `has_pages`: required, boolean\n      * `has_discussions`: boolean, default: `false`\n      * `has_pull_requests`: boolean, default: `true`\n      * `pull_request_creation_policy`: string, enum: `all`, `collaborators_only`\n      * `archived`: required, boolean, default: `false`\n      * `disabled`: required, boolean\n      * `visibility`: string, default: `\"public\"`\n      * `pushed_at`: required, string or null, format: date-time\n      * `created_at`: required, string or null, format: date-time\n      * `updated_at`: required, string or null, format: date-time\n      * `allow_rebase_merge`: boolean, default: `true`\n      * `temp_clone_token`: string\n      * `allow_squash_merge`: boolean, default: `true`\n      * `allow_auto_merge`: boolean, default: `false`\n      * `delete_branch_on_merge`: boolean, default: `false`\n      * `allow_update_branch`: boolean, default: `false`\n      * `squash_merge_commit_title`: string, enum: `PR_TITLE`, `COMMIT_OR_PR_TITLE`\n      * `squash_merge_commit_message`: string, enum: `PR_BODY`, `COMMIT_MESSAGES`, `BLANK`\n      * `merge_commit_title`: string, enum: `PR_TITLE`, `MERGE_MESSAGE`\n      * `merge_commit_message`: string, enum: `PR_BODY`, `PR_TITLE`, `BLANK`\n      * `allow_merge_commit`: boolean, default: `true`\n      * `allow_forking`: boolean\n      * `web_commit_signoff_required`: boolean, default: `false`\n      * `open_issues`: required, integer\n      * `watchers`: required, integer\n      * `starred_at`: string\n      * `anonymous_access_enabled`: boolean\n      * `code_search_index_status`: object:\n        * `lexical_search_ok`: boolean\n        * `lexical_commit_sha`: string\n  * `temp_clone_token`: string or null\n  * `allow_squash_merge`: boolean\n  * `allow_auto_merge`: boolean\n  * `delete_branch_on_merge`: boolean\n  * `allow_merge_commit`: boolean\n  * `allow_update_branch`: boolean\n  * `squash_merge_commit_title`: string, enum: `PR_TITLE`, `COMMIT_OR_PR_TITLE`\n  * `squash_merge_commit_message`: string, enum: `PR_BODY`, `COMMIT_MESSAGES`, `BLANK`\n  * `merge_commit_title`: string, enum: `PR_TITLE`, `MERGE_MESSAGE`\n  * `merge_commit_message`: string, enum: `PR_BODY`, `PR_TITLE`, `BLANK`\n  * `allow_forking`: boolean\n  * `web_commit_signoff_required`: boolean\n  * `subscribers_count`: required, integer\n  * `network_count`: required, integer\n  * `license`: required, any of:\n    * **null**\n    * **License Simple** (see above)\n  * `organization`: any of:\n    * **null**\n    * **Simple User** (see above)\n  * `parent`: `Repository` (see above)\n  * `source`: `Repository` (see above)\n  * `forks`: required, integer\n  * `master_branch`: string\n  * `open_issues`: required, integer\n  * `watchers`: required, integer\n  * `anonymous_access_enabled`: boolean, default: `true`\n  * `code_of_conduct`: `Code Of Conduct Simple`:\n    * `url`: required, string, format: uri\n    * `key`: required, string\n    * `name`: required, string\n    * `html_url`: required, string or null, format: uri\n  * `security_and_analysis`: object or null:\n    * `advanced_security`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `code_security`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `dependabot_security_updates`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_push_protection`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_non_provider_patterns`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_ai_detection`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_delegated_alert_dismissal`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_delegated_bypass`: object:\n      * `status`: string, enum: `enabled`, `disabled`\n    * `secret_scanning_delegated_bypass_options`: object:\n      * `reviewers`: array of objects:\n        * `reviewer_id`: required, integer\n        * `reviewer_type`: required, string, enum: `TEAM`, `ROLE`\n        * `mode`: string, enum: `ALWAYS`, `EXEMPT`, default: `\"ALWAYS\"`\n  * `custom_properties`: object, additional properties allowed\n* `machine`: required, any of:\n  * **null**\n  * **Codespace machine**\n    * `name`: required, string\n    * `display_name`: required, string\n    * `operating_system`: required, string\n    * `storage_in_bytes`: required, integer\n    * `memory_in_bytes`: required, integer\n    * `cpus`: required, integer\n    * `prebuild_availability`: required, string or null, enum: `none`, `ready`, `in_progress`, `null`\n* `devcontainer_path`: string or null\n* `prebuild`: required, boolean or null\n* `created_at`: required, string, format: date-time\n* `updated_at`: required, string, format: date-time\n* `last_used_at`: required, string, format: date-time\n* `state`: required, string, enum: `Unknown`, `Created`, `Queued`, `Provisioning`, `Available`, `Awaiting`, `Unavailable`, `Deleted`, `Moved`, `Shutdown`, `Archived`, `Starting`, `ShuttingDown`, `Failed`, `Exporting`, `Updating`, `Rebuilding`\n* `url`: required, string, format: uri\n* `git_status`: required, object:\n  * `ahead`: integer\n  * `behind`: integer\n  * `has_unpushed_changes`: boolean\n  * `has_uncommitted_changes`: boolean\n  * `ref`: string\n* `location`: required, string, enum: `EastUs`, `SouthEastAsia`, `WestEurope`, `WestUs2`\n* `idle_timeout_minutes`: required, integer or null\n* `web_url`: required, string, format: uri\n* `machines_url`: required, string, format: uri\n* `start_url`: required, string, format: uri\n* `stop_url`: required, string, format: uri\n* `publish_url`: string or null, format: uri\n* `pulls_url`: required, string or null, format: uri\n* `recent_folders`: required, array of string\n* `runtime_constraints`: object:\n  * `allowed_port_privacy_settings`: array of string or null\n* `pending_operation`: boolean or null\n* `pending_operation_disabled_reason`: string or null\n* `idle_timeout_notice`: string or null\n* `retention_period_minutes`: integer or null\n* `retention_expires_at`: string or null, format: date-time\n\n## Start a codespace for the authenticated user\n\n```\nPOST /user/codespaces/{codespace_name}/start\n```\n\nStarts a user's codespace.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`codespace_name`** (string) (required)\n  The name of the codespace.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n* **400** - Bad Request\n\n* **401** - Requires authentication\n\n* **402** - Payment required\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **409** - Conflict\n\n* **500** - Internal Error\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/user/codespaces/CODESPACE_NAME/start\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Create a codespace in a repository](#create-a-codespace-in-a-repository).\n\n## Stop a codespace for the authenticated user\n\n```\nPOST /user/codespaces/{codespace_name}/stop\n```\n\nStops a user's codespace.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`codespace_name`** (string) (required)\n  The name of the codespace.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **500** - Internal Error\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/user/codespaces/CODESPACE_NAME/stop\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Create a codespace in a repository](#create-a-codespace-in-a-repository)."}