The Table Object

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

FieldTypeDescription
iduuidthe Dotfile identifier
keystringthe workspace identifier, matching ^[a-z][a-z_0-9]*$ and unique per workspace
namestringthe display name
descriptionstring, nullablefree text
entriesarraythe rows, as objects keyed by the header row
created_at, updated_attimestamp

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";
ParameterDescription
table_keythe table key. An unknown key throws
lookup_columnheader of the column searched. Matched case-insensitively. An unknown header throws
lookup_valuethe value searched. Compared to the cell exactly, so fr does not match FR
output_columnheader of the column returned. Matched case-insensitively
output_typestring (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.

ConstraintValue
Tables per workspace50
Columns per table10
Rows per table1000, in addition to the header row
Characters per cell255

Endpoints