Sample - GitHub REST API
GET/repos/{owner}/{repo}/codespaces/new

Get default attributes for a codespace

Gets the default attributes for codespaces created by the user with the repository.

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

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

4 parameters
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
refstringoptional
The branch or commit to check for a default devcontainer path. If not specified, the default branch will be checked.
client_ipstringoptional
An alternative IP for default location auto-detection, such as when proxying a request.

4 status codes
200Response when a user is able to create codespaces from the repository.
billable_ownerobjectoptional
A GitHub user.
defaultsobjectoptional
401Requires authentication
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Forbidden
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 401 is returned: Requires authentication. A 403 is returned: Forbidden. A 404 is returned: Resource not found.