# GET /v1/templates/list

> List the templates in the ReportingCloud template storage as TemplateList objects with templateName, modified date and size in bytes, from curl or an SDK.

- **Product:** ReportingCloud
- **Section:** Documentation
- **Kind:** Endpoint
- **Path:** ReportingCloud > API Reference > Web API > Templates > /list > GET /v1/templates/list
- **2422 words**
- **Web URL:** https://docs.textcontrol.com/reporting-cloud/reference/web-api/templates/list/get/
- **LLMs URL:** https://docs.textcontrol.com/reporting-cloud/reference/web-api/templates/list/get/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/reporting-cloud/reference/web-api/templates/list/get/llms-full.txt

---

`GET` `https://api.reporting.cloud/v1/templates/list`

### Description

Lists the templates in the template storage, each with its name, the time it was uploaded (UTC) and its size in bytes.

### Examples

#### HTTP

Request:

```bash
curl -u username:password \
  -X GET "https://api.reporting.cloud/v1/templates/list"
```

Results:

```json
[
	{
		"templateName": "company_invoice.doc",
		"modified": "2016-06-02T09:25:33+00:00",
		"size": 6144
	},
	{
		"templateName": "sample_invoice.tx",
		"modified": "2019-06-28T07:22:34+00:00",
		"size": 35271
	},
	{
		"templateName": "template.docx",
		"modified": "2016-06-02T09:25:22+00:00",
		"size": 3246
	}
]
```

#### C#

Request:

```csharp
using System;
using System.Collections.Generic;
using TXTextControl.ReportingCloud;

class RCSamples
{
    public static void ListTemplates()
    {
        ReportingCloud rc = new ReportingCloud(
            "username",
            "password",
            new Uri("https://api.reporting.cloud"));

        try
        {
            List<Template> lstTemplates = rc.ListTemplates();
            lstTemplates.ForEach(i => Console.Write("{0}\r\n", i.TemplateName));
        }
        catch (Exception e)
        {
            Console.WriteLine("An error occurred: " + e.Message);
        }
    }
}
```

Results:

```text
company_invoice.doc
sample_invoice.tx
template.docx
```

#### Java

Request:

```java
import com.textcontrol.reportingcloud.ReportingCloud;
import com.textcontrol.reportingcloud.Template;

import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;

public class ReportingCloudSample {
    public static void main(String[] args) throws IOException {
        ReportingCloud r = new ReportingCloud("username", "password");
        List<Template> templates = r.listTemplates();

        List<String> templateNames = templates.stream().map(t -> t.getTemplateName()).collect(Collectors.toList());
        System.out.println("Template names: " + String.join(", ", templateNames));
    }
}
```

Results:

```text
Template names: company_invoice.doc, sample_invoice.tx, template.docx
```

#### Ruby

Request:

```ruby
#!/usr/bin/env ruby

require "txtextcontrol/reportingcloud"

reporting_cloud = TXTextControl::ReportingCloud::ReportingCloud.new("username", "password")
templates = reporting_cloud.list_templates
template_names = templates.collect { |t| t.template_name }
puts "Template names: #{template_names.join(", ")}"
```

Results:

```text
Template names: company_invoice.doc, sample_invoice.tx, template.docx
```

#### PHP

Request:

```php
<?php

require_once __DIR__ . '/vendor/autoload.php';

use TextControl\ReportingCloud\ReportingCloud;

$reportingCloud = new ReportingCloud([
    'api_key' => (string) getenv('REPORTINGCLOUD_API_KEY'),
]);

var_dump($reportingCloud->getTemplateList());
```

Results:

```text
array(3) {
  [0]=>
  array(3) {
    ["template_name"]=>
    string(19) "company_invoice.doc"
    ["modified"]=>
    int(1464859533)
    ["size"]=>
    int(6144)
  }
  [1]=>
  array(3) {
    ["template_name"]=>
    string(17) "sample_invoice.tx"
    ["modified"]=>
    int(1561706554)
    ["size"]=>
    int(35271)
  }
  [2]=>
  array(3) {
    ["template_name"]=>
    string(13) "template.docx"
    ["modified"]=>
    int(1464859522)
    ["size"]=>
    int(3246)
  }
}
```

### Authorization

This endpoint requires a "ReportingCloud-APIKey" or a "Basic" user authorization to access the user account, data and templates. Only one of these two methods is required.

[API Keys](https://docs.textcontrol.com/reporting-cloud/installation/api-keys/llms-full.txt) describes how to create an API key, and [Authentication](https://docs.textcontrol.com/reporting-cloud/document-processing/authentication/llms-full.txt) explains both header forms.

#### ReportingCloud-APIKey

| Header field | Description |
|---|---|
| Authorization | **Required**. A valid ReportingCloud account is required. The Authorization field is constructed as follows: An API key needs to be generated in the portal or with [PUT /v1/account/apikey](https://docs.textcontrol.com/reporting-cloud/reference/web-api/account/apikey/put/llms-full.txt). The authorization method and a space, "ReportingCloud-APIKey ", is then put before the actual API key string. For example: `Authorization: ReportingCloud-APIKey oMDM4MrAqL9QEOpyzupnQW5NjvCNtvE5cVDaaLqxI` |

#### Basic

| Header field | Description |
|---|---|
| Authorization | **Required**. A valid ReportingCloud account is required. The Authorization field is constructed as follows: The user name and password are combined into a string separated by a colon, for example `username:password`. The resulting string is encoded using the RFC2045-MIME variant of Base64, except not limited to 76 char/line. The authorization method and a space, "Basic ", is then put before the encoded string. For example: `Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l` |

### Success Response

| Status | Description |
|---|---|
| 200 | On success, the HTTP status code in the response header is 200 (OK). The response body contains an array of ReportingCloud [TemplateList](#success-response) objects. |

#### TemplateList

| Name | Type | Value | Optional |
|---|---|---|---|
| templateName | String | The filename of the template in the template storage. | no |
| modified | DateTime (String) | The last date on which this template has been modified. The date string includes the time zone of the server (UTC). Sample: 2016-06-06T11:25:44+00:00. | no |
| size | Number (Long) | The size of the template in bytes. | no |

### Error Response

| Status | Description |
|---|---|
| 403 | A 403 (Forbidden) is returned, if the user is not authorized. |
| 405 | A 405 (Method Not Allowed) is returned, if the request uses another HTTP method than GET. The Allow header of the response names GET. |
| 500 | A 500 (Internal Server Error) is returned, if the request has no Authorization header, an empty one or one that is not the authorization method, a space and the credentials. |

---

## Nearby

- **Previous:** [/v1/templates/list](https://docs.textcontrol.com/reporting-cloud/reference/web-api/templates/list/llms-full.txt)
- **Next:** [/v1/templates/pagecount](https://docs.textcontrol.com/reporting-cloud/reference/web-api/templates/pagecount/llms-full.txt)
