GitBook API API reference Docs sitesSite share links Control how you share docs externally by managing share links for a site.
Manage the lifecycle of share links for your published sites. This includes generating new links for external sharing and revoking or updating existing ones.
object string · enum required
Type of Object, always equals to "share-link"
Options: share-link
id string required
Unique identifier for the share-link
createdAt string · date-time required
name string · max: 50 optional
urls object required
URLs associated with the object
List all share links
get
https://api.gitbook.com/v1 /orgs/ {organizationId} /sites/ {siteId} /share-links
organizationId string required
The unique id of the organization
siteId string required
The unique id of the site
page string optional
Identifier of the page results to fetch.
limit number · max: 1000 optional
The number of results per page
Copy curl -L \
--url 'https://api.gitbook.com/v1/orgs/{organizationId}/sites/{siteId}/share-links' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Copy {
"next": {
"page": "text"
},
"count": 1,
"items": [
{
"object": "share-link",
"id": "text",
"createdAt": "2025-04-18T07:06:35.437Z",
"name": "text",
"active": true,
"urls": {
"published": "https://example.com"
}
}
]
}
Create a share link
post
https://api.gitbook.com/v1 /orgs/ {organizationId} /sites/ {siteId} /share-links
organizationId string required
The unique id of the organization
siteId string required
The unique id of the site
name string · max: 50 required
Copy curl -L \
--request POST \
--url 'https://api.gitbook.com/v1/orgs/{organizationId}/sites/{siteId}/share-links' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"name": "text"
}'
Copy {
"object": "share-link",
"id": "text",
"createdAt": "2025-04-18T07:06:35.437Z",
"name": "text",
"active": true,
"urls": {
"published": "https://example.com"
}
}
Deletes a share link
delete
https://api.gitbook.com/v1 /orgs/ {organizationId} /sites/ {siteId} /share-links/ {shareLinkId}
organizationId string required
The unique id of the organization
siteId string required
The unique id of the site
shareLinkId string required
The unique id of the share link
Copy curl -L \
--request DELETE \
--url 'https://api.gitbook.com/v1/orgs/{organizationId}/sites/{siteId}/share-links/{shareLinkId}' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Update a share link
patch
https://api.gitbook.com/v1 /orgs/ {organizationId} /sites/ {siteId} /share-links/ {shareLinkId}
organizationId string required
The unique id of the organization
siteId string required
The unique id of the site
shareLinkId string required
The unique id of the share link
name string · max: 50 optional
Copy curl -L \
--request PATCH \
--url 'https://api.gitbook.com/v1/orgs/{organizationId}/sites/{siteId}/share-links/{shareLinkId}' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"active": true,
"name": "text"
}'
Copy {
"object": "share-link",
"id": "text",
"createdAt": "2025-04-18T07:06:35.437Z",
"name": "text",
"active": true,
"urls": {
"published": "https://example.com"
}
}