A table is a set of reference data held at workspace level and addressed by key: a country risk
list, an industry mapping, a blacklist. Tables exist so that the code executed inside a
workspace — the risk engine, client portal workflows and controls — can resolve a value at
runtime rather than carry it inline.
Tables are read-only over the API. They are created and imported in the console.
The table object
| Field | Type | Description |
|---|---|---|
id | uuid | the Dotfile identifier |
key | string | the workspace identifier, matching ^[a-z][a-z_0-9]*$ and unique per workspace |
name | string | the display name |
description | string, nullable | free text |
entries | array | the rows, as objects keyed by the header row |
created_at, updated_at | timestamp |
entries is returned as an array of objects whose keys are the header row of the imported
file, verbatim, including spaces and capitalisation. A table imported with the columns
Country, ISO Code and Risk level is returned as:
{
"id": "bf05e8f6-f909-487b-bb49-d58354c2c45c",
"key": "countries",
"name": "Countries",
"description": "List of countries",
"entries": [
{ "Country": "France", "ISO Code": "FR", "Risk level": "low" },
{ "Country": "Belarus", "ISO Code": "BY", "Risk level": "high" }
]
}Reading tables
List tables returns every table in the workspace without its entries. The
response is not paginated.
curl https://api.dotfile.com/v1/tables \
-H "X-DOTFILE-API-KEY: $DOTFILE_API_KEY"Retrieve a table returns one table with its entries. The path parameter is
resolved by key first, then by id, so either identifier is accepted:
curl https://api.dotfile.com/v1/tables/countries \
-H "X-DOTFILE-API-KEY: $DOTFILE_API_KEY"A parameter matching neither returns 404.
Resolving a value in workspace code
Within the risk engine, client portal workflows and controls, $.lookup() resolves a value
against a table.
const country_risk = $.lookup({
table_key: "countries",
lookup_column: "ISO Code",
lookup_value: main_company.country,
output_column: "Risk level",
}) ?? "not_defined";| Parameter | Description |
|---|---|
table_key | the table key. An unknown key throws |
lookup_column | header of the column searched. Matched case-insensitively. An unknown header throws |
lookup_value | the value searched. Compared to the cell exactly, so fr does not match FR |
output_column | header of the column returned. Matched case-insensitively |
output_type | string (default), number or boolean. A value that cannot be cast throws |
A row that does not match returns null, which is why the example above supplies a fallback. The
complete method reference is in Risk engine.
Creating and maintaining tables
Tables are imported in the console, under Settings > Tables, from a .csv, .xls or
.xlsx file whose first row is the header. Every workspace is provisioned with three:
countries, industries and company_blacklist.
| Constraint | Value |
|---|---|
| Tables per workspace | 50 |
| Columns per table | 10 |
| Rows per table | 1000, in addition to the header row |
| Characters per cell | 255 |