# List Templates

### Description
Lists the Templates in an Organizational Unit that can be used to
[create a Scheduling Request using a Template](https://docs.cronofy.com/api-reference/managed-scheduling/scheduling-requests/create-requests-with-templates/index.md).
Use it to let your users pick a Template, rather than asking them to copy its
`sub` from the Cronofy Dashboard.

For each Template, `request_requirements` lists what you still need to send when
creating a Scheduling Request from it. Each requirement names a concept, such
as an invitee.
[Scheduling concepts](https://docs.cronofy.com/api-reference/fundamentals/scheduling-concepts/index.md)
explains how to provide it.

Authentication is with either:

- an access token for the Organizational Unit, created by authorizing an application for an [Organizational Unit scope](https://docs.cronofy.com/developers/temporal-grid/connectivity/organization-connect/index.md) like `organizational_unit_scheduling`

- the `client_secret` of an [Internal Application](https://docs.cronofy.com/api-reference/application-management/internal-applications/index.md) linked to the Organizational Unit.

### Which Templates are listed
A Template is listed when:

- it belongs to the Organizational Unit you're authorized for

- it has the type `Scheduling Request via API`

- it can be used to create a Scheduling Request right now

Templates that would fail [Template Validation](https://docs.cronofy.com/api-reference/managed-scheduling/scheduling-requests/create-requests-with-templates/index.md)
are left out. For example, a Template is left out when it has no host, when
its host doesn't have Scheduler access, or when its event details contain
placeholders the API can't fill. Once the Template is corrected in the Cronofy
Dashboard, it's listed again.

Templates are sorted by name.

### URL format
```
{data_center_url}/v1/scheduling_request_templates
```

### Example Request
```http
GET /v1/scheduling_request_templates HTTP/1.1
Host: {data_center_url}
Authorization: Bearer {API_KEY}
```

### Example Response
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "pages": {
    "current": 1,
    "total": 2,
    "next_page": "https://api.cronofy.com/v1/scheduling_request_templates/pages/08a07b034306679e"
  },
  "scheduling_request_templates": [
    {
      "sub": "sgr_eaf24e449d1c55621a10c0a9",
      "name": "Driving lesson",
      "request_requirements": [
        { "name": "invitee" }
      ]
    },
    {
      "sub": "sgr_bb83b59f8e2e14b412fb7a50",
      "name": "Driving test",
      "request_requirements": [
        { "name": "invitee" }
      ]
    }
  ]
}
```

### Request Parameters
##### `data_center_url` *(required)*

The URL for the data center you want to communicate with. Possible choices are:

- `api-au.cronofy.com` - Australia
- `api-ca.cronofy.com` - Canada
- `api-de.cronofy.com` - Germany
- `api-sg.cronofy.com` - Singapore
- `api-uk.cronofy.com` - United Kingdom
- `api.cronofy.com` - United States

Find out more about [Cronofy's data centers](https://docs.cronofy.com/developers/data-centers/index.md).
### Response Parameters
##### `pages.current`

An [`Integer`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md) specifying which page of the result set the current request is for.

##### `pages.total`

An [`Integer`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md) specifying the total number of pages in the result set.

##### `pages.next_page` *(optional)*

When present, a [`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md) specifying the URL for the next page of results.

The next page of results can be retrieved by issuing a `GET` request to this URL, and you will receive a response in the same format.

##### `scheduling_request_templates`

An array of the Templates that can be used to create a Scheduling Request through the API. Empty when there are none.

##### `scheduling_request_templates.sub`

A [`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md) of the Template's `sub`. Pass it as `scheduling_request_template.sub` when [creating a Scheduling Request using a Template](https://docs.cronofy.com/api-reference/managed-scheduling/scheduling-requests/create-requests-with-templates/index.md).

##### `scheduling_request_templates.name`

A [`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md) of the Template's name, as shown in the Cronofy Dashboard.

##### `scheduling_request_templates.request_requirements`

An array of what you need to send, alongside `scheduling_request_template.sub`, to create a Scheduling Request from the Template.

##### `scheduling_request_templates.request_requirements.name`

A [`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md) naming the requirement. One of:

- [`invitee`](https://docs.cronofy.com/api-reference/fundamentals/scheduling-concepts/index.md)

More requirements may be added in the future. Treat a requirement you don't recognize as one your application can't provide, and don't offer that Template.

### Error responses
##### 401 Unauthorized

The request was refused as the provided [authentication credentials](https://docs.cronofy.com/api-reference/authorization/authentication/index.md) were not recognized.

##### 403 Forbidden

The request was refused as the provided credentials don't grant access to the Organizational Unit's Templates. Authorize your application for an [Organizational Unit scope](https://docs.cronofy.com/developers/temporal-grid/connectivity/organization-connect/index.md) like `organizational_unit_scheduling`.



---
[Read in HTML](https://docs.cronofy.com/api-reference/managed-scheduling/scheduling-requests/list-templates/)