# Get Template Files GET https://api.hellosign.com/v3/template/files/{template_id} Obtain a copy of the current documents specified by the `template_id` parameter. Returns a PDF or ZIP file. If the files are currently being prepared, a status code of `409` will be returned instead. In this case please wait for the `template_created` callback event. Reference: https://developer.hellosign.com/api/template/files ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get Template Files version: endpoint_template.files paths: /template/files/{template_id}: get: operationId: files summary: Get Template Files description: >- Obtain a copy of the current documents specified by the `template_id` parameter. Returns a PDF or ZIP file. If the files are currently being prepared, a status code of `409` will be returned instead. In this case please wait for the `template_created` callback event. tags: - - subpackage_template parameters: - name: template_id in: path description: The id of the template files to retrieve. required: true schema: type: string - name: file_type in: query description: >- Set to `pdf` for a single merged document or `zip` for a collection of individual documents. required: false schema: $ref: '#/components/schemas/TemplateFilesTemplateIdGetParametersFileType' - name: Authorization in: header description: Basic authentication of the form `Basic `. required: true schema: type: string responses: '200': description: successful operation content: application/octet-stream: schema: type: string format: binary '400': description: failed_operation content: {} components: schemas: TemplateFilesTemplateIdGetParametersFileType: type: string enum: - value: pdf - value: zip ``` ## SDK Code Examples ```php PHP setUsername("YOUR_API_KEY"); // $config->setAccessToken("YOUR_ACCESS_TOKEN"); try { $response = (new Dropbox\Sign\Api\TemplateApi(config: $config))->templateFiles( template_id: "f57db65d3f933b5316d398057a36176831451a35", ); copy($response->getRealPath(), __DIR__ . '/file_response'); } catch (Dropbox\Sign\ApiException $e) { echo "Exception when calling TemplateApi#templateFiles: {$e->getMessage()}"; } ``` ```csharp C# using System; using System.Collections.Generic; using System.IO; using System.Text.Json; using Dropbox.Sign.Api; using Dropbox.Sign.Client; using Dropbox.Sign.Model; namespace Dropbox.SignSandbox; public class TemplateFilesExample { public static void Run() { var config = new Configuration(); config.Username = "YOUR_API_KEY"; // config.AccessToken = "YOUR_ACCESS_TOKEN"; try { var response = new TemplateApi(config).TemplateFiles( templateId: "f57db65d3f933b5316d398057a36176831451a35" ); var fileStream = File.Create("./file_response"); response.Seek(0, SeekOrigin.Begin); response.CopyTo(fileStream); fileStream.Close(); } catch (ApiException e) { Console.WriteLine("Exception when calling TemplateApi#TemplateFiles: " + e.Message); Console.WriteLine("Status Code: " + e.ErrorCode); Console.WriteLine(e.StackTrace); } } } ``` ```typescript TypeScript import * as fs from 'fs'; import api from "@dropbox/sign" import models from "@dropbox/sign" const apiCaller = new api.TemplateApi(); apiCaller.username = "YOUR_API_KEY"; // apiCaller.accessToken = "YOUR_ACCESS_TOKEN"; apiCaller.templateFiles( "f57db65d3f933b5316d398057a36176831451a35", // templateId undefined, // fileType ).then(response => { fs.createWriteStream('./file_response').write(response.body); }).catch(error => { console.log("Exception when calling TemplateApi#templateFiles:"); console.log(error.body); }); ``` ```java Java package com.dropbox.sign_sandbox; import com.dropbox.sign.ApiException; import com.dropbox.sign.Configuration; import com.dropbox.sign.api.*; import com.dropbox.sign.auth.*; import com.dropbox.sign.JSON; import com.dropbox.sign.model.*; import java.io.File; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; public class TemplateFilesExample { public static void main(String[] args) { var config = Configuration.getDefaultApiClient(); ((HttpBasicAuth) config.getAuthentication("api_key")).setUsername("YOUR_API_KEY"); // ((HttpBearerAuth) config.getAuthentication("oauth2")).setBearerToken("YOUR_ACCESS_TOKEN"); try { var response = new TemplateApi(config).templateFiles( "f57db65d3f933b5316d398057a36176831451a35", // templateId null // fileType ); response.renameTo(new File("./file_response")); } catch (ApiException e) { System.err.println("Exception when calling TemplateApi#templateFiles"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ```ruby Ruby require "json" require "dropbox-sign" Dropbox::Sign.configure do |config| config.username = "YOUR_API_KEY" # config.access_token = "YOUR_ACCESS_TOKEN" end begin response = Dropbox::Sign::TemplateApi.new.template_files( "f57db65d3f933b5316d398057a36176831451a35", # template_id ) FileUtils.cp(response.path, "./file_response") rescue Dropbox::Sign::ApiError => e puts "Exception when calling TemplateApi#template_files: #{e}" end ``` ```python Python import json from datetime import date, datetime from pprint import pprint from dropbox_sign import ApiClient, ApiException, Configuration, api, models configuration = Configuration( username="YOUR_API_KEY", # access_token="YOUR_ACCESS_TOKEN", ) with ApiClient(configuration) as api_client: try: response = api.TemplateApi(api_client).template_files( template_id="f57db65d3f933b5316d398057a36176831451a35", ) open("./file_response", "wb").write(response.read()) except ApiException as e: print("Exception when calling TemplateApi#template_files: %s\n" % e) ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.hellosign.com/v3/template/files/f57db65d3f933b5316d398057a36176831451a35" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Basic :") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```swift import Foundation let headers = ["Authorization": "Basic :"] let request = NSMutableURLRequest(url: NSURL(string: "https://api.hellosign.com/v3/template/files/f57db65d3f933b5316d398057a36176831451a35")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```