# E-Signature Templates

Source: https://docs.autessa.com/docs/api/poweruser/esignature-templates

> Poweruser endpoints for building reusable e-signature templates and instantiating envelopes from them.

# E-Signature Templates

Turn a recurring document into a reusable template: fix the PDF and field layout once, define named roles instead of concrete signers, then stamp out ready-to-send envelopes by binding each role to real people.

> All paths on this page are relative to `https://api.autessa.com/autessa_poweruser/e-signature`. Every request is a POST with a JSON body. Template, role, and field IDs are **UUID strings**; user IDs are the usual opaque ID strings. See the [Poweruser API overview](/docs/api/poweruser.md) for authentication and conventions.

---

## Template → envelope instantiation

A template is the same building blocks as an envelope — a PDF plus a field
layout — with one difference: instead of recipients, fields bind to
**roles** (for example "Client", "Contractor"). Roles carry the same
signer-slot semantics as recipients (`orderIndex`, `signingGroup`).

The lifecycle:

1. Upload the PDF via
   [`/generate-file-upload-link`](/docs/api/poweruser/esignature-envelopes.md#generate-a-file-upload-link)
   and register it with [`/template/create`](#create-a-template).
2. Define roles with [`/template/roles`](#set-roles) and place
   fields with [`/template/fields`](#set-fields), referencing
   `roleId` instead of `recipientId`.
3. Call [`/template/create-envelope`](#create-an-envelope-from-a-template) with a
   `roleAssignments` list binding each role to one or more real recipients.
   This clones the PDF and field layout into a normal `DRAFT` envelope —
   tweak it if needed, then send it via
   [`/envelope/send`](/docs/api/poweruser/esignature-envelopes.md#send-an-envelope).

Instantiation copies; it does not link. Later edits to the template never
affect envelopes already created from it.

---

## The template object

Returned by create, get, set-roles, set-fields, share, and unshare.

- `id` (uuid) — Unique template identifier.
- `companyId` (string) — Owning company.
- `ownerUserId` (string) — The user who owns the template.
- `title` (string) — Display title. Envelopes created from the template inherit it unless overridden.
- `description` (string) — What the template is for.
- `signingOrder` (string) — Default signing order inherited by created envelopes: `PARALLEL` or `SEQUENTIAL`.
- `completionPolicy` (string) — Default completion policy inherited by created envelopes: `ALL` or `ANY_ONE`.
- `sharingLevel` (string) — `PRIVATE`, `SPECIFIC_MEMBER`, or `COMPANY`.
- `sha256Original` (string) — SHA-256 of the template PDF.
- `viewPdfUrl` (string) — Time-boxed presigned URL for the template PDF.
- `roles` (array<TemplateRole>) — Roles: `id` (uuid), `roleName`, `orderIndex`, `signingGroup` (roles sharing a slot form a client group once instantiated), `colorIndex` (used by the Builder's field editor).
- `fields` (array<TemplateField>) — Fields, mirroring envelope fields but bound to a `roleId` when `fillSource` is `SIGNER`: `id`, `fillSource`, `roleId`, `fieldType`, placement (`pageIndex`, `xPct`, `yPct`, `widthPct`, `heightPct`, `rotation`), `required`, `value`, `valueImageUrl`, and font styling (`fontFamily`, `fontSize`, `fontColor`).
- `shares` (array<SharePermission>) — Per-user grants (`userId`, `userEmail`, `userName`, `accessLevel`, `grantedBy`, `grantedByName`, `createdAt`). The owner is not listed — they have implicit ADMIN.
- `myAccessLevel` (string) — The calling user's effective access level: `READ`, `WRITE`, `PUBLISH`, or `ADMIN`.
- `createdAt` (string) — ISO-8601 creation timestamp.
- `updatedAt` (string) — ISO-8601 timestamp of the last update.
- `iAmOwner` (boolean) — Whether the calling user owns the template.

```json title="Template object (truncated)"
{
  "id": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
  "companyId": "cP2mK7dX4v",
  "ownerUserId": "uB7nT2wQ9k",
  "title": "Standard NDA",
  "description": "Mutual NDA for vendor engagements.",
  "signingOrder": "PARALLEL",
  "completionPolicy": "ALL",
  "sharingLevel": "COMPANY",
  "viewPdfUrl": "https://s3.amazonaws.com/autessa-esign/...",
  "roles": [
    {
      "id": "r1a2b3c4-d5e6-4f7a-8b9c-0d1e2f3a4b5c",
      "roleName": "Counterparty",
      "orderIndex": 1,
      "signingGroup": 1,
      "colorIndex": 0
    }
  ],
  "fields": [
    {
      "id": "f9e8d7c6-b5a4-4321-8f0e-1d2c3b4a5968",
      "fillSource": "SIGNER",
      "roleId": "r1a2b3c4-d5e6-4f7a-8b9c-0d1e2f3a4b5c",
      "fieldType": "SIGNATURE",
      "pageIndex": 3,
      "xPct": 12.5, "yPct": 80.0,
      "widthPct": 30.0, "heightPct": 5.0,
      "required": true
    }
  ],
  "shares": [],
  "myAccessLevel": "ADMIN",
  "iAmOwner": true
}
```

---

## Create a template

**POST** `/e-signature/template/create`

Registers a template around a PDF already uploaded via
[`/generate-file-upload-link`](/docs/api/poweruser/esignature-envelopes.md#generate-a-file-upload-link).

### Request parameters

- `title` (string, required) — Template title.
- `description` (string) — What the template is for.
- `s3Uri` (string, required) — The `s3Uri` key returned by the file-upload-link flow. The older `s3://` form is still accepted.
- `signingOrder` (string) — Default signing order for created envelopes; null means `PARALLEL`.
- `completionPolicy` (string) — Default completion policy for created envelopes; null means `ALL`.

### Response

- `template` (Template) — The new [template object](#the-template-object).
- `errors` (array<string>) — Error messages, if any occurred.

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/e-signature/template/create \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Standard NDA",
    "description": "Mutual NDA for vendor engagements.",
    "s3Uri": "temp/esignature/1024/4c8b2e7d.pdf",
    "signingOrder": "PARALLEL",
    "completionPolicy": "ALL"
  }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/e-signature/template/create',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      title: 'Standard NDA',
      description: 'Mutual NDA for vendor engagements.',
      s3Uri: 'temp/esignature/1024/4c8b2e7d.pdf'
    })
  }
);

const { template } = await response.json();
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/e-signature/template/create',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={
        'title': 'Standard NDA',
        'description': 'Mutual NDA for vendor engagements.',
        's3Uri': 'temp/esignature/1024/4c8b2e7d.pdf'
    }
)

template = response.json()['template']
```

```json title="Response (truncated)"
{
  "template": {
    "id": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
    "title": "Standard NDA",
    "signingOrder": "PARALLEL",
    "completionPolicy": "ALL",
    "roles": [],
    "fields": [],
    "iAmOwner": true
  },
  "errors": []
}
```

---

## Get a template

**POST** `/e-signature/template/get`

Retrieves a template's full detail: roles, field layout, sharing, and a
presigned URL for the PDF.

### Request parameters

- `templateId` (uuid, required) — The template to fetch.

### Response

- `template` (Template) — The [template object](#the-template-object).
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/e-signature/template/get \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "templateId": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f" }'
```

```json title="Response (truncated)"
{
  "template": {
    "id": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
    "title": "Standard NDA",
    "roles": [
      { "id": "r1a2b3c4-d5e6-4f7a-8b9c-0d1e2f3a4b5c", "roleName": "Counterparty" }
    ],
    "myAccessLevel": "ADMIN"
  },
  "errors": []
}
```

---

## List templates

**POST** `/e-signature/template/list`

Lists templates visible to the linked user, with search and pagination.

### Request parameters

- `search` (string) — Title search string.
- `page` (integer) — Page index.
- `pageSize` (integer) — Entries per page.

### Response

- `templates` (array<TemplateSummary>) — Summaries: `id`, `title`, `description`, `roleCount`, `fieldCount`, `sharingLevel`, `myAccessLevel`, `createdAt`, `updatedAt`, `iAmOwner`, `ownerUserId`.
- `total` (integer) — Total templates across all pages.
- `page` (integer) — The page returned.
- `pageSize` (integer) — Entries per page.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/e-signature/template/list \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "search": "NDA", "page": 0, "pageSize": 20 }'
```

```json title="Response"
{
  "templates": [
    {
      "id": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
      "title": "Standard NDA",
      "description": "Mutual NDA for vendor engagements.",
      "roleCount": 1,
      "fieldCount": 4,
      "sharingLevel": "COMPANY",
      "myAccessLevel": "ADMIN",
      "iAmOwner": true,
      "createdAt": "2026-05-02T11:00:00",
      "updatedAt": "2026-06-20T09:45:12"
    }
  ],
  "total": 3,
  "page": 0,
  "pageSize": 20,
  "errors": []
}
```

---

## Set roles

**POST** `/e-signature/template/roles`

Replaces the template's role list. Include `id` on an entry to update an
existing role; omit it to create a new one. Fields reference roles, so
removing a role a field points at invalidates that field binding.

### Request parameters

- `templateId` (uuid, required) — The template to update.
- `roles` (array<TemplateRoleInput>, required) — The full role list.
- `roles[].id` (uuid) — Present when updating an existing role; omit when adding.
- `roles[].roleName` (string, required) — Role name, for example `"Client"` or `"Contractor"`.
- `roles[].orderIndex` (integer) — 1-based position for `SEQUENTIAL` signing.
- `roles[].signingGroup` (integer) — Signer slot (1-based); roles sharing a slot form a client group once instantiated. Null means own slot.
- `roles[].colorIndex` (integer) — Color used to render the role's fields in the Builder editor.

### Response

- `template` (Template) — The updated [template object](#the-template-object).
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/e-signature/template/roles \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
    "roles": [
      { "roleName": "Counterparty", "orderIndex": 1, "signingGroup": 1 },
      { "roleName": "Acme Signatory", "orderIndex": 2, "signingGroup": 2 }
    ]
  }'
```

```json title="Response (truncated)"
{
  "template": {
    "id": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
    "roles": [
      { "id": "r1a2b3c4-d5e6-4f7a-8b9c-0d1e2f3a4b5c", "roleName": "Counterparty" },
      { "id": "r2b3c4d5-e6f7-4a8b-9c0d-1e2f3a4b5c6d", "roleName": "Acme Signatory" }
    ]
  },
  "errors": []
}
```

---

## Set fields

**POST** `/e-signature/template/fields`

**Fully replaces** the template's field set. Identical to
[envelope field placement](/docs/api/poweruser/esignature-envelopes.md#set-fields),
except `SIGNER` fields reference a `roleId` instead of a `recipientId`.

### Request parameters

- `templateId` (uuid, required) — The template to update.
- `fields` (array<TemplateFieldInput>, required) — The complete field set.
- `fields[].id` (uuid) — Optional on create, required when editing an existing field.
- `fields[].fillSource` (string, required) — `SIGNER` or `PREFILL`.
- `fields[].roleId` (uuid) — Required when `fillSource` is `SIGNER` — the role that fills the field.
- `fields[].fieldType` (string, required) — `SIGNER`: `SIGNATURE`, `INITIALS`, `NAME`, `EMAIL`, `DATE_SIGNED`, `TEXT_INPUT`, `CHECKBOX`, `DROPDOWN`. `PREFILL`: `TEXT_STATIC`, `DATE_STATIC`, `IMAGE_STATIC`.
- `fields[].pageIndex` (integer, required) — Zero-based PDF page.
- `fields[].xPct` (number, required) — Left edge as a percentage of page width.
- `fields[].yPct` (number, required) — Top edge as a percentage of page height.
- `fields[].widthPct` (number, required) — Width as a percentage of page width.
- `fields[].heightPct` (number, required) — Height as a percentage of page height.
- `fields[].rotation` (integer) — Rotation in degrees.
- `fields[].required` (boolean, required) — Whether the signer must fill it.
- `fields[].value` (string) — Static text (`PREFILL`) or baseline display value.
- `fields[].valueImageS3Key` (string) — For `PREFILL` `IMAGE_STATIC` — S3 key uploaded via the file-upload-link flow.
- `fields[].fontFamily` (string) — Render font.
- `fields[].fontSize` (integer) — Render font size.
- `fields[].fontColor` (string) — Render font color.

### Response

- `template` (Template) — The updated [template object](#the-template-object).
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/e-signature/template/fields \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
    "fields": [
      {
        "fillSource": "SIGNER",
        "roleId": "r1a2b3c4-d5e6-4f7a-8b9c-0d1e2f3a4b5c",
        "fieldType": "SIGNATURE",
        "pageIndex": 3,
        "xPct": 12.5, "yPct": 80.0,
        "widthPct": 30.0, "heightPct": 5.0,
        "required": true
      },
      {
        "fillSource": "SIGNER",
        "roleId": "r1a2b3c4-d5e6-4f7a-8b9c-0d1e2f3a4b5c",
        "fieldType": "DATE_SIGNED",
        "pageIndex": 3,
        "xPct": 55.0, "yPct": 80.0,
        "widthPct": 20.0, "heightPct": 3.0,
        "required": true
      }
    ]
  }'
```

```json title="Response (truncated)"
{
  "template": {
    "id": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
    "fields": [
      { "id": "f9e8d7c6-b5a4-4321-8f0e-1d2c3b4a5968", "fieldType": "SIGNATURE" },
      { "id": "f0f9e8d7-c6b5-4432-9a1f-2e3d4c5b6a79", "fieldType": "DATE_SIGNED" }
    ]
  },
  "errors": []
}
```

---

## Create an envelope from a template

**POST** `/e-signature/template/create-envelope`

Instantiates a `DRAFT` envelope from the template: clones the PDF and field
layout, and binds each role to real recipients. The result is a normal
envelope — adjust it if needed, then send it via
[`/envelope/send`](/docs/api/poweruser/esignature-envelopes.md#send-an-envelope).

Each role assignment takes one **primary** recipient first, then optional
a **client group** sharing the role's signer slot — any one of them signing
satisfies it.

### Request parameters

- `templateId` (uuid, required) — The template to instantiate.
- `title` (string) — Overrides the template title for the created envelope.
- `roleAssignments` (array<RoleAssignment>, required) — One entry per template role.
- `roleAssignments[].roleId` (uuid, required) — The template role being bound.
- `roleAssignments[].recipients` (array<RecipientInput>, required) — Primary recipient first, then the rest of the client group. At least one required. Each entry: `email`, `name`, and optionally `recipientKind` (`SIGNER` or `VIEWER`).

### Response

- `envelope` (Envelope) — The new `DRAFT` envelope — see [the envelope object](/docs/api/poweruser/esignature-envelopes.md#the-envelope-object).
- `errors` (array<string>) — Error messages, if any occurred (for example an unassigned role).

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/e-signature/template/create-envelope \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
    "title": "NDA — Northwind Traders",
    "roleAssignments": [
      {
        "roleId": "r1a2b3c4-d5e6-4f7a-8b9c-0d1e2f3a4b5c",
        "recipients": [
          { "email": "dana@northwind.com", "name": "Dana Fuentes" }
        ]
      }
    ]
  }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/e-signature/template/create-envelope',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      templateId: 't8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f',
      title: 'NDA — Northwind Traders',
      roleAssignments: [
        {
          roleId: 'r1a2b3c4-d5e6-4f7a-8b9c-0d1e2f3a4b5c',
          recipients: [
            { email: 'dana@northwind.com', name: 'Dana Fuentes' },
            // Client group — shares the role's signer slot
            { email: 'cfo@northwind.com', name: 'Ed Silva' }
          ]
        }
      ]
    })
  }
);

const { envelope } = await response.json();
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/e-signature/template/create-envelope',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={
        'templateId': 't8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f',
        'title': 'NDA — Northwind Traders',
        'roleAssignments': [
            {
                'roleId': 'r1a2b3c4-d5e6-4f7a-8b9c-0d1e2f3a4b5c',
                'recipients': [
                    {'email': 'dana@northwind.com', 'name': 'Dana Fuentes'}
                ]
            }
        ]
    }
)

envelope = response.json()['envelope']
```

```json title="Response (truncated)"
{
  "envelope": {
    "id": "f4c2d7b3-0a5e-4d9f-c8b2-3e6a9d0f1b24",
    "title": "NDA — Northwind Traders",
    "status": "DRAFT",
    "signingOrder": "PARALLEL",
    "completionPolicy": "ALL",
    "recipients": [
      {
        "email": "dana@northwind.com",
        "name": "Dana Fuentes",
        "signingGroup": 1,
        "status": "PENDING"
      }
    ]
  },
  "errors": []
}
```

---

## Share a template

**POST** `/e-signature/template/share`

Updates the template's sharing configuration — replaces the per-user grant
list and optionally changes the baseline sharing level. The owner has
implicit ADMIN and must not appear in `shares`.

> This endpoint changes the same sharing as the [Share dialog](/docs/guide/platform/sharing.md). Sharing with `COMPANY` adds a company-wide grant and keeps everyone already shared individually at their own level. People get the highest level from any grant that covers them.

### Request parameters

- `templateId` (uuid, required) — The template to share.
- `sharingLevel` (string) — `PRIVATE`, `SPECIFIC_MEMBER`, or `COMPANY`.
- `shares` (array<ShareInput>) — Replacement per-user grants. Each entry: `userId` (string) and `accessLevel` (`READ`, `WRITE`, `PUBLISH`, or `ADMIN`).

### Response

- `template` (Template) — The updated [template object](#the-template-object) with the new `shares`.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/e-signature/template/share \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
    "sharingLevel": "SPECIFIC_MEMBER",
    "shares": [
      { "userId": "uK4pV8sM3d", "accessLevel": "WRITE" }
    ]
  }'
```

```json title="Response (truncated)"
{
  "template": {
    "id": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
    "sharingLevel": "SPECIFIC_MEMBER",
    "shares": [
      {
        "userId": "uK4pV8sM3d",
        "userEmail": "sam@acme.com",
        "accessLevel": "WRITE"
      }
    ]
  },
  "errors": []
}
```

---

## Unshare a template

**POST** `/e-signature/template/unshare`

Revokes one user's access grant.

### Request parameters

- `templateId` (uuid, required) — The template.
- `userId` (string, required) — The user whose grant to remove.

### Response

- `template` (Template) — The updated [template object](#the-template-object).
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/e-signature/template/unshare \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
    "userId": "uK4pV8sM3d"
  }'
```

```json title="Response (truncated)"
{
  "template": {
    "id": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f",
    "sharingLevel": "SPECIFIC_MEMBER",
    "shares": []
  },
  "errors": []
}
```

---

## Delete a template

**POST** `/e-signature/template/delete`

Permanently deletes a template. Envelopes already created from it are
unaffected — instantiation copies rather than links.

### Request parameters

- `templateId` (uuid, required) — The template to delete.

### Response

- `deleted` (boolean) — Whether the template was deleted.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/e-signature/template/delete \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "templateId": "t8d4e9f1-2a6b-4c3d-8e7f-5a9b0c1d2e3f" }'
```

```json title="Response"
{
  "deleted": true,
  "errors": []
}
```

---

## Errors

| Status | When |
|--------|------|
| `200` | Success — check `errors` for validation messages (unknown template, missing role assignment, field bound to a removed role). |
| `401` | Invalid or missing poweruser key, or the linked user lacks access to the template. |
| `403` | Scoped key without the endpoint in its allow-list. |
| `408` | Server-side error; `errors` contains the message. |

---

## Related

- [Poweruser API overview](/docs/api/poweruser.md)
- [E-Signature Envelopes (Poweruser API)](/docs/api/poweruser/esignature-envelopes.md)
- [Document signing guide](/docs/guide/platform/document-signing.md)

