---
title: "Edit template code"
description: "Change part of a template's Liquid/HTML source (its liquid_code) without sending all of it: a list of exact find/replace edits, run in order. Each find must match the code exactly once, spaces and line breaks included; i"
url: https://docs.invoicefalcon.com/v3-reference/templates/edit-template-code/
api: "API v3 reference"
method: POST
path: "/templates/{id}/edit_code"
---

# Edit template code

`POST https://app.invoicefalcon.com/api/v3/external/templates/{id}/edit_code`

Change part of a template's Liquid/HTML source (its liquid_code) without sending all of it: a list of exact find/replace edits, run in order. Each find must match the code exactly once, spaces and line breaks included; if any edit does not, nothing is saved and each failing edit is named (not found, or matched N times). Use it for a CSS colour, a label, a line of HTML. Returns the template in full and, per edit, the lines before and after.

**Note:** Applies to every document generated from this template from now on; existing PDFs are unchanged. Saved as a template version, so it can be restored.

## Path parameters

- `id` (string, required): Template id.

## Request body

- `edits` (array of objects, required): Up to 20 edits, each { find, replace }: find is text copied exactly from liquid_code and must match it once; replace is the new text (&quot;&quot; deletes it).
  - `find` (string, required): e.g. `color: #333333;`
  - `replace` (string, required): e.g. `color: #1a56db;`

## Returns

- `id` (integer): e.g. `113`
- `name` (string): e.g. `Main invoice`
- `document_type` (string): e.g. `invoice`
- `design` (object, nullable)
- `default_for` (object)
  - `orders` (boolean): e.g. `false`
  - `draft_orders` (boolean): e.g. `false`
  - `pos_orders` (boolean): e.g. `false`
  - `credit_notes` (boolean): e.g. `false`
- `logo` (object)
  - `enabled` (boolean): e.g. `true`
  - `url` (string, nullable)
  - `width` (integer): e.g. `150`
  - `lock_aspect_ratio` (boolean): e.g. `true`
- `created_at` (string): e.g. `2026-11-18T00:07:09Z`
- `updated_at` (string): e.g. `2026-11-18T00:07:10Z`
- `style` (object)
  - `accent_color` (string): e.g. `#000000`
  - `font_family` (string): e.g. `Arial`
  - `font_size` (integer): e.g. `12`
  - `date_format` (string): e.g. `MMM DD, YYYY`
- `numbering` (object)
  - `prefix` (string): e.g. `INV`
  - `next_number` (string, nullable)
  - `use_order_number` (boolean): e.g. `true`
  - `credit_notes_use_order_number` (boolean): e.g. `false`
  - `sequential_numbering_available` (boolean): e.g. `true`
