Edit Content

The GitBook API is currently in beta phase. If you wish to be one of our testers, please contact our team at support@gitbook.com.

Routes

The examples in the pages linked below only include routes for the primary revision of a space (/v1/spaces/:spaceID/content).

Route

Update primary content of the space

/v1/spaces/:spaceID/content

Update content of draft

/v1/spaces/:spaceID/drafts/:draftID/content

Example

Create a page in a space:

curl -X PUT https://$HOSTNAME/v1/spaces/-LvtJeIxDqSArlpsdopT/content/v/master/url/ \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
--data '{"title":"xyz"}'

Append markdown content to a page:

curl -X POST https://$HOSTNAME/v1/spaces/-LvtJeIxDqSArlpsdopT/content/v/master/url/ \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
--data-binary @- << EOF
{
"document": {
"transforms": [
{
"transform": "append",
"fragment": {
"markdown": "Hello **world**"
}
}
]
}
}
EOF

Endpoints

If you want to update or delete versions:

If you want to create or update pages:

If you want to add assets: