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

# Update a template

> Renames a template or changes its design.

A new `definition` creates a new revision. Passes you issue afterwards use it. Existing passes keep the revision they were issued with.

<ParamField path="id" type="string" required>
  The template ID.
</ParamField>

<ParamField header="Idempotency-Key" type="string" required>
  A unique value for this request.
</ParamField>

<ParamField body="expectedRevision" type="integer" required>
  The template's current `revision`. If someone changed the template since you read it, the update is rejected instead of overwriting their work.
</ParamField>

<ParamField body="name" type="string">
  A new name, from 1 to 100 characters.
</ParamField>

<ParamField body="definition" type="object">
  A complete new design. It replaces the current one.
</ParamField>

### Response

Returns the updated [template](/api-reference/templates/get).

### Errors

| Status | When |
| - | - |
| `400` | The definition is invalid. Each problem is listed in `error.issues`. |
| `404` | The template doesn't exist. |
| `409` | `expectedRevision` isn't the current revision, or the template is archived. |

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH https://api.tapace.lk/v1/templates/tmpl_Q4vN8xT2mLr7KpZs3Wd1 \
    -H "Authorization: Bearer $TAPACE_API_KEY" \
    -H "Idempotency-Key: 2f8c4a1e-6b3d-4e9a-8c7f-1a5d9e3b2c60" \
    -H "Content-Type: application/json" \
    -d '{ "expectedRevision": 3, "name": "Gold membership 2027" }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "object": "template",
    "id": "tmpl_Q4vN8xT2mLr7KpZs3Wd1",
    "type": "generic",
    "name": "Gold membership 2027",
    "revision": 3,
    "archived": false,
    "requiredFields": ["memberName"],
    "createdAt": "2026-10-01T09:00:00.000Z",
    "updatedAt": "2026-10-13T09:30:00.000Z"
  }
  ```

  ```json 409 theme={null}
  {
    "error": {
      "type": "conflict_error",
      "message": "Template was modified since you loaded it."
    },
    "requestId": "req_8f3a2c1d9e7b6a54"
  }
  ```
</ResponseExample>


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