- `sections` (object)
  - `order_information` (object)
    - `show_invoice_number` (boolean): e.g. `true`
    - `show_custom_invoice_number` (boolean): e.g. `false`
    - `show_order_number` (boolean): e.g. `true`
    - `show_po_number` (boolean): e.g. `false`
    - `show_delivery_note_number` (boolean): e.g. `false`
    - `show_order_date` (boolean): e.g. `true`
    - `show_issue_date` (boolean): e.g. `false`
    - `show_due_date` (boolean): e.g. `false`
    - `show_fulfillment_date` (boolean): e.g. `false`
    - `show_payment_terms` (boolean): e.g. `false`
    - `show_order_amount` (boolean): e.g. `true`
    - `show_order_tags` (boolean): e.g. `false`
    - `show_barcode` (boolean): e.g. `false`
    - `show_order_barcode` (boolean): e.g. `false`
  - `payment_information` (object)
    - `show_payment_address` (boolean): e.g. `true`
    - `show_payment_method` (boolean): e.g. `true`
    - `show_payment_breakdown` (boolean): e.g. `false`
    - `show_credit_card` (boolean): e.g. `true`
    - `show_financial_status` (boolean): e.g. `false`
    - `show_discount_code` (boolean): e.g. `false`
    - `show_tax_date` (boolean): e.g. `false`
    - `show_tracking_company` (boolean): e.g. `false`
    - `show_tracking_numbers` (boolean): e.g. `false`
    - `show_paid_by_customer` (boolean): e.g. `true`
  - `shipping_information` (object)
    - `show_shipping_address` (boolean): e.g. `true`
  - `customer_information` (object)
    - `show_customer_email` (boolean): e.g. `true`
    - `show_customer_phone` (boolean): e.g. `true`
    - `show_customer_note` (boolean): e.g. `true`
    - `show_localized_tax_id` (boolean): e.g. `false`
    - `localized_tax_id_string` (string): e.g. `Tax ID`
  - `items` (object)
    - `show_product_images` (boolean): e.g. `true`
    - `show_sku` (boolean): e.g. `true`
    - `show_hs_code` (boolean): e.g. `false`
    - `show_product_weight` (boolean): e.g. `false`
    - `show_total_product_weight` (boolean): e.g. `false`
    - `show_country_of_origin` (boolean): e.g. `false`
    - `show_product_type` (boolean): e.g. `false`
    - `show_product_description` (boolean): e.g. `false`
    - `show_note_attributes` (boolean): e.g. `false`
    - `show_variants` (boolean): e.g. `true`
    - `show_selling_plan` (boolean): e.g. `false`
    - `show_item_discount` (boolean): e.g. `false`
    - `show_discount_reason` (boolean): e.g. `false`
    - `show_compare_at_price` (boolean): e.g. `false`
    - `show_original_price` (boolean): e.g. `false`
    - `show_properties` (boolean): e.g. `true`
    - `show_item_barcode` (boolean): e.g. `false`
    - `show_total_qty` (boolean): e.g. `false`
    - `show_item_tax` (boolean): e.g. `true`
    - `show_item_tax_amount` (boolean): e.g. `true`
    - `group_amount_digits` (boolean): e.g. `false`
  - `order_total` (object)
    - `show_subtotal` (boolean): e.g. `true`
    - `show_order_discount` (boolean): e.g. `true`
    - `show_order_discount_reason` (boolean): e.g. `false`
    - `show_discount_breakdown` (boolean): e.g. `false`
    - `show_tax` (boolean): e.g. `true`
    - `show_tax_inclusion_label` (boolean): e.g. `false`
    - `show_tax_breakdown` (boolean): e.g. `true`
    - `show_shipping` (boolean): e.g. `true`
    - `show_discounts` (boolean): e.g. `true`
    - `show_shipping_rate_name` (boolean): e.g. `true`
    - `show_amount_in_words` (boolean): e.g. `false`
    - `show_total_weight` (boolean): e.g. `false`
    - `show_refund_amount` (boolean): e.g. `true`
    - `show_refund_reason` (boolean): e.g. `false`
    - `show_payment_link` (boolean): e.g. `false`
    - `show_balance` (boolean): e.g. `true`
  - `extra` (object)
    - `show_order_notes` (boolean): e.g. `true`
    - `show_footer_notes` (boolean): e.g. `false`
    - `footer_message` (string, nullable)
    - `show_store_domain` (boolean): e.g. `false`
    - `store_domain_text` (string, nullable)
    - `show_paid_unpaid_watermark` (boolean): e.g. `false`
  - `social` (object)
    - `show_social_page` (boolean): e.g. `false`
    - `facebook_url` (string, nullable)
    - `instagram_url` (string, nullable)
    - `twitter_url` (string, nullable)
- `label_overrides` (object)
- `content_translations` (object)
- `liquid_code` (string): e.g. `<style>
  .title { color: #1a56db; }
  .total { color: #3…`
- `edits` (array of objects)
  - `line` (integer): e.g. `2`
  - `before` (string): e.g. `  .title { color: #333333; }`
  - `after` (string): e.g. `  .title { color: #1a56db; }`

