Push space content to a connected Git repository
Triggers an export of the space's current content to the provided Git repository. This is an async operation — the export runs in the background after the request returns 204.
A unique entity identifier
^[a-zA-Z0-9_-]+$URL of the Git repository to export to. It can contain basic auth credentials.
Git ref to push the commit to in the format "refs/heads/main"
Message for the commit generated by the export
Unique identifier to use to cache the Git repository across multiple operations.
URL to use as a prefix for external file references.
URL to use as a prefix for the commit URL.
Path to a root directory for the project in the repository.
The timestamp of the event that triggered this export. It ensures that Git sync import and export operations are executed in the same order on GitBook and on the remote repository.
If true, the export will be done in a standalone mode, meaning that the exported content will not be linked to the Git repository. This is useful for creating a snapshot of the space's content.
Operation to export the space has been queued.
No content
POST /v1/spaces/{spaceId}/git/export HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 194
{
"url": "text",
"ref": "text",
"commitMessage": "text",
"repoTreeURL": "text",
"repoCommitURL": "text",
"repoProjectDirectory": "text",
"timestamp": "2026-01-01T00:00:00.000Z",
"force": true,
"standalone": true
}Operation to export the space has been queued.
No content
Last updated
Was this helpful?