GitBook API API reference Custom hostnamesServe your GitBook content from fully branded, custom hostnames.
Extend your brand identity by mapping personalized domain names to your docs. This can help unify your documentation site with your existing company properties.
object string · enum required
Options: custom-hostname
hostname string · max: 512 required
Custom hostname for the site, for e.g. docs.mycompany.com
Pattern: ^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?[.]){2,}[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$
urls object required
URLs associated with the object
Get a custom hostname
get
https://api.gitbook.com/v1 /custom-hostnames/ {hostname}
hostname string required
The custom hostname, for example "docs.gitbook.com"
Copy curl -L \
--url 'https://api.gitbook.com/v1/custom-hostnames/{hostname}' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Copy {
"object": "custom-hostname",
"hostname": "text",
"target": {
"type": "organization",
"organization": "text"
},
"isActive": true,
"status": "text",
"urls": {
"location": "https://example.com"
}
}
Remove a custom hostname
delete
https://api.gitbook.com/v1 /custom-hostnames/ {hostname} The custom hostname will continue to point to the content or organization unless it is used for another one.
hostname string required
The custom hostname, for example "docs.gitbook.com"
Copy curl -L \
--request DELETE \
--url 'https://api.gitbook.com/v1/custom-hostnames/{hostname}' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Revalidate a custom hostname DNS
patch
https://api.gitbook.com/v1 /custom-hostnames/ {hostname} Revalidate DNS records and status.
hostname string required
The custom hostname, for example "docs.gitbook.com"
Copy curl -L \
--request PATCH \
--url 'https://api.gitbook.com/v1/custom-hostnames/{hostname}' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'