# List templates

{% get /%}
{% path text="/v1/template/list" /%}

This function returns a paginated list of templates from your account. You can also search the templates associated with an account using one or more supported query filters. Calling list templates without any explicit query filter returns all templates.

The list can be filtered by the following values:

    1. TemplateId
    2. TemplateName
    3. TemplateLabels
    4. OnBehalfOf

## Code snippet

{% codetab %}

cURL

```shell 
curl -X 'GET' \ 'https://api.boldsign.com/v1/template/list?pageSize=10&page=1' \
     -H 'accept: application/json' \
     -H 'X-API-KEY: {your API key}'
```

C#

```csharp
var apiClient = new ApiClient("https://api.boldsign.com", "Your_API_Key");

var templateClient = new TemplateClient(apiClient);

var templateList = templateClient.ListTemplates(1);
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

    template_api = boldsign.TemplateApi(api_client)
    template_list = template_api.list_templates(page=1)
```

PHP

```php
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\TemplateApi;

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$template_api = new TemplateApi($config); 
$template_list = $template_api->listTemplates($page = 1);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
        
TemplateApi templateApi = new TemplateApi(client);

int page = 1;
TemplateRecords templateList = templateApi.listTemplates(page, null, null, null, null, null, null, null, null, null);
```

NodeJS

```js
import { TemplateApi } from "boldsign";

const templateApi = new TemplateApi("https://api.boldsign.com");
templateApi.setApiKey("YOUR_API_KEY");

const templateList = templateApi.listTemplates(1);
```

{% /codetab %}

## Query parameters

{% nestedtable %}

- {% arguments name="page" /%}{% batch datatype="integer" /%}
- The page number (starting with 1) that you would like to view.

---

- {% arguments name="pageSize" /%}{% batch datatype="integer" /%}
- The maximum number of `Template` objects in a page (10 by default).

   The value must be between 1 and 100.

---

- {% arguments name="templateType" /%}{% batch datatype="string" /%}
- The default value is `AllTemplates.` The values are,

    1. `AllTemplates` - It will return a list of template objects created by you as well as those shared by members of your organization.
    2. `MyTemplates` - It will return a list of template objects that you have created.
    3. `SharedTemplates` - It will return a list of template objects shared by members of your organization.

---

- {% arguments name="searchKey" /%}{% batch datatype="string" /%}
- It will return a list of template objects based on the key values you provide, such as template Id, template name and template labels.

---

- {% arguments name="createdBy" /%}{% batch datatype="array" /%}
- It will return a list of template objects based on the provided template creator's email value.

---

- {% arguments name="templateLabels" /%}{% batch datatype="array" /%}
- It will return a list of template objects based on the provided template labels value.

---

- {% arguments name="onBehalfOf" /%}{% batch datatype="array" /%}
- It will return a list of template objects based on the provided on behalf of email value.

---

- {% arguments name="brandIds" /%}{% batch datatype="array" /%}
- Filters documents based on their associated brand IDs.

---

- {% arguments name="sharedWithTeamId" /%}{% batch datatype="array" /%}
- Filters templates that are shared with any of the specified team IDs.

{% /nestedtable %}

## Example response

***200 Success***

```json
{
  "pageDetails": {
    "pageSize": 10,
    "page": 1,
    "totalRecordsCount": 52,
    "totalPages": 6,
    "sortedColumn": "activityDate",
    "sortDirection": "DESC"
  },
  "result": [
    {
      "documentId": "4e2375dd-xxxx-xxxx-xxxx-870952cee6f8",
      "senderDetail": {
        "name": "Alex Gayle",
        "emailAddress": "alexgayle@cubeflakes.com",
        "userId": "4383962c-xxxx-xxxx-xxxx-e0cd3f170f0f"
      },
      "ccDetails": [],
      "createdDate": 1665465712,
      "activityDate": 1665465712,
      "activityBy": "alexgayle@cubeflakes.com",
      "messageTitle": "Bill-of-Sale",
      "status": "Completed",
      "signerDetails": [
        {
          "signerName": "Hank White",
          "signerRole": "Hr",
          "signerEmail": "hankwhite@cubeflakes.com",
          "phoneNumber": null,
          "status": "NotCompleted",
          "enableAccessCode": false,
          "enableEmailOTP": false,
          "imposeAuthentication": "None",
          "deliveryMode": "Email",
          "userId": null,
          "order": 1,
          "signerType": "Signer",
          "signType": "Single",
          "groupId": "",
          "language": 1,
          "hostEmail": "",
          "hostName": "",
          "hostUserId": "",
          "allowRoleEdit": true,
          "allowRoleDelete": true
        },
        {
          "signerName": "Luther Cooper",
          "signerRole": "Sales",
          "signerEmail": "luthercooper@cubeflakes.com",
          "phoneNumber": null,
          "status": "NotCompleted",
          "enableAccessCode": false,
          "enableEmailOTP": false,
          "imposeAuthentication": "None",
          "deliveryMode": "Email",
          "userId": null,
          "order": 2,
          "signerType": "Signer",
          "signType": "Single",
          "groupId": "",
          "language": 1,
          "hostEmail": "",
          "hostName": "",
          "hostUserId": "",
          "allowRoleEdit": true,
          "allowRoleDelete": true
        }
      ],
      "enableSigningOrder": false,
      "enableReassign": true,
      "templateName": "Name of the template",
      "templateDescription": "template description",
      "accessType": "Edit",
      "accessTid": "",
      "isTemplate": false,
      "labels": [
        "labels",
        "tags"
      ],
      "templateLabels": [
        "labels",
        "tags"
      ]
    }
  ]
}
```
