# General Translation Platform: uploadFonts
URL: https://generaltranslation.com/en-US/docs/platform/core/reference/gt-class-methods/translation/upload-fonts.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Upload persistent font assets for Lottie translation workflows. API reference for uploadFonts.

Uploads TrueType or OpenType fonts through a project so Lottie translation jobs in the same Organization can use them during layout processing.

## Overview [#overview]

Call `uploadFonts` with up to 10 base64-encoded font assets. It returns the stored asset identifiers. To upload more fonts, split them into several calls of at most 10 fonts each.

```typescript
const result = await gt.uploadFonts(fonts, {
  timeout: 30000,
});
```

Signature:

```typescript
uploadFonts(
  fonts: AssetUpload[],
  options?: UploadAssetsOptions
): Promise<UploadAssetsResponse>
```

*Note: `uploadFonts` requires an Organization API key with `org:assets:write` (**Organization assets** in the Dashboard), passed as `apiKey` or the deprecated `devApiKey` alias, plus `projectId` on the GT instance. Project API keys receive a 403 error.*

## How it works [#how-it-works]

- Font content is already base64-encoded when passed to the method.
- Each font must have a `.ttf` or `.otf` file name and decode to no more than 20MB.
- The project determines which Organization owns the font. Uploaded fonts persist across that Organization's translation jobs.
- The service derives font family, weight, and italic style from font metadata, then falls back to the file name. Uploading the same derived identity again replaces the stored asset.
- The API accepts at most 10 fonts per request and rejects a larger request with a 400 error. The method splits only inputs longer than 50 fonts into several requests, so a call with 11 or more fonts fails. Call `uploadFonts` once for each group of up to 10 fonts.

(See [Upload project assets](/docs/platform/openapi/reference/organizations/upsert-assets) for validation, identity, and retry behavior).

## Parameters [#parameters]

| Parameter | Description | Type | Optional | Default |
| --- | --- | --- | --- | --- |
| [`fonts`](#fonts) | Base64-encoded fonts to upload. | `AssetUpload[]` | No | — |
| [`options`](#options) | Request settings. | `UploadAssetsOptions` | Yes | `{}` |

### `fonts` [#fonts]

**Type** `AssetUpload[]` · **Required**

| Field | Description | Type | Optional |
| --- | --- | --- | --- |
| `assetType` | Asset type. Only `FONT` is supported. | `'FONT'` | No |
| `content` | Base64-encoded font bytes. | `string` | No |
| `fileName` | File name ending in `.ttf` or `.otf`. | `string` | No |

### `options` [#options]

**Type** `UploadAssetsOptions` · **Optional** · **Default** `{}`

| Field | Description | Type | Optional |
| --- | --- | --- | --- |
| `timeout` | Request timeout in milliseconds. | `number` | Yes |

## Returns [#returns]

**Type** `Promise<UploadAssetsResponse>`

Resolves with the stored asset identifiers and the number of fonts processed:

| Property | Description | Type |
| --- | --- | --- |
| `assets` | Stored font assets. | `UploadedAsset[]` |
| `assets[].id` | Stored Organization asset ID. | `string` |
| `assets[].assetKey` | Derived font identity in the form `<family>-<weight>[-i]`. | `string` |
| `assets[].fileName` | File name supplied in the upload. | `string` |
| `count` | Number of fonts processed. | `number` |

<Callout type="info">
  **Changed in v9.5.0:** `UploadedAsset` no longer declares a `deduped` field, which the service never returned. Uploading the same derived identity replaces the stored asset. (See [How it works](#how-it-works)).
</Callout>

## Example [#example]

```typescript title="upload-fonts.ts"
import { readFile } from 'node:fs/promises';
import { GT } from 'generaltranslation';

// An Organization API key (gtx-org-) with org:assets:write.
const gt = new GT({
  apiKey: process.env.GT_API_KEY,
  projectId: process.env.GT_PROJECT_ID,
});

const fileNames = ['BrandSans.ttf', 'BrandSans-Bold.ttf'];
const fonts = await Promise.all(
  fileNames.map(async (fileName) => ({
    assetType: 'FONT' as const,
    content: (await readFile(`./public/fonts/${fileName}`)).toString('base64'),
    fileName,
  }))
);

// The API accepts at most 10 fonts per request.
for (let i = 0; i < fonts.length; i += 10) {
  const result = await gt.uploadFonts(fonts.slice(i, i + 10));
  console.log(result.assets.map((asset) => asset.assetKey));
}
```

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
