---
title: "Create a repository from an unpublished codespace"
method: POST
path: "/user/codespaces/{codespace_name}/publish"
tags: ["codespaces"]
---

# Create a repository from an unpublished codespace

`POST /user/codespaces/{codespace_name}/publish`

Publishes an unpublished codespace, creating a new repository and assigning it to the codespace.

The codespace's token is granted write permissions to the repository, allowing the user to push their changes.

This will fail for a codespace that is already published, meaning it has an associated repository.

OAuth app tokens and personal access tokens (classic) need the `codespace` scope to use this endpoint.

## Path parameters

- `codespace_name` string, required

## Request body

- object
  - `name` string — A name for the new repository.
  - `private` boolean — Whether the new repository should be private.

## Response `201`

Response

- CodespaceWithFullRepository — A codespace.
  - `id` integer, required
  - `name` string, required — Automatically generated name of this codespace.
  - `display_name` string, nullable — Display name for this codespace.
  - `environment_id` string, nullable, required — UUID identifying this codespace's environment.
  - `owner` SimpleUser, required — A GitHub user.
    - `name` string, nullable
    - `email` string, nullable
    - `login` string, required
    - `id` integer, required
    - `node_id` string, required
    - `avatar_url` string, uri, required
    - `gravatar_id` string, nullable, required
    - `url` string, uri, required
    - `html_url` string, uri, required
    - `followers_url` string, uri, required
    - `following_url` string, required
    - `gists_url` string, required
    - `starred_url` string, required
    - `subscriptions_url` string, uri, required
    - `organizations_url` string, uri, required
    - `repos_url` string, uri, required
    - `events_url` string, required
    - `received_events_url` string, uri, required
    - `type` string, required
    - `site_admin` boolean, required
    - `starred_at` string
    - `user_view_type` string
  - `billable_owner` SimpleUser, required — A GitHub user.
    - `name` string, nullable
    - `email` string, nullable
    - `login` string, required
    - `id` integer, required
    - `node_id` string, required
    - `avatar_url` string, uri, required
    - `gravatar_id` string, nullable, required
    - `url` string, uri, required
    - `html_url` string, uri, required
    - `followers_url` string, uri, required
    - `following_url` string, required
    - `gists_url` string, required
    - `starred_url` string, required
    - `subscriptions_url` string, uri, required
    - `organizations_url` string, uri, required
    - `repos_url` string, uri, required
    - `events_url` string, required
    - `received_events_url` string, uri, required
    - `type` string, required
    - `site_admin` boolean, required
    - `starred_at` string
    - `user_view_type` string
  - `repository` FullRepository, required — Full Repository
    - `id` integer, required
    - `node_id` string, required
    - `name` string, required
    - `full_name` string, required
    - `owner` SimpleUser, required — A GitHub user.
      - `name` string, nullable
      - `email` string, nullable
      - `login` string, required
      - `id` integer, required
      - `node_id` string, required
      - `avatar_url` string, uri, required
      - `gravatar_id` string, nullable, required
      - `url` string, uri, required
      - `html_url` string, uri, required
      - `followers_url` string, uri, required
      - `following_url` string, required
      - `gists_url` string, required
      - `starred_url` string, required
      - `subscriptions_url` string, uri, required
      - `organizations_url` string, uri, required
      - `repos_url` string, uri, required
      - `events_url` string, required
      - `received_events_url` string, uri, required
      - `type` string, required
      - `site_admin` boolean, required
      - `starred_at` string
      - `user_view_type` string
    - `private` boolean, required
    - `html_url` string, uri, required
    - `description` string, nullable, required
    - `fork` boolean, required
    - `url` string, uri, required
    - `archive_url` string, required
    - `assignees_url` string, required
    - `blobs_url` string, required
    - `branches_url` string, required
    - `collaborators_url` string, required
    - `comments_url` string, required
    - `commits_url` string, required
    - `compare_url` string, required
    - `contents_url` string, required
    - `contributors_url` string, uri, required
    - `deployments_url` string, uri, required
    - `downloads_url` string, uri, required
    - `events_url` string, uri, required
    - `forks_url` string, uri, required
    - `git_commits_url` string, required
    - `git_refs_url` string, required
    - `git_tags_url` string, required
    - `git_url` string, required
    - `issue_comment_url` string, required
    - `issue_events_url` string, required
    - `issues_url` string, required
    - `keys_url` string, required
    - `labels_url` string, required
    - `languages_url` string, uri, required
    - `merges_url` string, uri, required
    - `milestones_url` string, required
    - `notifications_url` string, required
    - `pulls_url` string, required
    - `releases_url` string, required
    - `ssh_url` string, required
    - `stargazers_url` string, uri, required
    - `statuses_url` string, required
    - `subscribers_url` string, uri, required
    - `subscription_url` string, uri, required
    - `tags_url` string, uri, required
    - `teams_url` string, uri, required
    - `trees_url` string, required
    - `clone_url` string, required
    - `mirror_url` string, uri, nullable, required
    - `hooks_url` string, uri, required
    - `svn_url` string, uri, required
    - `homepage` string, uri, nullable, required
    - `language` string, nullable, required
    - `forks_count` integer, required
    - `stargazers_count` integer, required
    - `watchers_count` integer, required
    - `size` integer, required — The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0.
    - `default_branch` string, required
    - `open_issues_count` integer, required
    - `is_template` boolean
    - `topics` string[]
    - `has_issues` boolean, required
    - `has_projects` boolean, required
    - `has_wiki` boolean, required
    - `has_pages` boolean, required
    - `has_downloads` boolean
    - `has_discussions` boolean, required
    - `has_pull_requests` boolean
    - `pull_request_creation_policy` 'all' | 'collaborators_only' — The policy controlling who can create pull requests: all or collaborators_only.
    - `archived` boolean, required
    - `disabled` boolean, required — Returns whether or not this repository disabled.
    - `visibility` string — The repository visibility: public, private, or internal.
    - `pushed_at` string, date-time, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
    - `permissions` object
      - `admin` boolean, required
      - `maintain` boolean
      - `push` boolean, required
      - `triage` boolean
      - `pull` boolean, required
    - `allow_rebase_merge` boolean
    - `template_repository` NullableRepository, nullable — A repository on GitHub.
      - `id` integer, required — Unique identifier of the repository
      - `node_id` string, required
      - `name` string, required — The name of the repository.
      - `full_name` string, required
      - `license` NullableLicenseSimple, nullable, required — License Simple
        - `key` string, required
        - `name` string, required
        - `url` string, uri, nullable, required
        - `spdx_id` string, nullable, required
        - `node_id` string, required
        - `html_url` string, uri
      - `forks` integer, required
      - `permissions` object
        - `admin` boolean, required
        - `pull` boolean, required
        - `triage` boolean
        - `push` boolean, required
        - `maintain` boolean
      - `owner` SimpleUser, required — A GitHub user.
        - `name` string, nullable
        - `email` string, nullable
        - `login` string, required
        - `id` integer, required
        - `node_id` string, required
        - `avatar_url` string, uri, required
        - `gravatar_id` string, nullable, required
        - `url` string, uri, required
        - `html_url` string, uri, required
        - `followers_url` string, uri, required
        - `following_url` string, required
        - `gists_url` string, required
        - `starred_url` string, required
        - `subscriptions_url` string, uri, required
        - `organizations_url` string, uri, required
        - `repos_url` string, uri, required
        - `events_url` string, required
        - `received_events_url` string, uri, required
        - `type` string, required
        - `site_admin` boolean, required
        - `starred_at` string
        - `user_view_type` string
      - `private` boolean, required — Whether the repository is private or public.
      - `html_url` string, uri, required
      - `description` string, nullable, required
      - `fork` boolean, required
      - `url` string, uri, required
      - `archive_url` string, required
      - `assignees_url` string, required
      - `blobs_url` string, required
      - `branches_url` string, required
      - `collaborators_url` string, required
      - `comments_url` string, required
      - `commits_url` string, required
      - `compare_url` string, required
      - `contents_url` string, required
      - `contributors_url` string, uri, required
      - `deployments_url` string, uri, required
      - `downloads_url` string, uri, required
      - `events_url` string, uri, required
      - `forks_url` string, uri, required
      - `git_commits_url` string, required
      - `git_refs_url` string, required
      - `git_tags_url` string, required
      - `git_url` string, required
      - `issue_comment_url` string, required
      - `issue_events_url` string, required
      - `issues_url` string, required
      - `keys_url` string, required
      - `labels_url` string, required
      - `languages_url` string, uri, required
      - `merges_url` string, uri, required
      - `milestones_url` string, required
      - `notifications_url` string, required
      - `pulls_url` string, required
      - `releases_url` string, required
      - `ssh_url` string, required
      - `stargazers_url` string, uri, required
      - `statuses_url` string, required
      - `subscribers_url` string, uri, required
      - `subscription_url` string, uri, required
      - `tags_url` string, uri, required
      - `teams_url` string, uri, required
      - `trees_url` string, required
      - `clone_url` string, required
      - `mirror_url` string, uri, nullable, required
      - `hooks_url` string, uri, required
      - `svn_url` string, uri, required
      - `homepage` string, uri, nullable, required
      - `language` string, nullable, required
      - `forks_count` integer, required
      - `stargazers_count` integer, required
      - `watchers_count` integer, required
      - `size` integer, required — The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0.
      - `default_branch` string, required — The default branch of the repository.
      - `open_issues_count` integer, required
      - `is_template` boolean — Whether this repository acts as a template that can be used to generate new repositories.
      - `topics` string[]
      - `has_issues` boolean, required — Whether issues are enabled.
      - `has_projects` boolean, required — Whether projects are enabled.
      - `has_wiki` boolean, required — Whether the wiki is enabled.
      - `has_pages` boolean, required
      - `has_downloads` boolean, required — Whether downloads are enabled.
      - `has_discussions` boolean — Whether discussions are enabled.
      - `has_pull_requests` boolean — Whether pull requests are enabled.
      - `pull_request_creation_policy` 'all' | 'collaborators_only' — The policy controlling who can create pull requests: all or collaborators_only.
      - `archived` boolean, required — Whether the repository is archived.
      - `disabled` boolean, required — Returns whether or not this repository disabled.
      - `visibility` string — The repository visibility: public, private, or internal.
      - `pushed_at` string, date-time, nullable, required
      - `created_at` string, date-time, nullable, required
      - `updated_at` string, date-time, nullable, required
      - `allow_rebase_merge` boolean — Whether to allow rebase merges for pull requests.
      - `temp_clone_token` string
      - `allow_squash_merge` boolean — Whether to allow squash merges for pull requests.
      - `allow_auto_merge` boolean — Whether to allow Auto-merge to be used on pull requests.
      - `delete_branch_on_merge` boolean — Whether to delete head branches when pull requests are merged
      - `allow_update_branch` boolean — Whether or not a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging.
      - `use_squash_pr_title_as_default` boolean — Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead.
      - `squash_merge_commit_title` 'PR_TITLE' | 'COMMIT_OR_PR_TITLE' — The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).
      - `squash_merge_commit_message` 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK' — The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message.
      - `merge_commit_title` 'PR_TITLE' | 'MERGE_MESSAGE' — The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).
      - `merge_commit_message` 'PR_BODY' | 'PR_TITLE' | 'BLANK' — The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message.
      - `allow_merge_commit` boolean — Whether to allow merge commits for pull requests.
      - `allow_forking` boolean — Whether to allow forking this repo
      - `web_commit_signoff_required` boolean — Whether to require contributors to sign off on web-based commits
      - `open_issues` integer, required
      - `watchers` integer, required
      - `master_branch` string
      - `starred_at` string
      - `anonymous_access_enabled` boolean — Whether anonymous git access is enabled for this repository
      - `code_search_index_status` object — The status of the code search index for this repository
        - `lexical_search_ok` boolean
        - `lexical_commit_sha` string
    - `temp_clone_token` string, nullable
    - `allow_squash_merge` boolean
    - `allow_auto_merge` boolean
    - `delete_branch_on_merge` boolean
    - `allow_merge_commit` boolean
    - `allow_update_branch` boolean
    - `use_squash_pr_title_as_default` boolean
    - `squash_merge_commit_title` 'PR_TITLE' | 'COMMIT_OR_PR_TITLE' — The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).
    - `squash_merge_commit_message` 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK' — The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message.
    - `merge_commit_title` 'PR_TITLE' | 'MERGE_MESSAGE' — The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).
    - `merge_commit_message` 'PR_BODY' | 'PR_TITLE' | 'BLANK' — The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message.
    - `allow_forking` boolean
    - `web_commit_signoff_required` boolean
    - `subscribers_count` integer, required
    - `network_count` integer, required
    - `license` NullableLicenseSimple, nullable, required — License Simple
      - `key` string, required
      - `name` string, required
      - `url` string, uri, nullable, required
      - `spdx_id` string, nullable, required
      - `node_id` string, required
      - `html_url` string, uri
    - `organization` NullableSimpleUser, nullable — A GitHub user.
      - `name` string, nullable
      - `email` string, nullable
      - `login` string, required
      - `id` integer, required
      - `node_id` string, required
      - `avatar_url` string, uri, required
      - `gravatar_id` string, nullable, required
      - `url` string, uri, required
      - `html_url` string, uri, required
      - `followers_url` string, uri, required
      - `following_url` string, required
      - `gists_url` string, required
      - `starred_url` string, required
      - `subscriptions_url` string, uri, required
      - `organizations_url` string, uri, required
      - `repos_url` string, uri, required
      - `events_url` string, required
      - `received_events_url` string, uri, required
      - `type` string, required
      - `site_admin` boolean, required
      - `starred_at` string
      - `user_view_type` string
    - `parent` Repository — A repository on GitHub.
      - `id` integer, required — Unique identifier of the repository
      - `node_id` string, required
      - `name` string, required — The name of the repository.
      - `full_name` string, required
      - `license` NullableLicenseSimple, nullable, required — License Simple
        - `key` string, required
        - `name` string, required
        - `url` string, uri, nullable, required
        - `spdx_id` string, nullable, required
        - `node_id` string, required
        - `html_url` string, uri
      - `forks` integer, required
      - `permissions` object
        - `admin` boolean, required
        - `pull` boolean, required
        - `triage` boolean
        - `push` boolean, required
        - `maintain` boolean
      - `owner` SimpleUser, required — A GitHub user.
        - `name` string, nullable
        - `email` string, nullable
        - `login` string, required
        - `id` integer, required
        - `node_id` string, required
        - `avatar_url` string, uri, required
        - `gravatar_id` string, nullable, required
        - `url` string, uri, required
        - `html_url` string, uri, required
        - `followers_url` string, uri, required
        - `following_url` string, required
        - `gists_url` string, required
        - `starred_url` string, required
        - `subscriptions_url` string, uri, required
        - `organizations_url` string, uri, required
        - `repos_url` string, uri, required
        - `events_url` string, required
        - `received_events_url` string, uri, required
        - `type` string, required
        - `site_admin` boolean, required
        - `starred_at` string
        - `user_view_type` string
      - `private` boolean, required — Whether the repository is private or public.
      - `html_url` string, uri, required
      - `description` string, nullable, required
      - `fork` boolean, required
      - `url` string, uri, required
      - `archive_url` string, required
      - `assignees_url` string, required
      - `blobs_url` string, required
      - `branches_url` string, required
      - `collaborators_url` string, required
      - `comments_url` string, required
      - `commits_url` string, required
      - `compare_url` string, required
      - `contents_url` string, required
      - `contributors_url` string, uri, required
      - `deployments_url` string, uri, required
      - `downloads_url` string, uri, required
      - `events_url` string, uri, required
      - `forks_url` string, uri, required
      - `git_commits_url` string, required
      - `git_refs_url` string, required
      - `git_tags_url` string, required
      - `git_url` string, required
      - `issue_comment_url` string, required
      - `issue_events_url` string, required
      - `issues_url` string, required
      - `keys_url` string, required
      - `labels_url` string, required
      - `languages_url` string, uri, required
      - `merges_url` string, uri, required
      - `milestones_url` string, required
      - `notifications_url` string, required
      - `pulls_url` string, required
      - `releases_url` string, required
      - `ssh_url` string, required
      - `stargazers_url` string, uri, required
      - `statuses_url` string, required
      - `subscribers_url` string, uri, required
      - `subscription_url` string, uri, required
      - `tags_url` string, uri, required
      - `teams_url` string, uri, required
      - `trees_url` string, required
      - `clone_url` string, required
      - `mirror_url` string, uri, nullable, required
      - `hooks_url` string, uri, required
      - `svn_url` string, uri, required
      - `homepage` string, uri, nullable, required
      - `language` string, nullable, required
      - `forks_count` integer, required
      - `stargazers_count` integer, required
      - `watchers_count` integer, required
      - `size` integer, required — The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0.
      - `default_branch` string, required — The default branch of the repository.
      - `open_issues_count` integer, required
      - `is_template` boolean — Whether this repository acts as a template that can be used to generate new repositories.
      - `topics` string[]
      - `has_issues` boolean, required — Whether issues are enabled.
      - `has_projects` boolean, required — Whether projects are enabled.
      - `has_wiki` boolean, required — Whether the wiki is enabled.
      - `has_pages` boolean, required
      - `has_downloads` boolean, required — Whether downloads are enabled.
      - `has_discussions` boolean — Whether discussions are enabled.
      - `has_pull_requests` boolean — Whether pull requests are enabled.
      - `pull_request_creation_policy` 'all' | 'collaborators_only' — The policy controlling who can create pull requests: all or collaborators_only.
      - `archived` boolean, required — Whether the repository is archived.
      - `disabled` boolean, required — Returns whether or not this repository disabled.
      - `visibility` string — The repository visibility: public, private, or internal.
      - `pushed_at` string, date-time, nullable, required
      - `created_at` string, date-time, nullable, required
      - `updated_at` string, date-time, nullable, required
      - `allow_rebase_merge` boolean — Whether to allow rebase merges for pull requests.
      - `temp_clone_token` string
      - `allow_squash_merge` boolean — Whether to allow squash merges for pull requests.
      - `allow_auto_merge` boolean — Whether to allow Auto-merge to be used on pull requests.
      - `delete_branch_on_merge` boolean — Whether to delete head branches when pull requests are merged
      - `allow_update_branch` boolean — Whether or not a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging.
      - `use_squash_pr_title_as_default` boolean — Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead.
      - `squash_merge_commit_title` 'PR_TITLE' | 'COMMIT_OR_PR_TITLE' — The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).
      - `squash_merge_commit_message` 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK' — The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message.
      - `merge_commit_title` 'PR_TITLE' | 'MERGE_MESSAGE' — The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).
      - `merge_commit_message` 'PR_BODY' | 'PR_TITLE' | 'BLANK' — The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message.
      - `allow_merge_commit` boolean — Whether to allow merge commits for pull requests.
      - `allow_forking` boolean — Whether to allow forking this repo
      - `web_commit_signoff_required` boolean — Whether to require contributors to sign off on web-based commits
      - `open_issues` integer, required
      - `watchers` integer, required
      - `master_branch` string
      - `starred_at` string
      - `anonymous_access_enabled` boolean — Whether anonymous git access is enabled for this repository
      - `code_search_index_status` object — The status of the code search index for this repository
        - `lexical_search_ok` boolean
        - `lexical_commit_sha` string
    - `source` Repository — A repository on GitHub.
      - `id` integer, required — Unique identifier of the repository
      - `node_id` string, required
      - `name` string, required — The name of the repository.
      - `full_name` string, required
      - `license` NullableLicenseSimple, nullable, required — License Simple
        - `key` string, required
        - `name` string, required
        - `url` string, uri, nullable, required
        - `spdx_id` string, nullable, required
        - `node_id` string, required
        - `html_url` string, uri
      - `forks` integer, required
      - `permissions` object
        - `admin` boolean, required
        - `pull` boolean, required
        - `triage` boolean
        - `push` boolean, required
        - `maintain` boolean
      - `owner` SimpleUser, required — A GitHub user.
        - `name` string, nullable
        - `email` string, nullable
        - `login` string, required
        - `id` integer, required
        - `node_id` string, required
        - `avatar_url` string, uri, required
        - `gravatar_id` string, nullable, required
        - `url` string, uri, required
        - `html_url` string, uri, required
        - `followers_url` string, uri, required
        - `following_url` string, required
        - `gists_url` string, required
        - `starred_url` string, required
        - `subscriptions_url` string, uri, required
        - `organizations_url` string, uri, required
        - `repos_url` string, uri, required
        - `events_url` string, required
        - `received_events_url` string, uri, required
        - `type` string, required
        - `site_admin` boolean, required
        - `starred_at` string
        - `user_view_type` string
      - `private` boolean, required — Whether the repository is private or public.
      - `html_url` string, uri, required
      - `description` string, nullable, required
      - `fork` boolean, required
      - `url` string, uri, required
      - `archive_url` string, required
      - `assignees_url` string, required
      - `blobs_url` string, required
      - `branches_url` string, required
      - `collaborators_url` string, required
      - `comments_url` string, required
      - `commits_url` string, required
      - `compare_url` string, required
      - `contents_url` string, required
      - `contributors_url` string, uri, required
      - `deployments_url` string, uri, required
      - `downloads_url` string, uri, required
      - `events_url` string, uri, required
      - `forks_url` string, uri, required
      - `git_commits_url` string, required
      - `git_refs_url` string, required
      - `git_tags_url` string, required
      - `git_url` string, required
      - `issue_comment_url` string, required
      - `issue_events_url` string, required
      - `issues_url` string, required
      - `keys_url` string, required
      - `labels_url` string, required
      - `languages_url` string, uri, required
      - `merges_url` string, uri, required
      - `milestones_url` string, required
      - `notifications_url` string, required
      - `pulls_url` string, required
      - `releases_url` string, required
      - `ssh_url` string, required
      - `stargazers_url` string, uri, required
      - `statuses_url` string, required
      - `subscribers_url` string, uri, required
      - `subscription_url` string, uri, required
      - `tags_url` string, uri, required
      - `teams_url` string, uri, required
      - `trees_url` string, required
      - `clone_url` string, required
      - `mirror_url` string, uri, nullable, required
      - `hooks_url` string, uri, required
      - `svn_url` string, uri, required
      - `homepage` string, uri, nullable, required
      - `language` string, nullable, required
      - `forks_count` integer, required
      - `stargazers_count` integer, required
      - `watchers_count` integer, required
      - `size` integer, required — The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0.
      - `default_branch` string, required — The default branch of the repository.
      - `open_issues_count` integer, required
      - `is_template` boolean — Whether this repository acts as a template that can be used to generate new repositories.
      - `topics` string[]
      - `has_issues` boolean, required — Whether issues are enabled.
      - `has_projects` boolean, required — Whether projects are enabled.
      - `has_wiki` boolean, required — Whether the wiki is enabled.
      - `has_pages` boolean, required
      - `has_downloads` boolean, required — Whether downloads are enabled.
      - `has_discussions` boolean — Whether discussions are enabled.
      - `has_pull_requests` boolean — Whether pull requests are enabled.
      - `pull_request_creation_policy` 'all' | 'collaborators_only' — The policy controlling who can create pull requests: all or collaborators_only.
      - `archived` boolean, required — Whether the repository is archived.
      - `disabled` boolean, required — Returns whether or not this repository disabled.
      - `visibility` string — The repository visibility: public, private, or internal.
      - `pushed_at` string, date-time, nullable, required
      - `created_at` string, date-time, nullable, required
      - `updated_at` string, date-time, nullable, required
      - `allow_rebase_merge` boolean — Whether to allow rebase merges for pull requests.
      - `temp_clone_token` string
      - `allow_squash_merge` boolean — Whether to allow squash merges for pull requests.
      - `allow_auto_merge` boolean — Whether to allow Auto-merge to be used on pull requests.
      - `delete_branch_on_merge` boolean — Whether to delete head branches when pull requests are merged
      - `allow_update_branch` boolean — Whether or not a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging.
      - `use_squash_pr_title_as_default` boolean — Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead.
      - `squash_merge_commit_title` 'PR_TITLE' | 'COMMIT_OR_PR_TITLE' — The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).
      - `squash_merge_commit_message` 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK' — The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message.
      - `merge_commit_title` 'PR_TITLE' | 'MERGE_MESSAGE' — The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).
      - `merge_commit_message` 'PR_BODY' | 'PR_TITLE' | 'BLANK' — The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message.
      - `allow_merge_commit` boolean — Whether to allow merge commits for pull requests.
      - `allow_forking` boolean — Whether to allow forking this repo
      - `web_commit_signoff_required` boolean — Whether to require contributors to sign off on web-based commits
      - `open_issues` integer, required
      - `watchers` integer, required
      - `master_branch` string
      - `starred_at` string
      - `anonymous_access_enabled` boolean — Whether anonymous git access is enabled for this repository
      - `code_search_index_status` object — The status of the code search index for this repository
        - `lexical_search_ok` boolean
        - `lexical_commit_sha` string
    - `forks` integer, required
    - `master_branch` string
    - `open_issues` integer, required
    - `watchers` integer, required
    - `anonymous_access_enabled` boolean — Whether anonymous git access is allowed.
    - `code_of_conduct` CodeOfConductSimple — Code of Conduct Simple
      - `url` string, uri, required
      - `key` string, required
      - `name` string, required
      - `html_url` string, uri, nullable, required
    - `security_and_analysis` SecurityAndAnalysis, nullable
      - `advanced_security` object — Enable or disable GitHub Advanced Security for the repository. For standalone Code Scanning or Secret Protection products, this parameter cannot be used.
        - `status` 'enabled' | 'disabled'
      - `code_security` object
        - `status` 'enabled' | 'disabled'
      - `dependabot_security_updates` object — Enable or disable Dependabot security updates for the repository.
        - `status` 'enabled' | 'disabled' — The enablement status of Dependabot security updates for the repository.
      - `secret_scanning` object
        - `status` 'enabled' | 'disabled'
      - `secret_scanning_push_protection` object
        - `status` 'enabled' | 'disabled'
      - `secret_scanning_non_provider_patterns` object
        - `status` 'enabled' | 'disabled'
      - `secret_scanning_ai_detection` object
        - `status` 'enabled' | 'disabled'
      - `secret_scanning_validity_checks` object
        - `status` 'enabled' | 'disabled'
      - `secret_scanning_delegated_alert_dismissal` object
        - `status` 'enabled' | 'disabled'
      - `secret_scanning_delegated_bypass` object
        - `status` 'enabled' | 'disabled'
      - `secret_scanning_delegated_bypass_options` object
        - `reviewers` object[] — The bypass reviewers for secret scanning delegated bypass
          - `reviewer_id` integer, required — The ID of the team or role selected as a bypass reviewer
          - `reviewer_type` 'TEAM' | 'ROLE', required — The type of the bypass reviewer
          - `mode` 'ALWAYS' | 'EXEMPT' — The bypass mode for the reviewer
    - `custom_properties` object — The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values.
  - `machine` NullableCodespaceMachine, nullable, required — A description of the machine powering a codespace.
    - `name` string, required — The name of the machine.
    - `display_name` string, required — The display name of the machine includes cores, memory, and storage.
    - `operating_system` string, required — The operating system of the machine.
    - `storage_in_bytes` integer, required — How much storage is available to the codespace.
    - `memory_in_bytes` integer, required — How much memory is available to the codespace.
    - `cpus` integer, required — How many cores are available to the codespace.
    - `prebuild_availability` 'none' | 'ready' | 'in_progress', nullable, required — Whether a prebuild is currently available when creating a codespace for this machine and repository. If a branch was not specified as a ref, the default branch will be assumed. Value will be "null" if prebuilds are not supported or prebuild availability could not be determined. Value will be "none" if no prebuild is available. Latest values "ready" and "in_progress" indicate the prebuild availability status.
  - `devcontainer_path` string, nullable — Path to devcontainer.json from repo root used to create Codespace.
  - `prebuild` boolean, nullable, required — Whether the codespace was created from a prebuild.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `last_used_at` string, date-time, required — Last known time this codespace was started.
  - `state` 'Unknown' | 'Created' | 'Queued' | 'Provisioning' | 'Available' | 'Awaiting' | 'Unavailable' | 'Deleted' | 'Moved' | 'Shutdown' | 'Archived' | 'Starting' | 'ShuttingDown' | 'Failed' | 'Exporting' | 'Updating' | 'Rebuilding', required — State of this codespace.
  - `url` string, uri, required — API URL for this codespace.
  - `git_status` object, required — Details about the codespace's git repository.
    - `ahead` integer — The number of commits the local repository is ahead of the remote.
    - `behind` integer — The number of commits the local repository is behind the remote.
    - `has_unpushed_changes` boolean — Whether the local repository has unpushed changes.
    - `has_uncommitted_changes` boolean — Whether the local repository has uncommitted changes.
    - `ref` string — The current branch (or SHA if in detached HEAD state) of the local repository.
  - `location` 'EastUs' | 'SouthEastAsia' | 'WestEurope' | 'WestUs2', required — The initally assigned location of a new codespace.
  - `idle_timeout_minutes` integer, nullable, required — The number of minutes of inactivity after which this codespace will be automatically stopped.
  - `web_url` string, uri, required — URL to access this codespace on the web.
  - `machines_url` string, uri, required — API URL to access available alternate machine types for this codespace.
  - `start_url` string, uri, required — API URL to start this codespace.
  - `stop_url` string, uri, required — API URL to stop this codespace.
  - `publish_url` string, uri, nullable — API URL to publish this codespace to a new repository.
  - `pulls_url` string, uri, nullable, required — API URL for the Pull Request associated with this codespace, if any.
  - `recent_folders` string[], required
  - `runtime_constraints` object
    - `allowed_port_privacy_settings` string[], nullable — The privacy settings a user can select from when forwarding a port.
  - `pending_operation` boolean, nullable — Whether or not a codespace has a pending async operation. This would mean that the codespace is temporarily unavailable. The only thing that you can do with a codespace in this state is delete it.
  - `pending_operation_disabled_reason` string, nullable — Text to show user when codespace is disabled by a pending operation
  - `idle_timeout_notice` string, nullable — Text to show user when codespace idle timeout minutes has been overriden by an organization policy
  - `retention_period_minutes` integer, nullable — Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days).
  - `retention_expires_at` string, date-time, nullable — When a codespace will be auto-deleted based on the "retention_period_minutes" and "last_used_at"

## Other responses

- `401` — Requires authentication
- `403` — Forbidden
- `404` — Resource not found
- `422` — Validation failed, or the endpoint has been spammed.

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-2.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-2/versions/8ae6d0c8716e/schema)
