Skip to main content

Library Datasets

List the datasets a workspace can read, create or replace a workspace dataset, and read a dataset's source again with the /v1/data-library/datasets routes.

A dataset is the definition of a collection of records: its key, label, publisher, licence, the connector that reads its source, and how often it is re-read. GET /v1/data-library/datasets lists every dataset the workspace can read, the shared library together with the workspace's own, ordered by key. Each entry carries its sync state (last_synced_at, last_status, last_error, last_stored) and the number of records the workspace can read in it, so one call shows both what exists and how fresh it is.

GET/v1/data-library/datasets

Dataset fields

iduuidDataset id.
customer_iduuid | nullThe owning workspace. Null for a dataset of the shared library.
sharedbooleanTrue for a dataset of the shared library.
recordsintegerRecords of this dataset the workspace can read.
key, label, kind, publisher, source_url, licencestringThe definition as stored. publisher, source_url and licence are null when not set.
connectorstringThe code that reads the source: manual, document.extract or eu_ets.union_registry.
record_schemastring | nullWhat the records look like, for example grid_fee_gas or district_heat_prices.
paramsobjectConnector parameters, for example url for document.extract.
sync_hoursintegerHours between scheduled reads.
activebooleanWhether the dataset is read on schedule.
last_synced_at, last_status, last_error, last_storedmixedThe last read: its time, ok or error, the error text, and the number of records it stored. Null before the first read.
created_at, updated_atdate-timeRow timestamps.

Response: Datasets

{
  "data": [
    {
      "id": "0d6c1a52-3b7e-4f09-8a41-5e2c9b7d1f33",
      "customer_id": "b1c2d3e4-0000-4000-8000-0123456789ab",
      "key": "acme.heat-tariff",
      "label": "Acme district heat tariff",
      "kind": "records",
      "publisher": "Acme Fernwaerme GmbH",
      "source_url": "https://example.com/tariffs/heat-2026.pdf",
      "licence": null,
      "connector": "manual",
      "record_schema": null,
      "params": {},
      "sync_hours": 720,
      "active": true,
      "last_synced_at": null,
      "last_status": null,
      "last_error": null,
      "last_stored": null,
      "created_at": "2026-10-21T08:10:44.000Z",
      "updated_at": "2026-10-21T08:10:44.000Z",
      "shared": false,
      "records": 1
    }
  ]
}

Create or Replace a Dataset

POST /v1/data-library/datasets creates the workspace's dataset with the given key, or replaces its definition when the workspace already has one. It replaces the whole definition: every field the body omits returns to its default, so send the complete definition each time. The dataset belongs to the workspace of the key, and shared datasets are written by Talonic only. The response is 201 with the stored row under data.

The connector decides where records come from. A manual dataset has no source and receives records only through the records endpoint. A document.extract dataset reads a published document: it needs a record_schema and a string params.url, and source_url defaults to params.url when omitted. The platform fetches the document over HTTPS, extracts records with the named schema, and keeps a record only when its quote occurs in the document and prints its value. An unknown connector or record schema, a key that does not match the pattern, and a document.extract dataset without its schema or URL are refused with 422.

POST/v1/data-library/datasets

Body fields

key*stringDataset key. Matches ^[a-z0-9][a-z0-9._:\-/]{1,190}$, case-insensitively.
label*stringDisplay name, up to 300 characters.
kindstringFree-form kind, up to 40 characters. Default: records
publisherstring | nullWho publishes the source, up to 300 characters.
source_urlstring | nullWhere the source lives, up to 2000 characters. Defaults to params.url when omitted.
licencestring | nullThe terms the source is published under, up to 500 characters.
connectorstringmanual, document.extract, or eu_ets.union_registry. Default: manual
record_schemastring | nullWhat the records look like, up to 60 characters: grid_fee_gas, grid_fee_power, district_heat_prices, default_supply_prices, or eu_ets_installation_emissions. An unknown name answers 422.
paramsobjectConnector parameters, for example url for document.extract.
sync_hoursintegerHours between scheduled reads, 1 to 8784. Default: 720
activebooleanWhether the dataset is read on schedule. Default: true

cURL: Define a dataset read from a published sheet

curl -X POST "https://api.talonic.com/v1/data-library/datasets" \
  -H "Authorization: Bearer $TALONIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "acme.district-heat",
    "label": "Acme district heat prices 2026",
    "publisher": "Acme Fernwaerme GmbH",
    "connector": "document.extract",
    "record_schema": "district_heat_prices",
    "params": { "url": "https://example.com/tariffs/heat-2026.pdf" },
    "sync_hours": 720
  }'

Read a Source Again

POST /v1/data-library/datasets/{key}/sync reads the source of the workspace's own dataset immediately, through its connector, and stores what it finds. A re-read replaces what the source states for the periods it covers and keeps the other periods. The result says what happened: stored counts the records written, rejected counts extracted records dropped because their quote does not occur in the source or does not print the value, and error is null on success. A failing read does not fail the request: the reason comes back in error, is recorded on the dataset (last_status, last_error), and the stored records stay.

The route reaches only the workspace's own datasets. A manual dataset has no source and returns stored: 0. A dataset of the shared library is not reachable here and answers 404, as does an unknown key. Shared datasets are re-read on their own schedule; a workspace dataset with a connector other than manual is re-read every sync_hours while it is active, and this route reads it ahead of that schedule.

POST/v1/data-library/datasets/{key}/sync

Path and response fields

key*stringPath parameter. The dataset key.
datasetstringResponse. The dataset key.
storedintegerResponse. Records stored by this read.
rejectedintegerResponse. Extracted records dropped because their quote is not in the source or does not print the value.
errorstring | nullResponse. Why the read failed; null on success.

cURL: Read the source on demand

curl -X POST "https://api.talonic.com/v1/data-library/datasets/acme.district-heat/sync" \
  -H "Authorization: Bearer $TALONIC_API_KEY"

Response: A read that stored records and rejected one

{
  "data": {
    "dataset": "acme.district-heat",
    "stored": 14,
    "rejected": 1,
    "error": null
  }
}
A source is read only over HTTPS, every redirect target is checked, and a document without a text layer (a scan) is reported as an error rather than stored as an empty success. Read last_status and last_error on the dataset list to see the last outcome without reading again.

Frequently asked questions

Does POST /datasets merge with the existing definition?+
No, it replaces it. Every field the body omits returns to its default, for example sync_hours goes back to 720 and active to true. Send the full definition whenever you change one field.
Why does sync return 404 for a dataset I can read?+
The sync route reaches only the workspace's own datasets. A dataset of the shared library is readable but is read again by Talonic on its own schedule, so it answers 404 here, exactly like an unknown key.
What is the difference between stored and rejected?+
stored counts the records written. rejected counts records the extraction produced but the platform dropped because the quote they cite does not occur in the source text or does not print the value. A rejected record is never stored, which is what keeps every stored record traceable to the source wording.
What does a failed read do to my records?+
Nothing. The failure is returned in error, recorded as last_status and last_error on the dataset, and the records stored by earlier reads stay as they were.