# List templates

GET https://services.leadconnectorhq.com/proposals/templates

List document contract templates for a location

## Authentication

Send `Authorization: Bearer <token>` using any one of:

- **Sub-Account token: OAuth access token or Private Integration Token.** No scopes required.
- **Agency token: OAuth access token or Private Integration Token.** No scopes required.

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location Id |
| `dateFrom` | string | No | Date start from (ISO 8601) |
| `dateTo` | string | No | Date to (ISO 8601) |
| `type` | string | No | Comma-separated template types. Valid values: proposal, estimate, contentLibrary |
| `name` | string | No | Template Name |
| `isPublicDocument` | boolean | No | If the docForm is a DocForm |
| `userId` | string | No | User Id, required when isPublicDocument is true |
| `limit` | string | No | Limit |
| `skip` | string | No | Skip |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/proposals/templates": {
      "get": {
        "summary": "List templates",
        "operationId": "listTemplates",
        "description": "List document contract templates for a location",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "query",
            "description": "Location Id",
            "schema": {
              "example": "jhg64gjhb436fv",
              "type": "string"
            }
          },
          {
            "name": "dateFrom",
            "required": false,
            "in": "query",
            "description": "Date start from (ISO 8601)",
            "schema": {
              "example": "2025-02-03T18:30:00.000Z",
              "type": "string"
            }
          },
          {
            "name": "dateTo",
            "required": false,
            "in": "query",
            "description": "Date to (ISO 8601)",
            "schema": {
              "example": "2025-02-14T18:29:59.999Z",
              "type": "string"
            }
          },
          {
            "name": "type",
            "required": false,
            "in": "query",
            "description": "Comma-separated template types. Valid values: proposal, estimate, contentLibrary",
            "schema": {
              "example": "proposal,estimate",
              "type": "string"
            }
          },
          {
            "name": "name",
            "required": false,
            "in": "query",
            "description": "Template Name",
            "schema": {
              "example": "Template Name",
              "type": "string"
            }
          },
          {
            "name": "isPublicDocument",
            "required": false,
            "in": "query",
            "description": "If the docForm is a DocForm",
            "schema": {
              "example": false,
              "type": "boolean"
            }
          },
          {
            "name": "userId",
            "required": false,
            "in": "query",
            "description": "User Id, required when isPublicDocument is true",
            "schema": {
              "example": "1234567890",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Limit",
            "schema": {
              "example": "10",
              "type": "string"
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "description": "Skip",
            "schema": {
              "example": "0",
              "type": "string"
            }
          },
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Templates fetched successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateListPaginationResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": []
          },
          {
            "Agency-Access": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      }
    },
    "schemas": {
      "TemplateListPaginationResponseDTO": {
        "type": "object",
        "properties": {
          "data": {
            "description": "Array of templates",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "_id": {
                  "type": "string",
                  "example": "685d11c371c22e636e9c04b2",
                  "description": "Template ID"
                },
                "deleted": {
                  "type": "boolean",
                  "example": false,
                  "description": "Whether the template is deleted"
                },
                "version": {
                  "type": "number",
                  "example": 2,
                  "description": "Template version"
                },
                "name": {
                  "type": "string",
                  "example": "New Template",
                  "description": "Template name"
                },
                "locationId": {
                  "type": "string",
                  "example": "5rORm9p7RtxWQPzBIbTG",
                  "description": "Location ID"
                },
                "type": {
                  "type": "string",
                  "example": "proposal",
                  "description": "Template type",
                  "enum": [
                    "proposal",
                    "estimate",
                    "contentLibrary"
                  ]
                },
                "updatedBy": {
                  "type": "string",
                  "example": "K9PSPnWjfNoE8DCf5LJZ",
                  "description": "User ID who last updated the template"
                },
                "isPublicDocument": {
                  "type": "boolean",
                  "example": true,
                  "description": "Whether the template is a public document"
                },
                "createdAt": {
                  "type": "string",
                  "example": "2025-06-26T09:24:19.305Z",
                  "description": "Template creation date"
                },
                "updatedAt": {
                  "type": "string",
                  "example": "2025-06-26T09:27:32.119Z",
                  "description": "Template last update date"
                },
                "id": {
                  "type": "string",
                  "example": "685d11c371c22e636e9c04b2",
                  "description": "Template ID (alias for _id)"
                },
                "documentCount": {
                  "type": "number",
                  "example": 0,
                  "description": "Document count (only present when isPublicDocument is true)"
                },
                "docFormUrl": {
                  "type": "string",
                  "example": "https://staging.sendlink.co/documents/doc-form/685d11c371c22e636e9c04b2?locale=en_US",
                  "description": "Document form URL (only present when isPublicDocument is true)"
                }
              },
              "required": [
                "_id",
                "deleted",
                "version",
                "name",
                "locationId",
                "type",
                "updatedBy",
                "isPublicDocument",
                "createdAt",
                "updatedAt",
                "id"
              ],
              "title": "TemplateListResponseDTO"
            }
          },
          "total": {
            "type": "number",
            "example": 2,
            "description": "Total number of templates"
          },
          "traceId": {
            "type": "string",
            "example": "d5656876-86a5-46fb-84df-788f1da7937a",
            "description": "Trace ID for request tracking"
          }
        },
        "required": [
          "data",
          "total"
        ],
        "title": "TemplateListPaginationResponseDTO"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/proposals/templates?locationId=<LOCATIONID>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/proposals/templates?locationId=<LOCATIONID>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/proposals/templates"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

params = {
    "locationId": "<LOCATIONID>"
}

response = requests.get(url, params=params, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/proposals/templates?locationId=<LOCATIONID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/proposals/templates?locationId=<LOCATIONID>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {
  url := "https://services.leadconnectorhq.com/proposals/templates?locationId=<LOCATIONID>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/proposals/templates?locationId=<LOCATIONID>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/proposals/templates?locationId=<LOCATIONID>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
