Site 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.

Attributes
objectstring · enumrequired

Type of Object, always equals to "share-link"

Available options:
idstringrequired

Unique identifier for the share-link

createdAtstring · date-timerequired
namestring · max: 50optional

Name of the share link

activebooleanoptional
urlsobjectrequired

URLs associated with the object

The ShareLink object

{
  "object": "share-link",
  "id": "text",
  "createdAt": "2025-04-12T21:04:01.285Z",
  "name": "text",
  "active": true,
  "urls": {
    "published": "https://example.com"
  }
}
get
Authorizations
Path parameters
organizationIdstringrequired

The unique id of the organization

siteIdstringrequired

The unique id of the site

Query parameters
pagestringoptional

Identifier of the page results to fetch.

limitnumber · max: 1000optional

The number of results per page

Responses
curl -L \
  --url 'https://api.gitbook.com/v1/orgs/{organizationId}/sites/{siteId}/share-links' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "next": {
    "page": "text"
  },
  "count": 1,
  "items": [
    {
      "object": "share-link",
      "id": "text",
      "createdAt": "2025-04-12T21:04:01.285Z",
      "name": "text",
      "active": true,
      "urls": {
        "published": "https://example.com"
      }
    }
  ]
}
post
Authorizations
Path parameters
organizationIdstringrequired

The unique id of the organization

siteIdstringrequired

The unique id of the site

Body
namestring · max: 50required

Name of the share link

Responses
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"
  }'
{
  "object": "share-link",
  "id": "text",
  "createdAt": "2025-04-12T21:04:01.285Z",
  "name": "text",
  "active": true,
  "urls": {
    "published": "https://example.com"
  }
}
delete
Authorizations
Path parameters
organizationIdstringrequired

The unique id of the organization

siteIdstringrequired

The unique id of the site

shareLinkIdstringrequired

The unique id of the share link

Responses
curl -L \
  --request DELETE \
  --url 'https://api.gitbook.com/v1/orgs/{organizationId}/sites/{siteId}/share-links/{shareLinkId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'

No Content

patch
Authorizations
Path parameters
organizationIdstringrequired

The unique id of the organization

siteIdstringrequired

The unique id of the site

shareLinkIdstringrequired

The unique id of the share link

Body
activebooleanoptional
namestring · max: 50optional

Name of the share link

Responses
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"
  }'
{
  "object": "share-link",
  "id": "text",
  "createdAt": "2025-04-12T21:04:01.285Z",
  "name": "text",
  "active": true,
  "urls": {
    "published": "https://example.com"
  }
}

Was this helpful?