Decision tables

Decision tables hold business rules you maintain in CAS: each table maps input values to output values, row by row. With the decision table endpoints you can read your tables, their version history and what changed between two versions, for example to audit or archive them in your own systems. The endpoints only read: you keep editing and publishing decision tables in CAS.

All decision table endpoints answer in JSON or XML.

Modules, tables and versions

Decision tables are grouped into modules. Every table has an ID and belongs to one module, and the list endpoint names both.

A table ID is unique in almost every case, so you can address a table by its ID alone. When the same ID exists in more than one module, the API answers 400 Bad Request with moduleId in invalid-parameters and lists the modules it found. Pass moduleId to choose one.

Store the moduleId the list returns with each table and pass it on every call. A table ID that is unique today can become ambiguous when another module adds a table with the same ID, and calls without moduleId would then fail.

Each time you publish a table, it gets a new version number. Until you publish a version of your own, the default version of the table applies. The source field of a table tells you which one you read: Tenant for your own version, Default for the default one.

List decision tables

Use the List decision tables endpoint:

GET https://api-<env>.customs4trade.com/v1/decisiontables

Pass moduleId to list the tables of one module only. The response holds every table you can read:

{
    "data": [
        {
            "id": "exampleTable",
            "name": "Example table",
            "description": "What the table decides",
            "moduleId": "exampleModule",
            "moduleName": "Example module"
        }
    ]
}

A new table can take a few minutes to appear in the list.

Scope: read:decisiontables

List the versions of a decision table

Use the List the versions of a decision table endpoint:

GET https://api-<env>.customs4trade.com/v1/decisiontables/{tableId}/versions?moduleId=exampleModule&limit=2
Parameter Description
moduleId The module of the table. Needed only when the table ID exists in more than one module
from, to Only versions published within this inclusive range, as an ISO 8601 date or date-time. Times without an offset are UTC, and a date alone such as 2026-06-30 means midnight UTC at the start of that day
limit Number of versions to return. Defaults to 100, which is also the maximum
offset Number of versions to skip. Must be a multiple of limit. Defaults to 0

The response lists your own versions, newest first. A table you never changed has none. Page forward using links.next until it is empty:

{
    "data": [
        { "version": 4, "publishedAt": "2026-09-30T14:02:11.0000000+00:00" },
        { "version": 3, "publishedAt": "2026-06-02T09:15:40.0000000+00:00" }
    ],
    "links": {
        "self": "/v1/decisiontables/exampleTable/versions?moduleId=exampleModule&limit=2&offset=0",
        "prev": "",
        "next": "/v1/decisiontables/exampleTable/versions?moduleId=exampleModule&limit=2&offset=2"
    }
}

Scope: read:decisiontables

Read a decision table

Use the Get a decision table endpoint:

GET https://api-<env>.customs4trade.com/v1/decisiontables/{tableId}?moduleId=exampleModule

Without further parameters it returns the current version. To read another one, pass either of these, not both:

Parameter Description
version One of your own version numbers. A number you never published returns 404 Not Found
activeAt The version active at that moment: your newest version published by then, or the default version if you had not published one yet. An ISO 8601 date or date-time; times without an offset are UTC, and a date alone such as 2026-06-30 means midnight UTC at the start of that day

A version is active from the moment it is published. activeAt selects a version and does not filter rows: each row keeps its own validity dates.

The response holds the columns once, then the rows. rowIndex is the row's index, starting at 0, as the CAS UI shows it in the ID column; an index can be skipped where an uploaded table had a blank row. Each row carries one cell per column. A cell names its column and whether it is an input or an output, because an input and an output column can share an ID:

{
    "moduleId": "exampleModule",
    "tableId": "exampleTable",
    "version": 4,
    "source": "Tenant",
    "publishedAt": "2026-09-30T14:02:11.0000000+00:00",
    "hitPolicy": "First",
    "columns": [
        { "id": "inputColumn", "name": "Input column", "type": "Input", "dataType": "String" },
        { "id": "outputColumn", "name": "Output column", "type": "Output", "dataType": "String" }
    ],
    "rows": [
        {
            "rowIndex": 0,
            "validFrom": null,
            "validUntil": "2026-12-31T00:00:00.0000000+00:00",
            "cells": [
                { "column": "inputColumn", "type": "Input", "value": "A, B" },
                { "column": "outputColumn", "type": "Output", "value": "X" }
            ],
            "notes": null
        }
    ]
}

validFrom and validUntil are empty when a row has no start or end date. hitPolicy says how the rows matching an input are chosen:

Hit policy Rows chosen
First The first matching row, in table order
All Every matching row
MostSpecific The matching row whose inputs match most specifically
Unique Exactly one row is expected to match

Scope: read:decisiontables

Cell values

Cell values are returned as they were entered in the table. An output cell holds a plain value. An input cell can hold an expression:

Input value Matches
A Exactly A
A, B Any of the listed values
not(A, B) Any value except the listed ones
matches("^BE") Any value matching the regular expression
* Any value
{empty} An empty input

Compare two versions

Use the Compare two versions of a decision table endpoint:

GET https://api-<env>.customs4trade.com/v1/decisiontables/{tableId}/diff?moduleId=exampleModule&old=3&new=4

old and new are required and must both be your own version numbers. The response lists the rows that changed:

{
    "moduleId": "exampleModule",
    "tableId": "exampleTable",
    "old": { "version": 3, "publishedAt": "2026-06-02T09:15:40.0000000+00:00" },
    "new": { "version": 4, "publishedAt": "2026-09-30T14:02:11.0000000+00:00" },
    "hasChanges": true,
    "rows": [
        {
            "change": "Modified",
            "oldRowIndex": 1,
            "newRowIndex": 1,
            "changes": [
                { "field": "Cell", "column": "outputColumn", "type": "Output", "old": "X", "new": "Y" }
            ],
            "row": null
        },
        {
            "change": "Added",
            "oldRowIndex": null,
            "newRowIndex": 4,
            "changes": null,
            "row": { "validFrom": null, "validUntil": null, "cells": [ { "column": "inputColumn", "type": "Input", "value": "C" } ], "notes": null }
        }
    ]
}
change Meaning
Modified The row exists in both versions. changes lists each changed value with its old and new value; field is Cell, ValidFrom, ValidUntil or Notes
Added The row exists only in the new version. row holds the whole row
Removed The row exists only in the old version. row holds the whole row
Unchanged The row is the same in both versions. Returned only when you pass includeUnchanged=true; row holds the whole row

Changed validity dates are formatted yyyy-MM-dd, and are empty when the row has no start or end date.

Scope: read:decisiontables

For HTTP status codes and error response formats, see Error handling.