v56

latestOpenAPI 3.0.3MITraw.githubusercontent.com2026-08-011,21696712.2 MB
codespaces

Export a codespace for the authenticated user

Triggers an export of the specified codespace and returns a URL and ID where the status of the export can be monitored.

If changes cannot be pushed to the codespace's repository, they will be pushed to a new or previously-existing fork instead.

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

post/user/codespaces/{codespace_name}/exports

Path parameters

codespace_namestring required

The name of the codespace.

Response

Response

statestring nullable

State of the latest export

completed_atstring date-time nullable

Completion time of the last export operation

branchstring nullable

Name of the exported branch

shastring nullable

Git commit SHA of the exported branch

idstring

Id for the export details

export_urlstring

Url for fetching export details

html_urlstring nullable

Web url for the exported branch

Example response

{
  "state": "succeeded | failed | in_progress",
  "completed_at": "2021-01-01T19:01:12Z",
  "branch": "codespace-monalisa-octocat-hello-world-g4wpq6h95q",
  "sha": "fd95a81ca01e48ede9f39c799ecbcef817b8a3b2",
  "id": "latest",
  "export_url": "https://api.github.com/user/codespaces/:name/exports/latest",
  "html_url": "https://github.com/octocat/hello-world/tree/:branch"
}