Skip to content

Edit template code

POST/templates/{id}/edit_code

Costs 2 rate-limit points · Rate limits

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.

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.

Also searched asedit template codechange the css in the templatechange a colour in the template htmlreplace text in the template liquidfix one line of the template codepatch the template

Path parameters

  • idstringRequired

    Template id.

Request body

  • editsarray of objectsRequired

    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 ("" deletes it).

    Show 2 child attributesHide child attributes
    • findstringRequired
      Example: color: #333333;
    • replacestringRequired
      Example: color: #1a56db;

Returns

  • idinteger
    Example: 113
  • namestring
    Example: Main invoice
  • document_typestring
    Example: invoice
  • designobject, nullable
  • default_forobject
    Show 4 child attributesHide child attributes
    • ordersboolean
      Example: false
    • draft_ordersboolean
      Example: false
    • pos_ordersboolean
      Example: false
    • credit_notesboolean
      Example: false
  • logoobject
    Show 4 child attributesHide child attributes
    • enabledboolean
      Example: true
    • urlstring, nullable
    • widthinteger
      Example: 150
    • lock_aspect_ratioboolean
      Example: true
  • created_atstring
    Example: 2026-11-18T00:07:09Z
  • updated_atstring
    Example: 2026-11-18T00:07:10Z
  • styleobject
    Show 4 child attributesHide child attributes
    • accent_colorstring
      Example: #000000
    • font_familystring
      Example: Arial
    • font_sizeinteger
      Example: 12
    • date_formatstring
      Example: MMM DD, YYYY
  • numberingobject
    Show 5 child attributesHide child attributes
    • prefixstring
      Example: INV
    • next_numberstring, nullable
    • use_order_numberboolean
      Example: true
    • credit_notes_use_order_numberboolean
      Example: false
    • sequential_numbering_availableboolean
      Example: true
  • sectionsobject
    Show 8 child attributesHide child attributes
    • order_informationobject
      Show 14 child attributesHide child attributes
      • show_invoice_numberboolean
        Example: true
      • show_custom_invoice_numberboolean
        Example: false
      • show_order_numberboolean
        Example: true
      • show_po_numberboolean
        Example: false
      • show_delivery_note_numberboolean
        Example: false
      • show_order_dateboolean
        Example: true
      • show_issue_dateboolean
        Example: false
      • show_due_dateboolean
        Example: false
      • show_fulfillment_dateboolean
        Example: false
      • show_payment_termsboolean
        Example: false
      • show_order_amountboolean
        Example: true
      • show_order_tagsboolean
        Example: false
      • show_barcodeboolean
        Example: false
      • show_order_barcodeboolean
        Example: false
    • payment_informationobject
      Show 10 child attributesHide child attributes
      • show_payment_addressboolean
        Example: true
      • show_payment_methodboolean
        Example: true
      • show_payment_breakdownboolean
        Example: false
      • show_credit_cardboolean
        Example: true
      • show_financial_statusboolean
        Example: false
      • show_discount_codeboolean
        Example: false
      • show_tax_dateboolean
        Example: false
      • show_tracking_companyboolean
        Example: false
      • show_tracking_numbersboolean
        Example: false
      • show_paid_by_customerboolean
        Example: true
    • shipping_informationobject
      Show 1 child attributeHide child attributes
      • show_shipping_addressboolean
        Example: true
    • customer_informationobject
      Show 5 child attributesHide child attributes
      • show_customer_emailboolean
        Example: true
      • show_customer_phoneboolean
        Example: true
      • show_customer_noteboolean
        Example: true
      • show_localized_tax_idboolean
        Example: false
      • localized_tax_id_stringstring
        Example: Tax ID
    • itemsobject
      Show 21 child attributesHide child attributes
      • show_product_imagesboolean
        Example: true
      • show_skuboolean
        Example: true
      • show_hs_codeboolean
        Example: false
      • show_product_weightboolean
        Example: false
      • show_total_product_weightboolean
        Example: false
      • show_country_of_originboolean
        Example: false
      • show_product_typeboolean
        Example: false
      • show_product_descriptionboolean
        Example: false
      • show_note_attributesboolean
        Example: false
      • show_variantsboolean
        Example: true
      • show_selling_planboolean
        Example: false
      • show_item_discountboolean
        Example: false
      • show_discount_reasonboolean
        Example: false
      • show_compare_at_priceboolean
        Example: false
      • show_original_priceboolean
        Example: false
      • show_propertiesboolean
        Example: true
      • show_item_barcodeboolean
        Example: false
      • show_total_qtyboolean
        Example: false
      • show_item_taxboolean
        Example: true
      • show_item_tax_amountboolean
        Example: true
      • group_amount_digitsboolean
        Example: false
    • order_totalobject
      Show 16 child attributesHide child attributes
      • show_subtotalboolean
        Example: true
      • show_order_discountboolean
        Example: true
      • show_order_discount_reasonboolean
        Example: false
      • show_discount_breakdownboolean
        Example: false
      • show_taxboolean
        Example: true
      • show_tax_inclusion_labelboolean
        Example: false
      • show_tax_breakdownboolean
        Example: true
      • show_shippingboolean
        Example: true
      • show_discountsboolean
        Example: true
      • show_shipping_rate_nameboolean
        Example: true
      • show_amount_in_wordsboolean
        Example: false
      • show_total_weightboolean
        Example: false
      • show_refund_amountboolean
        Example: true
      • show_refund_reasonboolean
        Example: false
      • show_payment_linkboolean
        Example: false
      • show_balanceboolean
        Example: true
    • extraobject
      Show 6 child attributesHide child attributes
      • show_order_notesboolean
        Example: true
      • show_footer_notesboolean
        Example: false
      • footer_messagestring, nullable
      • show_store_domainboolean
        Example: false
      • store_domain_textstring, nullable
      • show_paid_unpaid_watermarkboolean
        Example: false
    • socialobject
      Show 4 child attributesHide child attributes
      • show_social_pageboolean
        Example: false
      • facebook_urlstring, nullable
      • instagram_urlstring, nullable
      • twitter_urlstring, nullable
  • label_overridesobject
  • content_translationsobject
  • liquid_codestring
    Example: <style> .title { color: #1a56db; } .total { color: #3…
  • editsarray of objects
    Show 3 child attributesHide child attributes
    • lineinteger
      Example: 2
    • beforestring
      Example: .title { color: #333333; }
    • afterstring
      Example: .title { color: #1a56db; }

Errors

403
paid_plan_required

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

404
not_found

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

422

The request failed validation. Nothing was saved.

Any request can also fail with unauthorized (401) or rate_limited (429).

Every error has the same shape: see Errors.

POST/templates/{id}/edit_code
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;"
      }
    ]
  }'
Response
{
  "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; }"
    }
  ]
}