Custom fonts

Bring your own fonts to personalize your documentation style.

Upload and manage custom fonts for branding or aesthetic purposes. Once added, fonts can be applied to your spaces or sites to achieve a unique look.

The CustomizationFontDefinition object

Attributes

Defines a font family along with its various font-face declarations for use in CSS '@font-face' rules.

idstringrequired

A globally unique identifier for the font definition.

custombooleanrequired

Whether the font is a custom font. If false, this font is provided by GitBook.

fontFamilystring · min: 1 · max: 50required

The human-readable font-family name used in CSS (e.g., "Open Sans", "Playfair Display").

fontFacesobject[] · min: 1required

A list of font-face definitions, specifying variations such as weight and style.

The CustomizationFontDefinition object

{
  "id": "text",
  "custom": true,
  "fontFamily": "text",
  "fontFaces": [
    {
      "weight": 1,
      "sources": [
        {
          "url": "https://example.com",
          "format": "woff2"
        }
      ]
    }
  ]
}

List all custom fonts

get
Authorizations
Path parameters
organizationIdstringrequired

The unique id of the organization

Responses
curl -L \
  --url 'https://api.gitbook.com/v1/orgs/{organizationId}/fonts' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "next": {
    "page": "text"
  },
  "count": 1,
  "items": [
    {
      "id": "text",
      "custom": true,
      "fontFamily": "text",
      "fontFaces": [
        {
          "weight": 1,
          "sources": [
            {
              "url": "https://example.com",
              "format": "woff2"
            }
          ]
        }
      ]
    }
  ]
}

Create a custom font

put
Authorizations
Path parameters
organizationIdstringrequired

The unique id of the organization

Body

Defines a custom font and associated font faces with storage references.

fontFamilystring · min: 1 · max: 50required

The human-readable font-family name used in CSS (e.g., "Open Sans", "Playfair Display").

fontFacesobject[] · min: 1required

Array of font faces specifying weights and their corresponding storage keys. At least one font face with weight 400 (regular) must be provided.

Responses
curl -L \
  --request PUT \
  --url 'https://api.gitbook.com/v1/orgs/{organizationId}/fonts' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "fontFamily": "text",
    "fontFaces": [
      {
        "weight": 1,
        "storageKey": "text"
      }
    ]
  }'
{
  "id": "text",
  "custom": true,
  "fontFamily": "text",
  "fontFaces": [
    {
      "weight": 1,
      "sources": [
        {
          "url": "https://example.com",
          "format": "woff2"
        }
      ]
    }
  ]
}

Get a custom font by its ID

get
Authorizations
Path parameters
organizationIdstringrequired

The unique id of the organization

fontIdstringrequired

The unique ID of a font

Responses
curl -L \
  --url 'https://api.gitbook.com/v1/orgs/{organizationId}/fonts/{fontId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "id": "text",
  "custom": true,
  "fontFamily": "text",
  "fontFaces": [
    {
      "weight": 1,
      "sources": [
        {
          "url": "https://example.com",
          "format": "woff2"
        }
      ]
    }
  ]
}

Update a custom font

post
Authorizations
Path parameters
organizationIdstringrequired

The unique id of the organization

fontIdstringrequired

The unique ID of a font

Body

Defines a custom font and associated font faces with storage references.

fontFamilystring · min: 1 · max: 50optional

The human-readable font-family name used in CSS (e.g., "Open Sans", "Playfair Display").

fontFacesobject[]optional

Array of font faces specifying weights and their corresponding storage keys. Passing null as the storage key will remove that weight.

Responses
curl -L \
  --request POST \
  --url 'https://api.gitbook.com/v1/orgs/{organizationId}/fonts/{fontId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "fontFamily": "text",
    "fontFaces": [
      {
        "weight": 1,
        "storageKey": "text"
      }
    ]
  }'
{
  "id": "text",
  "custom": true,
  "fontFamily": "text",
  "fontFaces": [
    {
      "weight": 1,
      "sources": [
        {
          "url": "https://example.com",
          "format": "woff2"
        }
      ]
    }
  ]
}

Delete a custom font

delete
Authorizations
Path parameters
organizationIdstringrequired

The unique id of the organization

fontIdstringrequired

The unique ID of a font

Responses
curl -L \
  --request DELETE \
  --url 'https://api.gitbook.com/v1/orgs/{organizationId}/fonts/{fontId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'

No Content

Was this helpful?