> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/developers/gitbook-api/api-reference/custom-fonts/create-a-custom-font.md).

# Create a custom font

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"custom-fonts","description":"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.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"CustomizationFontDefinition\" grouped=\"false\" %}\n    The CustomizationFontDefinition object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user-internal":[]}],"components":{"securitySchemes":{"user-internal":{"type":"http","scheme":"bearer"}},"parameters":{"organizationId":{"name":"organizationId","in":"path","required":true,"description":"The unique id of the organization","schema":{"$ref":"#/components/schemas/EntityId"}}},"schemas":{"EntityId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"A unique entity identifier"},"FontFamily":{"type":"string","description":"The human-readable font-family name used in CSS (e.g., \"Open Sans\", \"Playfair Display\").","minLength":1,"maxLength":50},"FontWeight":{"type":"integer","description":"Numeric representation of the font weight (400=regular, 500=medium, 700=bold, 900=black).","minimum":1,"maximum":1000},"StorageFileKey":{"type":"string","description":"The path of the file in the storage bucket","minLength":1,"maxLength":512},"CustomizationFontDefinition":{"allOf":[{"$ref":"#/components/schemas/CustomizationFontDefinitionInput"},{"type":"object","properties":{"permissions":{"type":"object","description":"The set of permissions for the font definition","properties":{"edit":{"type":"boolean","description":"Can the user edit the font definition"}},"required":["edit"]}},"required":["permissions"]}]},"CustomizationFontDefinitionInput":{"type":"object","description":"Defines a font family along with its various font-face declarations for use in CSS '@font-face' rules.","properties":{"id":{"type":"string","description":"A globally unique identifier for the font definition."},"custom":{"type":"boolean","description":"Whether the font is a custom font. If false, this font is provided by GitBook."},"fontFamily":{"$ref":"#/components/schemas/FontFamily"},"fontFaces":{"type":"array","description":"A list of font-face definitions, specifying variations such as weight and style.","items":{"$ref":"#/components/schemas/FontFace"},"minItems":1}},"required":["id","custom","fontFamily","fontFaces"]},"FontFace":{"type":"object","description":"A single font-face declaration specifying the weight and source files for a particular variation of the font.","properties":{"weight":{"$ref":"#/components/schemas/FontWeight"},"sources":{"type":"array","description":"Font source files provided in supported formats (e.g., woff2, woff).","items":{"$ref":"#/components/schemas/FontSource"},"minItems":1}},"required":["weight","sources"]},"FontSource":{"type":"object","description":"A font file referenced within a font-face declaration, specifying the file's location and format.","properties":{"url":{"description":"The absolute or relative URL pointing to the font file.","$ref":"#/components/schemas/URL"},"format":{"type":"string","description":"The format of the font file. Prefer 'woff2' for modern browsers.","enum":["woff2","woff"]}},"required":["url"]},"URL":{"type":"string","format":"uri","maxLength":2048}},"responses":{"NotFoundError":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[404]},"message":{"type":"string"}},"required":["code","message"]}}}}}},"PreconditionFailedError":{"description":"PreconditionFailed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[412]},"message":{"type":"string"}},"required":["code","message"]}}}}}}}},"paths":{"/orgs/{organizationId}/fonts":{"put":{"operationId":"createCustomFont","summary":"Create a custom font","tags":["custom-fonts"],"parameters":[{"$ref":"#/components/parameters/organizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Defines a custom font and associated font faces with storage references.","properties":{"fontFamily":{"$ref":"#/components/schemas/FontFamily"},"fontFaces":{"type":"array","description":"Array of font faces specifying weights and their corresponding storage keys.\nAt least one font face with weight 400 (regular) must be provided.\n","items":{"type":"object","properties":{"weight":{"$ref":"#/components/schemas/FontWeight"},"storageKey":{"$ref":"#/components/schemas/StorageFileKey"}},"required":["weight","storageKey"]},"minItems":1}},"required":["fontFamily","fontFaces"]}}}},"responses":{"201":{"description":"Custom font created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomizationFontDefinition"}}}},"404":{"$ref":"#/components/responses/NotFoundError"},"412":{"description":"Invalid request data, such as missing required font weights.","$ref":"#/components/responses/PreconditionFailedError"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/developers/gitbook-api/api-reference/custom-fonts/create-a-custom-font.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
