> ## Documentation Index
> Fetch the complete documentation index at: https://api.basetools.cz/llms.txt
> Use this file to discover all available pages before exploring further.

# Extra fields

> Custom fields attached to an order — definitions, reading via getOrders, writing via setOrderFields

Extra fields are optional fields you define yourself in your Base account (types: text, number, select, checkbox, radio, date, file), and their content can be populated automatically by Base based on conditions (order source, shipping method, destination country, specific product, etc.) via Automatic Actions.

## Why this is useful

A common scenario: a client has different cost centers, invoicing series, or shipping methods per country in their ERP. Rather than replicating that entire conditional logic in your integration, it's often simpler to let Base write the resulting value into an extra field and just read it — updating a rule later (e.g. a new carrier for a given country) then only requires a change in Base, not in the integration.

## Reading

1. Get the field definitions and IDs with [`getOrderExtraFields`](https://api.baselinker.com/index.php?method=getOrderExtraFields).
2. Add `include_custom_extra_fields = true` to your [`getOrders`](/en/objednavky/stahovani-objednavek) request.
3. The response will include a `custom_extra_fields` object, keyed by extra field ID:

```json theme={null}
"custom_extra_fields": {
  "135": "B2B",
  "172": "1646913115"
}
```

For `file`-type fields, the value is a `{"title": "...", "url": "..."}` object with a download link.

## Writing

Extra field values are written with [`setOrderFields`](https://api.baselinker.com/index.php?method=setOrderFields) — the same method used for editing an order's address or notes. Only send the fields that actually changed.

## Sample field definitions (getOrderExtraFields output)

```json theme={null}
{
  "extra_fields": [
    { "extra_field_id": 135, "name": "Client type", "editor_type": "radio", "options": ["B2B", "B2C"] },
    { "extra_field_id": 172, "name": "Shipping date deadline", "editor_type": "date" },
    { "extra_field_id": 196, "name": "Warranty Card", "editor_type": "file" }
  ]
}
```

<Tip>
  Extra fields also exist for returns (`getOrderReturnExtraFields`) and work exactly the same way — see [Downloading returns](/en/vratky/stahovani-vratek).
</Tip>
