> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corti.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# getTemplates()

> Reference for the Embedded API getTemplates() method.

Use `getTemplates()` to retrieve all document templates available to the authenticated user.

<Info>
  Applies to Web Component, Window API, and PostMessage. Examples on this page
  use the Web Component API shape.
</Info>

<Tip>
  Use this method before `setInteractionOptions()` when you need to verify the
  template id and language combination you want to use as the default.
</Tip>

## Usage

```typescript theme={null}
const response = await api.getTemplates();
console.log(response.templates);
```

## Prerequisites

* User must be authenticated.

## Input validation

* None

## Possible errors

* `UNAUTHORIZED`: User not authenticated.
* `INTERNAL_ERROR`: Failed to fetch templates from the server.

## Returns

```typescript theme={null}
{
  templates: Array<{
    id: string;
    name: string;
    description?: string;
    language: {
      code: string;
      name: string;
      locale?: string;
    };
    sections: Array<{
      id: string;
      title: string;
    }>;
    isCustom: boolean;
  }>;
}
```

## Use cases

* Display a template picker.
* Filter templates by language.
* Distinguish between built-in and custom templates.
* Pre-populate template selection based on user preferences or defaults.

## Related reference

* [API Reference Overview](/assistant/api-reference)
* [setInteractionOptions()](/assistant/api/set-interaction-options)
