# PUT Replace the customiser text template

Save the whole template: send `revision` (the `template.revision` you read, or null when there is none) and the `template` you read, changed, without its read-only `key` and `revision`. Lines and areas keep their `id`; a new one sends `id` null and the server mints it. A key the document does not define is a 422 `unknown_field`, and every rule the merchant admin checks is a 422 `validation_failed` whose errors carry the admin's rule code (for example `anchor_outside_frame`, `graphic_areas_overlap`, `structure_frame_mismatch`) and a pointer. Retained metal needs a `structure` whose artwork is an import of this store at the frame's size; neon takes none. A customiser that cannot carry a template is a 422 `text_template_unavailable`, `text_template_unsupported_sign` or `text_template_unsupported_sizing`. A stale revision is a 409 `stale_revision`. An unchanged document keeps its revision. Labels, default wording and descriptions are customiser text in the authoring language; a replaced Languages draft is listed in `meta.replaced_drafts`. The storefront changes at once. Requires `customisers:write`; `Idempotency-Key` is optional and replays.

- Source URL: https://www.signcustomiser.com/help/api/v3-put-replace-the-customiser-text-template/
- Markdown URL: https://www.signcustomiser.com/help/api/v3-put-replace-the-customiser-text-template.md
- Group: Customiser text template
- OpenAPI for this group: https://www.signcustomiser.com/help/openapi/customiser-text-template.json
- Method: PUT
- Path: /api/v3/customisers/{customiser_id}/text-template
- Auth: Bearer token
- Required scopes: `customisers:write`

## Path parameters

- customiser_id (string, required): The customiser id. Example: 1

## cURL example

```bash
curl https://web.signcustomiser.com/api/v3/customisers/1/text-template \
  --request PUT \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_TOKEN'
```

## Response examples

### 200 PUT 200 example 1

```json
{
  "data": {
    "object": "text_template",
    "customiser_id": 42,
    "availability": "available",
    "sign_kind": "neon",
    "template": {
      "key": "9c4b1e7a-2d6f-4a8c-b3e5-7f1d0c9a8b6e",
      "revision": 4,
      "frame": {
        "width_mm": 600,
        "height_mm": 300
      },
      "minimum_letter_height_mm": 40,
      "fields": [
        {
          "id": "fld_abcdefghijklmnop",
          "kind": "text",
          "label": "Your name",
          "default_wording": "OPEN",
          "required": true,
          "max_characters": 20,
          "baseline": {
            "kind": "straight",
            "anchor": {
              "x_mm": 300,
              "y_mm": 200
            },
            "span_mm": 500
          },
          "fit": "letter_height",
          "letter_height": null,
          "edits": {
            "wording": true,
            "font": false,
            "colour": false
          }
        }
      ],
      "structure": null
    },
    "offered_sizes": {
      "presets": [
        {
          "size_id": 7,
          "width_cm": 60,
          "width_in": 23.6220472,
          "authored_units": {
            "width_cm": "centimetres"
          }
        }
      ],
      "custom": null,
      "custom_minimum_set": false,
      "dropped": []
    }
  },
  "links": {
    "self": "https://web.signcustomiser.com/api/v3/customisers/42/text-template",
    "documentation": "https://www.signcustomiser.com/help/api/"
  },
  "meta": {
    "api_version": "v3",
    "request_id": "req_01jz9x2k7c8f3m5n6p7q8r9s0t"
  }
}
```

### 403 Insufficient scope

```json
{
  "type": "https://www.signcustomiser.com/help/api/problems/insufficient_scope",
  "title": "Insufficient scope",
  "status": 403,
  "code": "insufficient_scope",
  "detail": "This operation requires the customisers:write scope, but the API key grants the following scopes: store:read. Create a key that includes the required scope in the merchant admin under Integrate → API Tokens.",
  "required_scopes": [
    "customisers:write"
  ],
  "granted_scopes": [
    "store:read"
  ],
  "request_id": "req_01jz9x2k7c8f3m5n6p7q8r9s0t"
}
```

### 409 Stale revision

```json
{
  "type": "https://www.signcustomiser.com/help/api/problems/stale_revision",
  "title": "Stale revision",
  "status": 409,
  "code": "stale_revision",
  "detail": "The text template is at revision 4. Read it again, apply your change and retry.",
  "errors": [
    {
      "pointer": "/revision",
      "code": "stale_revision",
      "detail": "Send the revision of the template you read."
    }
  ],
  "expected_revision": 4,
  "submitted_revision": 3,
  "request_id": "req_01jz9x2k7c8f3m5n6p7q8r9s0t"
}
```

### 422 Rule broken

```json
{
  "type": "https://www.signcustomiser.com/help/api/problems/validation_failed",
  "title": "Validation failed",
  "status": 422,
  "code": "validation_failed",
  "detail": "The request payload failed validation. Correct the fields listed in errors and retry.",
  "errors": [
    {
      "pointer": "/template/fields/0/baseline/anchor",
      "code": "anchor_outside_frame",
      "detail": "The value at /template/fields/0/baseline/anchor breaks the text template rule anchor_outside_frame."
    }
  ],
  "request_id": "req_01jz9x2k7c8f3m5n6p7q8r9s0t"
}
```
