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").

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
application/json
all ofOptional
get
GET /v1/orgs/{organizationId}/fonts HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "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").

Responses
application/json
put
PUT /v1/orgs/{organizationId}/fonts HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 68

{
  "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
application/json
get
GET /v1/orgs/{organizationId}/fonts/{fontId} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "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").

Responses
application/json
post
POST /v1/orgs/{organizationId}/fonts/{fontId} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 68

{
  "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
delete
DELETE /v1/orgs/{organizationId}/fonts/{fontId} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

Was this helpful?