Rate limit: this call costs 2 points ([rate limits](https://docs.invoicefalcon.com/v3/docs/api-v3/rate-limits/)).

## Example request

```sh
curl -X POST "https://app.invoicefalcon.com/api/v3/external/templates/125/edit_code" \
  -H "X-Auth-Token: $INVOICE_FALCON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "edits": [
      {
        "find": "color: #333333;",
        "replace": "color: #1a56db;"
      }
    ]
  }'
```

## 200

The updated resource.

```json
{
  "id": 113,
  "name": "Main invoice",
  "document_type": "invoice",
  "design": null,
  "default_for": {
    "orders": false,
    "draft_orders": false,
    "pos_orders": false,
    "credit_notes": false
  },
  "logo": {
    "enabled": true,
    "url": null,
    "width": 150,
    "lock_aspect_ratio": true
  },
  "created_at": "2026-11-18T00:07:09Z",
  "updated_at": "2026-11-18T00:07:10Z",
  "style": {
    "accent_color": "#000000",
    "font_family": "Arial",
    "font_size": 12,
    "date_format": "MMM DD, YYYY"
  },
  "numbering": {
    "prefix": "INV",
    "next_number": null,
    "use_order_number": true,
    "credit_notes_use_order_number": false,
    "sequential_numbering_available": true
  },
  "sections": {
    "order_information": {
      "show_invoice_number": true,
      "show_custom_invoice_number": false,
      "show_order_number": true,
      "show_po_number": false,
      "show_delivery_note_number": false,
      "show_order_date": true,
      "show_issue_date": false,
      "show_due_date": false,
      "show_fulfillment_date": false,
      "show_payment_terms": false,
      "show_order_amount": true,
      "show_order_tags": false,
      "show_barcode": false,
      "show_order_barcode": false
    },
    "payment_information": {
      "show_payment_address": true,
      "show_payment_method": true,
      "show_payment_breakdown": false,
      "show_credit_card": true,
      "show_financial_status": false,
      "show_discount_code": false,
      "show_tax_date": false,
      "show_tracking_company": false,
      "show_tracking_numbers": false,
      "show_paid_by_customer": true
    },
    "shipping_information": {
      "show_shipping_address": true
    },
    "customer_information": {
      "show_customer_email": true,
      "show_customer_phone": true,
      "show_customer_note": true,
      "show_localized_tax_id": false,
      "localized_tax_id_string": "Tax ID"
    },
    "items": {
      "show_product_images": true,
      "show_sku": true,
      "show_hs_code": false,
      "show_product_weight": false,
      "show_total_product_weight": false,
      "show_country_of_origin": false,
      "show_product_type": false,
      "show_product_description": false,
      "show_note_attributes": false,
      "show_variants": true,
      "show_selling_plan": false,
      "show_item_discount": false,
      "show_discount_reason": false,
      "show_compare_at_price": false,
      "show_original_price": false,
      "show_properties": true,
      "show_item_barcode": false,
      "show_total_qty": false,
      "show_item_tax": true,
      "show_item_tax_amount": true,
      "group_amount_digits": false
    },
    "order_total": {
      "show_subtotal": true,
      "show_order_discount": true,
      "show_order_discount_reason": false,
      "show_discount_breakdown": false,
      "show_tax": true,
      "show_tax_inclusion_label": false,
      "show_tax_breakdown": true,
      "show_shipping": true,
      "show_discounts": true,
      "show_shipping_rate_name": true,
      "show_amount_in_words": false,
      "show_total_weight": false,
      "show_refund_amount": true,
      "show_refund_reason": false,
      "show_payment_link": false,
      "show_balance": true
    },
    "extra": {
      "show_order_notes": true,
      "show_footer_notes": false,
      "footer_message": null,
      "show_store_domain": false,
      "store_domain_text": null,
      "show_paid_unpaid_watermark": false
    },
    "social": {
      "show_social_page": false,
      "facebook_url": null,
      "instagram_url": null,
      "twitter_url": null
    }
  },
  "label_overrides": {},
  "content_translations": {},
  "liquid_code": "<style>\n  .title { color: #1a56db; }\n  .total { color: #333333; }\n</style>\n<h1 class=\"title\">{{ translations.title }}</h1>\n",
  "edits": [
    {
      "line": 2,
      "before": "  .title { color: #333333; }",
      "after": "  .title { color: #1a56db; }"
    }
  ]
}
```

## 401

Missing or unknown `X-Auth-Token`, or the shop uninstalled the app.

```json
{
  "errors": [
    "Invalid API key"
  ],
  "code": "unauthorized"
}
```

## 403

`v3_required`: the shop still runs the previous dashboard. `paid_plan_required`: API access needs a paid plan.

```json
{
  "errors": [
    "API access requires a paid plan"
  ],
  "code": "paid_plan_required"
}
```

## 404

The resource does not exist for this shop, or no action is registered at this path.

```json
{
  "errors": [
    "Resource not found"
  ],
  "code": "not_found"
}
```

## 422

The request failed validation. Nothing was saved.

```json
{
  "errors": [
    "id is missing"
  ]
}
```

## 429

Rate limited: cost-weighted per key (reads cost less than writes). Wait `Retry-After` seconds; see `X-RateLimit-*` headers.

```json
{
  "errors": [
    "Rate limit exceeded"
  ],
  "code": "rate_limited"
}
```

