> Documentation index for AI agents: https://docs.pagerduty.com/llms.txt

# List templates

`GET https://api.pagerduty.com/templates`

Get a list of all the template on an account

Scoped OAuth requires: `templates.read`

## Authorization

- **api_key** (apiKey) — `Authorization` header. The API Key with format `Token token=<API_KEY>`

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `limit` | integer |  | The number of results per page. |
| `offset` | integer |  | Offset to start pagination search results. |
| `total` | boolean |  | By default the `total` field in pagination responses is set to `null` to provide the fastest possible response times. Set `total` to `true` for this field to be populated. See our [Pagination Docs](https://docs.pagerduty.com/developer/pagination) for more information. Default: `false`. |
| `query` | string |  | Template name or description to search. |
| `template_type` | string |  | Filters templates by type. Default: `status_update`. |
| `sort_by` | string |  | Used to specify both the field you wish to sort the results on (name/created_at), as well as the direction (asc/desc) of the results. The sort_by field and direction should be separated by a colon. Sort direction defaults to ascending. One of: `name`, `name:asc`, `name:desc`, `created_at`, `created_at:asc`, `created_at:desc`. Default: `created_at:asc`. |

## Response 200

A paginated array of templates.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `offset` | integer |  | Echoes offset pagination property. Read-only. |
| `limit` | integer |  | Echoes limit pagination property. Read-only. |
| `more` | boolean |  | Indicates if there are additional records to return. Read-only. |
| `total` | integer \| null |  | The total number of records matching the given query. Read-only. |
| `templates` | array of object | yes |  |
| `templates[].template_type` | string |  | The type of template (`status_update` is the only supported template at this time) One of: `status_update`. |
| `templates[].name` | string |  | The name of the template. |
| `templates[].description` | string \| null |  | Description of the template. |
| `templates[].templated_fields` | object |  |  |
| `templates[].templated_fields.email_subject` | string \| null |  | The subject of the e-mail. |
| `templates[].templated_fields.email_body` | string \| null |  | The HTML body of the e-mail message. |
| `templates[].templated_fields.message` | string \| null |  | The short-message of the template (SMS, Push notification, Slack, etc) |
| `templates[].id` | string |  | Read-only. |
| `templates[].summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `templates[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `templates[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `templates[].type` | string |  | One of: `template`. |
| `templates[].created_by` | one of: object \| object |  | User/Account object reference of the creator. |
| `templates[].created_by.id` | string | yes | (option 1) Read-only. |
| `templates[].created_by.summary` | string \| null |  | (option 1) A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `templates[].created_by.type` | string | yes | (option 1) One of: `user_reference`. |
| `templates[].created_by.self` | string \| null (url) |  | (option 1) the API show URL at which the object is accessible. Read-only. |
| `templates[].created_by.html_url` | string \| null (url) |  | (option 1) a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `templates[].created_by.id` | string | yes | (option 2) Read-only. |
| `templates[].created_by.summary` | string \| null |  | (option 2) A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `templates[].created_by.type` | string | yes | (option 2) One of: `account_reference`. |
| `templates[].created_by.self` | string \| null (url) |  | (option 2) the API show URL at which the object is accessible. Read-only. |
| `templates[].created_by.html_url` | string \| null (url) |  | (option 2) a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `templates[].updated_by` | one of: object \| object |  | User/Account object reference of the updator. |
| `templates[].updated_by.id` | string | yes | (option 1) Read-only. |
| `templates[].updated_by.summary` | string \| null |  | (option 1) A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `templates[].updated_by.type` | string | yes | (option 1) One of: `user_reference`. |
| `templates[].updated_by.self` | string \| null (url) |  | (option 1) the API show URL at which the object is accessible. Read-only. |
| `templates[].updated_by.html_url` | string \| null (url) |  | (option 1) a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `templates[].updated_by.id` | string | yes | (option 2) Read-only. |
| `templates[].updated_by.summary` | string \| null |  | (option 2) A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `templates[].updated_by.type` | string | yes | (option 2) One of: `account_reference`. |
| `templates[].updated_by.self` | string \| null (url) |  | (option 2) the API show URL at which the object is accessible. Read-only. |
| `templates[].updated_by.html_url` | string \| null (url) |  | (option 2) a URL at which the entity is uniquely displayed in the Web app. Read-only. |

Example: Response Example

```json
{
  "limit": 25,
  "more": false,
  "offset": 0,
  "templates": [
    {
      "created_at": "2022-12-30T16:00:00Z",
      "created_by": {
        "id": "PDZR4CN",
        "self": "https://api.pagerduty.com/users/PDZR4CN",
        "type": "user_reference"
      },
      "description": "Sample template description",
      "id": "PBZUP2B",
      "name": "Sample Template 160",
      "self": "https://api.pagerduty.com/templates/PBZUP2B",
      "template_type": "status_update",
      "type": "template",
      "updated_at": "2022-12-30T16:00:00Z",
      "updated_by": {
        "id": "PGY287N",
        "self": "https://api.pagerduty.com/users/PGY287N",
        "type": "user_reference"
      }
    }
  ],
  "total": null
}
```

## Response 400

Caller provided invalid arguments. Please review the response for error details. Retrying with the same arguments will *not* work.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 402

Account does not have the abilities to perform the action. Please review the response for the required abilities.
You can also use the [Abilities API](#resource_Abilities) to determine what features are available to your account.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 403

Caller is not authorized to view the requested resource.
While your authentication is valid, the authenticated user or token does not have permission to perform this action.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 500

Internal Server Error the PagerDuty server experienced an error.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Developer Agreement

Your access to and use of the PagerDuty Developer Services is governed by the [PagerDuty Developer Agreement](https://docs.pagerduty.com/developer/pagerduty-developer-agreement).
