Skip to main content

List Data Policy Fields

List the declared output fields of a data policy: the field keys and types the policy emits in resolution results. Values on undeclared keys are discarded.

List the declared output fields of a data policy. Fields define the output contract: the set of field keys the policy executor emits in resolution results. Only declared fields appear in the final output; any intermediate values computed by rules but not declared as fields are treated as temporary variables and discarded.

Each field carries its field_key (the output column name), a field_type, and a source describing where the field came from. The declared field list is what the resolution pipeline validates output against and what the results UI uses to decide which columns to display.

The output contract matters most at the boundaries. Downstream consumers — data products, deliveries, exports — see exactly the declared keys, so adding a field to the policy is how a newly computed value surfaces, and removing one is a breaking change for anything reading the resolution output. Where a field is bound to a schema field, the resolved value flows back under that schema field's identity in pipeline results.

For the version-resolved view of the contract, prefer GET /v1/data-policies/{id}: it inlines the current version's fields with their declared data_type, position, and schema binding (source_schema_field_id) alongside the rules that populate them — the exact configuration the next resolution executes.

GET/v1/data-policies/{id}/fields

Path parameters

id*uuidData policy UUID.

Response

Response fields

dataarrayArray of field definition objects.
data[].idstringField row UUID.
data[].version_idstringThe policy version these fields belong to (the current version, or the newest one when none is current).
data[].field_keystringOutput field key name.
data[].display_namestring | nullHuman-readable label.
data[].field_typestringDeclared value type (e.g. string, number, date).
data[].positionintegerDisplay order within the policy.
data[].includebooleanWhether the field is emitted in the policy output.
data[].sourcestring | nullschema_field when the field mirrors a Spec field, null for a policy-only field.
data[].source_schema_field_idstring | nullThe mirrored Spec field UUID, when source is schema_field.
links.selfstringURL to this field list.
links.policystringURL to the parent policy.

curl

curl -s https://api.talonic.com/v1/data-policies/p1a2b3c4-e5f6-7890-abcd-ef1234567890/fields \
  -H "Authorization: Bearer tlnc_your_api_key"

Response

{
  "data": [
    {
      "id": "f1a2b3c4-0001",
      "version_id": "v3a2b3c4-0003",
      "field_key": "country_code",
      "display_name": "Country code",
      "field_type": "string",
      "position": 0,
      "include": true,
      "source": "schema_field",
      "source_schema_field_id": "sf1a2b3c4-0001"
    },
    {
      "id": "f1a2b3c4-0002",
      "version_id": "v3a2b3c4-0003",
      "field_key": "currency",
      "display_name": null,
      "field_type": "string",
      "position": 1,
      "include": true,
      "source": null,
      "source_schema_field_id": null
    }
  ],
  "links": {
    "self": "/v1/data-policies/p1a2b3c4-e5f6-7890-abcd-ef1234567890/fields",
    "policy": "/v1/data-policies/p1a2b3c4-e5f6-7890-abcd-ef1234567890",
    "version": "/v1/data-policies/p1a2b3c4-e5f6-7890-abcd-ef1234567890/versions"
  }
}

Errors

Error responses

401unauthorizedMissing or invalid API key.
404not_foundData policy not found or does not belong to your organization.
429rate_limitedToo many requests. Retry after the period indicated in the Retry-After header.
The declared field list is the policy's output contract. Values written by rules to undeclared keys are treated as temp variables and suppressed from results; flip pipeline.resolution.emit_undeclared_cells only for debugging.

Frequently asked questions

What happens to values not declared as fields?+
Values computed by rules but not declared as policy fields are treated as intermediate variables and discarded from the final output. Only declared fields appear in resolution results. You can enable `emit_undeclared_cells` in the pipeline config for debugging.
Can Lua scripts write to undeclared field keys?+
Yes. Lua scripts can write to any cell name as a temporary variable for intermediate computation, and later rules in the same record can read it. However, only values written to declared field keys appear in the resolution output.
Can Lua rules use regular expressions?+
Yes. Lua scripts have a built-in `regex` helper backed by the RE2 engine (`regex.test`, `regex.match`, `regex.replace`), so matching is linear-time and immune to catastrophic backtracking (ReDoS). Pattern and subject length are capped, and an invalid pattern fails the rule loudly rather than silently.
How do policy fields relate to schema fields?+
They are separate declarations. A policy field can be bound to a schema field (`source_schema_field_id` on the inlined read from GET /v1/data-policies/{id}), in which case the resolved value flows back under that schema field's identity in pipeline results; an unbound field is a policy-only output column.