# Templates

## List Templates API

Retrieve a list of [templates](https://instacharts.io/docs/guides/generate-charts-using-templates/) owned by the authenticated user. In addition to any templates the user has created, every user has a default template, which contains the default chart settings for a new stacked bar chart.

## Endpoint

```
GET https://api.instacharts.io/v1/templates
```

## Authorization

This endpoint requires [OAuth 2.0 authentication](https://instacharts.io/docs/api/authentication/). Include your access token in the Authorization header:

```
Authorization: Bearer your_access_token
```

## Response

### Success Response (200)

```
{

"data": [

{

"id": "template_000",

"name": "Default Template",

"title": "",

"type": "stackedBar"

},

{

"id": "template_abc123",

"name": "Monthly Sales Dashboard",

"title": "Jan 2025 Sales",

"type": "line"

},

{

"id": "template_xyz789",

"name": "Product Distribution Pie Chart",

"title": "Product Distribution",

"type": "pie"

}

]

}
```

### Error Responses

#### Authentication Error (401)

```
{

"error": "unauthorized",

"message": "Invalid or expired access token",

"code": "INVALID_TOKEN"

}
```

## Example Requests

### Basic Request

```
curl -X GET "https://api.instacharts.io/v1/templates" \

-H "Authorization: Bearer your_access_token"
```

## Template Object Properties

| Property | Type | Description |
| --- | --- | --- |
| `id` | string | Unique identifier for the template |
| `title` | string | Chart title of the template |
| `name` | string | Name of the template |
| `chartType` | string | Chart type (“line”, “bar”, “pie”, “scatter”, etc.) [Chart Types](https://instacharts.io/docs/automation/chart-templates/#chart-type-values) |
