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-19T20:08:27.586Z",
  "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
application/json
all ofoptional
get
GET /v1/orgs/{organizationId}/sites/{siteId}/share-links HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

{
  "next": {
    "page": "text"
  },
  "count": 1,
  "items": [
    {
      "object": "share-link",
      "id": "text",
      "createdAt": "2025-04-19T20:08:27.586Z",
      "name": "text",
      "active": true,
      "urls": {
        "published": "https://example.com"
      }
    }
  ]
}

Create a share link

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
application/json
objectoptional
post
POST /v1/orgs/{organizationId}/sites/{siteId}/share-links HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 15

{
  "name": "text"
}
201

The share link has been created

{
  "object": "share-link",
  "id": "text",
  "createdAt": "2025-04-19T20:08:27.586Z",
  "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
delete
DELETE /v1/orgs/{organizationId}/sites/{siteId}/share-links/{shareLinkId} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
205

Site share link has been deleted

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
application/json
objectoptional
patch
PATCH /v1/orgs/{organizationId}/sites/{siteId}/share-links/{shareLinkId} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 29

{
  "active": true,
  "name": "text"
}
200

The site share link has been updated

{
  "object": "share-link",
  "id": "text",
  "createdAt": "2025-04-19T20:08:27.586Z",
  "name": "text",
  "active": true,
  "urls": {
    "published": "https://example.com"
  }
}

Was this helpful?