Skip to main content
Custom fields store data that DualEntry doesn’t model natively, such as an external system’s ID, on a record’s header or on each of its lines. This guide shows how to set a field’s level through the API, send values on records in either of the two accepted item shapes, update and clear values, and fix the validation errors. For which record types accept custom fields, the field types, and where values appear in the app and in reports, see Custom Fields: Record Types, Types, and Limits.

Prerequisites

Before you write custom field values through the API, confirm the following:
  • API key: Your requests send your organization’s API key in the X-API-KEY header. See authenticating your requests.
  • Field definition: A custom field exists for the record type you write to, at the level you need. Create it in the app under Configuration > Accounting Setup > Custom Fields, or through the API as described below.
  • Field name or ID: You know the field’s exact name, or its id if two fields share a name.

Set a field’s header or line level

A custom field’s level is set per record type in its applies_to list, so one definition can hold a header value, a line value, or both on each record type. Each entry has a type, the record type such as bill, and a layer: transaction for the header level (the default when you omit it) or entry for the line level. To show one field at both levels on a record type, send two entries for that type, one per layer. The following request body creates a text field named Project code that bills hold at both the header and line levels. Send it with POST /public/v2/custom-fields/:
An update with PUT /public/v2/custom-fields/{custom_field_id}/ replaces the whole applies_to list, so send every entry you want to keep. To list fields and find each field’s id, call GET /public/v2/custom-fields/. Filter it with layer=entry to list only fields available at the line level. Because definitions are writable through the API, an integration can create the fields it needs when it’s installed and then fill them on every record it writes. Definitions are shared across the organization, so agree on field names with any other integration that writes to the same record types.

Send custom field values on a record

Record create and update requests take custom field values in custom_fields arrays: one at the top level of the record for header values, and one on each line for line values. A field available only at the line level is rejected if you send it in the header custom_fields. To write a value, follow these steps:
  1. Find the field’s exact name, or its id if two fields share a name, with GET /public/v2/custom-fields/.
  2. Add an item for the field to the record’s top-level custom_fields for a header value, or to a line’s custom_fields for a line value, in either shape described below.
  3. Send the record’s create or update request.
  4. Check the custom_fields arrays in the response. They return the stored value for the field in the canonical shape.
After these steps, the value appears on the record in the app and in the record’s list and detail responses. Line custom_fields are on the line objects for bills, direct expenses, vendor credits, purchase orders, invoices, cash sales, customer credits, sales orders, customer payments, customer deposits, customer refunds, item receipts, item fulfillments, and journal entries in API v1, v2, and v3-alpha, and on quote lines from v2. The public intercompany journal entry endpoints carry no custom fields at either level; enter those values in the app. The DualEntry CLI has no line-level options of its own. Put layer and line custom_fields in the JSON file you pass with --file to dualentry custom-fields create, dualentry custom-fields update, or a record’s create and update commands. Each item in a custom_fields array sets one field. You can write an item in either of two shapes, described below, and mix them in one array.

Name-keyed shape

A name-keyed item is a one-key object whose key is the field’s exact name and whose value is the value to store. In the following bill fragment, the header sets Department code and one expense line sets Project code. Other required bill and line fields are left out:

Canonical shape

A canonical item is an object with the field’s ID under field and the value under value:
Use the canonical shape when two custom fields share a name, because a name-keyed item can’t tell them apart.

Update, clear, and read values

On an update, only the custom fields you send change, and a field you leave out of the array keeps its current value. To clear a field, send its item with the value null, either { "Project code": null } or "value": null in the canonical shape. On lines, send each existing line’s id so its values carry over. A line without an id is created as a new line. The following bill update fragment clears Department code on the header and changes Project code on an existing expense line, identified by its id. Other required bill and line fields are left out:
After a successful write, the response returns every stored value in the canonical shape, whichever shape you sent. Each item’s field holds the full field definition, including id, name, and field_type, and value holds the stored value with its custom_field_id and custom_field_name. List and detail endpoints return the same arrays, so you don’t need a second call per record to read values.

Errors

A request with a custom field problem fails with a validation error that lists each problem. The table below lists the messages, what causes each one, and how to fix it: For the error format that applies to every endpoint, see Errors.
Last modified on November 25, 2026