> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spitshake.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Copy templates between accounts

> Deep-copy a template from one of your managed accounts into another.

Build a template once in a source account you manage, then copy it into each firm's account.
Both accounts must belong to the calling partner; any other account or template is a `404`. Only
a partner key can call this endpoint, never a tenant token.

```bash theme={null}
curl -X POST https://spitshake.io/api/partner/v1/accounts/412/templates \
  -H "Authorization: Bearer $SPITSHAKE_PARTNER_KEY" \
  -H "Idempotency-Key: firm-8675309-retainer-v3" \
  -H "Content-Type: application/json" \
  -d '{ "source_account_id": 400, "template_id": "tpl_4mZ9Qx2LkD8pR7sT1v", "name": "Retainer packet" }'
```

The `201` response is the new template in the shape `GET /api/templates/{id}` returns (schema,
submitters, preferences, documents) plus `account: { id, external_id }`.

## What is copied

* **Schema, submitters and preferences.** Field and submitter uuids are kept. Each document gets
  a new uuid, and every reference to it (schema areas' `attachment_uuid`,
  `preferences.document_conditions`, document lists) is rewritten, so fields stay on the right
  page of the right document.
* **Documents.** Each stored PDF is re-validated, then re-encrypted under the new template's own
  storage. The copy shares no file or row with the source.
* **Account-specific preferences** are adapted: `brand_id` is re-pointed at the target account's
  brand with the same name, or dropped; a `custom_domain` the target account does not have is
  dropped. The copy is never `shared` (a public link) until the target account turns that on.

Optional `name`, `folder_name` and `external_id` override the source's values (an empty string
clears a folder or external ID). The source template is not modified.

The copy counts against the target plan's template limit (unless the account is in test mode),
fires `template.created` to the target account's webhooks and is audited there as
`partner.template_copied`. Send an `Idempotency-Key` so a retried request does not copy twice.

| Status | Meaning |
| - | - |
| `403` | Partner suspended, or the target plan's template limit is reached. |
| `404` | Either account is not owned by this partner, or the template is not in the source account. |
| `409` | The target account is archived. |
| `422` | Missing `source_account_id` / `template_id`, an archived template, or a document that cannot be read or validated. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.