> For the complete documentation index, see [llms.txt](https://learn.withessential.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.withessential.com/administration/settings/edit-a-document-templates-design-with-edit-code.md).

# Edit a document template's design with "Edit code"

For full control over how an invoice or quote document looks, open "Edit code". This opens the template's raw Liquid source in a side-by-side editor: you type in the source on the left and a live preview updates on the right as you go, rendered with sample data so you can see real layout without affecting any actual customer document.

A panel of available variables sits beside the editor; click any variable to insert it at your cursor, so you don't have to remember the exact code. You can switch the preview between sample customers, properties, and line items to check how the template handles different data.

If you go too far or want a clean slate, "Reset to default" reverts the source back to its default (for a library template that's the library style's default; for a customized template it's your saved version).

Nothing is applied until you choose "Save template", and you'll see an "Unsaved changes" marker while edits are pending. One requirement: editing source needs the document-template source-editing permission in addition to permission to change that template type.

Without it, you can still browse the template library, switch templates, and preview them, but the "Edit code" and "Customize" buttons won't appear. If you need to edit template source, contact your business's administrator to review your role.

> **Where to find it:** Settings > Invoicing (or Settings > Quotes), in the template section. Use the "Edit code" or "Customize" button. (You'll need both write access to the template type and the document-template source-editing permission.)

## Related guides

* [Choose and customize your invoice document template](/administration/settings/choose-and-customize-your-invoice-document-template.md)
* [Choose and customize your quote document template](/administration/settings/choose-and-customize-your-quote-document-template.md)
* [Create Terms & Conditions sets for quotes](/administration/settings/create-terms-and-conditions-sets-for-quotes.md)
* [Set up invoice prompt templates for AI drafting](/administration/settings/set-up-invoice-prompt-templates-for-ai-drafting.md)
* [Set up quote prompt templates for AI drafting](/administration/settings/set-up-quote-prompt-templates-for-ai-drafting.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.withessential.com/administration/settings/edit-a-document-templates-design-with-edit-code.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
