Enrichment API¶
This API links a datastore to an enrichment destination, changes its settings, creates a datastore for use as a destination, and reads what has been written into one.
Tip
For complete API documentation, including request/response schemas, visit the API docs.
All endpoints use the base URL of your Qualytics deployment (e.g., https://your-instance.qualytics.io/api) with a Bearer token.
Permissions
Linking, changing the destination, and editing the settings need the Member role and the Editor team permission on the source datastore. Creating a destination needs the Manager role. Unlinking needs the Admin role, with no team check. Reading settings needs Member and Reporter on the datastore in question; reading source records needs Viewer on the destination.
Link an Enrichment Destination¶
Link a source datastore to a destination. Calling it while another destination is linked replaces that destination; no unlink is needed.
Endpoint: PATCH /api/datastores/{datastore_id}/enrichment/{enrichment_id}
Permission: Member user role + Editor team permission on the source datastore
| Parameter | Type | Description |
|---|---|---|
datastore_id |
integer |
The source datastore ID. |
enrichment_id |
integer |
The ID of the enrichment datastore to use as the destination. It must have been created with enrichment_only: true. |
enrichment_prefix |
string |
Optional query parameter. A new prefix to save with the link. Omit it to keep the datastore's current prefix. |
Request Details
No JSON body is required. This endpoint sets the link, and the prefix when enrichment_prefix is given; the other settings (limits, strategy, automatic profile) are changed with PUT /api/datastores/{datastore_id} below. Qualytics refuses the link if the prefix is already used by another source writing to the same destination.
Example request and response
Request (no body required):
curl -X PATCH "https://your-instance.qualytics.io/api/datastores/42/enrichment/100" \
-H "Authorization: Bearer YOUR_TOKEN"
Response (abbreviated; the full response includes all datastore fields):
{
"id": 42,
"name": "Healthcare Database",
"store_type": "jdbc",
"enrichment_only": false,
"enrichment_prefix": "_healthcare_database",
"enrichment_source_record_limit": 10,
"enrichment_remediation_strategy": "none",
"enrichment_auto_profile": true,
"high_count_rollup_threshold": 10,
"enrich_datastore": {
"id": 100,
"name": "Healthcare Enrichment",
"store_type": "jdbc",
"type": "postgresql",
"enrichment_only": true
}
}
Idempotent
Calling this endpoint again with the same enrichment_id re-confirms the link. Calling it with a different ID moves the datastore to that destination; outputs already written stay where they were.
For the UI equivalent, see Link an Enrichment Destination.
Unlink an Enrichment Destination¶
Remove the link from a source datastore. No request body is required.
Endpoint: DELETE /api/datastores/{datastore_id}/enrichment
Permission: Admin user role (no team permission check)
| Parameter | Type | Description |
|---|---|---|
datastore_id |
integer |
The source datastore ID. |
Idempotent
Calling this endpoint when nothing is linked returns 204 No Content without error.
Example request and response
Request (no body required):
curl -X DELETE "https://your-instance.qualytics.io/api/datastores/42/enrichment" \
-H "Authorization: Bearer YOUR_TOKEN"
Response: 204 No Content
The link is removed and the remediation strategy is reset to none.
Warning
Unlinking is refused while the source datastore has Export or Materialize operations in flows or on a schedule.
For the UI equivalent, see Unlink an Enrichment Destination.
Update Enrichment Settings¶
Change the enrichment settings on a source datastore. They control how, and what, that datastore writes to its destination.
Endpoint: PUT /api/datastores/{datastore_id}
Permission: Member user role + Editor team permission on the source datastore
| Parameter | Type | Description |
|---|---|---|
datastore_id |
integer |
The source datastore ID. |
Include the current datastore configuration
This endpoint requires name, connection_id, enrichment_only, and enrichment_prefix, plus the connector's location fields (database and schema for the PostgreSQL examples below, or root_path for file-based datastores). Read the datastore first and preserve its current values. Also include the current source-record limit, anomaly threshold, and remediation strategy: omitting them resets them to 10, 10, and none. A body containing only the setting you want to change is not valid.
Request Body (enrichment fields):
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
enrichment_prefix |
string |
Required on update | Max 60 chars | Start of Scan, Remediation, and Materialize output names. Exports use the normalized datastore name instead. Normalized to lowercase with underscores and a leading underscore. Must be unique among the sources writing to the same destination. |
enrichment_source_record_limit |
integer |
10 |
1 to 1,000,000,000 | Source records stored per anomaly as examples. |
enrichment_remediation_strategy |
string |
"none" |
none, append, overwrite |
Whether a Scan also writes a snapshot of the anomalous records, and whether it accumulates. |
high_count_rollup_threshold |
integer |
10 |
1 to 1,000 | Individual anomalies a check may raise per Scan before they are rolled up into one. Values above 1,000 are silently capped. |
enrichment_auto_profile |
boolean |
Unchanged when omitted on update | Whether Qualytics profiles the outputs this datastore writes to the destination after each write. The outputs are added to the destination, named, and linked to their source either way; with this off, their fields stay untyped until someone profiles the destination. New datastores start with this enabled. The previous name, enrichment_auto_sync, is deprecated: it is still accepted in requests and returned in responses with the same value, and will be removed in a future release. |
Remediation Strategy Constraint
Link a destination before setting enrichment_remediation_strategy to append or overwrite. Otherwise, the update is rejected with 409 Conflict.
The examples below use a PostgreSQL source datastore with connection ID 7, database healthcare, and schema public. Replace these values with the source datastore's current configuration.
Change remediation strategy to Append
Request:
curl -X PUT "https://your-instance.qualytics.io/api/datastores/42" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Healthcare Database",
"connection_id": 7,
"database": "healthcare",
"schema": "public",
"enrichment_only": false,
"enrichment_prefix": "_healthcare_database",
"enrichment_source_record_limit": 10,
"high_count_rollup_threshold": 10,
"enrichment_remediation_strategy": "append"
}'
Response (abbreviated):
{
"id": 42,
"name": "Healthcare Database",
"enrichment_prefix": "_healthcare_database",
"enrichment_source_record_limit": 10,
"enrichment_remediation_strategy": "append",
"enrichment_auto_profile": true,
"high_count_rollup_threshold": 10,
"enrich_datastore": {
"id": 100,
"name": "Healthcare Enrichment"
}
}
Increase source record limit and change prefix
Request:
curl -X PUT "https://your-instance.qualytics.io/api/datastores/42" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Healthcare Database",
"connection_id": 7,
"database": "healthcare",
"schema": "public",
"enrichment_only": false,
"enrichment_prefix": "_healthcare_prod",
"enrichment_source_record_limit": 100,
"high_count_rollup_threshold": 10,
"enrichment_remediation_strategy": "append"
}'
Response (abbreviated):
{
"id": 42,
"name": "Healthcare Database",
"enrichment_prefix": "_healthcare_prod",
"enrichment_source_record_limit": 100,
"enrichment_remediation_strategy": "append",
"enrichment_auto_profile": true,
"high_count_rollup_threshold": 10,
"enrich_datastore": {
"id": 100,
"name": "Healthcare Enrichment"
}
}
Turn off the automatic profile
Request:
curl -X PUT "https://your-instance.qualytics.io/api/datastores/42" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Healthcare Database",
"connection_id": 7,
"database": "healthcare",
"schema": "public",
"enrichment_only": false,
"enrichment_prefix": "_healthcare_prod",
"enrichment_source_record_limit": 100,
"high_count_rollup_threshold": 10,
"enrichment_remediation_strategy": "append",
"enrichment_auto_profile": false
}'
Response (abbreviated):
{
"id": 42,
"name": "Healthcare Database",
"enrichment_prefix": "_healthcare_prod",
"enrichment_source_record_limit": 100,
"enrichment_remediation_strategy": "append",
"enrichment_auto_profile": false,
"high_count_rollup_threshold": 10,
"enrich_datastore": {
"id": 100,
"name": "Healthcare Enrichment"
}
}
For the UI equivalent, see Link an Enrichment Destination.
Get Enrichment Info¶
Read a source datastore's enrichment settings and its destination.
Endpoint: GET /api/datastores/{datastore_id}
Permission: Member user role + Reporter team permission on the source datastore
| Parameter | Type | Description |
|---|---|---|
datastore_id |
integer |
The source datastore ID. |
General Datastore Endpoint
This is the general datastore GET endpoint. It returns all datastore fields; the example shows only the enrichment-related ones.
Example request and response
Request:
curl -X GET "https://your-instance.qualytics.io/api/datastores/42" \
-H "Authorization: Bearer YOUR_TOKEN"
Response (enrichment fields only):
{
"id": 42,
"name": "Healthcare Database",
"enrichment_only": false,
"enrichment_prefix": "_healthcare_prod",
"enrichment_source_record_limit": 100,
"enrichment_remediation_strategy": "none",
"enrichment_auto_profile": true,
"high_count_rollup_threshold": 10,
"enrich_datastore": {
"id": 100,
"name": "Healthcare Enrichment",
"store_type": "jdbc",
"type": "postgresql",
"enrichment_only": true
}
}
If no destination is linked, enrich_datastore is null.
Create a Datastore to Use as a Destination¶
A destination is an ordinary datastore with enrichment_only set to true. Create it with the datastore creation endpoint on any connector that Qualytics can write to; the connection and location fields are the connector's own.
Endpoint: POST /api/datastores
Permission: Manager user role
Example request (PostgreSQL)
curl -X POST "https://your-instance.qualytics.io/api/datastores" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Healthcare Enrichment",
"connection_id": 7,
"database": "quality",
"schema": "qualytics",
"enrichment_only": true,
"teams": ["Data Platform"]
}'
Use a dedicated location for enrichment output. teams contains team names, and a Manager needs the Editor team permission on at least one team assigned to the new datastore. Creating the destination does not link a source to it; use the link endpoint afterward.
For connector-specific payloads, see the connector's API page from Supported Connectors. For the full datastore creation endpoint, see the Datastore API.
Browse the Written Outputs¶
The outputs Qualytics writes into a destination become containers as soon as each write is reported, whatever the source's settings. When the source's enrichment_auto_profile is disabled, their fields stay untyped until you run a Profile on the destination. List the containers with the endpoint below to see their purpose, attributed source, and any confirmed last write.
Endpoint: GET /api/containers?datastore={enrichment_id}
Permission: Member user role + Reporter team permission on the destination
| Field in each container | Description |
|---|---|
purpose |
scan_metadata, remediation, materialized, exports, computed, or other. |
purpose_dataset |
For Scan and Export outputs, which one: failed_checks, source_records, scan_operations, check_metrics, export_anomalies, export_checks, export_field_profiles, or export_check_templates. |
written_by |
The source datastore that wrote the output, or null when Qualytics cannot attribute it. |
last_write |
When Qualytics last wrote to the output, or null when it cannot confirm having written it. |
last_write_operation_id |
The operation that produced that write. |
Filter and sort by purpose with purpose=<value> and sort_purpose=asc|desc, and sort by recency with sort_last_write=asc|desc.
Deprecated listing endpoint
GET /api/datastores/{id}/listing still works but is deprecated. Use GET /api/containers?datastore={id}, which returns the same containers with their purpose and last write.
Read Source Records¶
Read the rows of a written output through Qualytics rather than connecting to the destination directly. Every output is a container of the destination, so read it as a container: find the output's container, then read its rows.
Deprecated source records endpoint
GET /api/datastores/{id}/source-records?path= still works but is deprecated. Use POST /api/containers/{id}/result-sessions, with the container id from GET /api/containers?datastore={id}. See Read by path (deprecated) for how the old endpoint behaves now.
Find the Output's Container¶
Endpoint: GET /api/containers?datastore={enrichment_id}&name={table_name}
Permission: Member user role + Reporter team permission on the destination
name matches every container whose name contains the text, ignoring case, so take the item whose name is the output you want. You can also list the outputs by purpose, as described in Browse the Written Outputs.
Find the source records output
Request:
curl -X GET "https://your-instance.qualytics.io/api/containers?datastore=100&name=_healthcare_prod_source_records" \
-H "Authorization: Bearer YOUR_TOKEN"
Response (abbreviated):
Read the Container's Rows¶
Endpoint: POST /api/containers/{container_id}/result-sessions
Permission: Member user role + Viewer team permission on the destination. Custom columns also need the Editor or Author team permission.
The read returns up to 100 rows, read from a sample of the output with the filter applied.
| Field | Type | Required | Description |
|---|---|---|---|
filter |
string | No | A where clause, without WHERE. Write it in the destination's SQL for a database, and in Spark SQL for a file datastore. |
fields |
list[string] | No | The fields to return, in order. Every field when omitted. |
custom_columns |
list[object] | No | Columns computed over each row, each a name and a Spark SQL expression, like a computed field's. Up to 50. |
reveal_masked |
boolean | No | Return the values of masked fields. Defaults to false. See Container Source Records with Unmasked Values. |
The response lists the columns and returns the rows in rows, as JSON objects. A column with masked: true comes from a masked field, and its values read ***MASKED*** unless you revealed them.
The answer usually holds the whole result: state is completed, next_offset is null, and the read is already closed. When the destination is slow, the answer can come back before the read ends, with state set to running. Then read the rest with GET /api/result-sessions/{session_id}/rows?offset={next_offset} until next_offset is null, and close the read with DELETE /api/result-sessions/{session_id}. A read that nobody pages for 30 minutes closes on its own.
The RECORD column is always masked
Outputs that store whole source rows in one RECORD column (_source_records and the _export_anomaly_records output of a merged Anomalies export) return RECORD as ***MASKED*** on every row, regardless of field masking. reveal_masked does not unmask it: a reveal of a result that shows RECORD is refused with 403, so leave it out with fields to reveal the other columns. A filter cannot read RECORD either. To read the actual values, use the anomaly endpoints GET /api/anomalies/{id}/source-record and GET /api/anomalies/{id}/source-record/download with include_masked=true (Editor team permission, audited). See Source records. The other outputs are returned as written, apart from their masked fields.
Source records of one anomaly
Request:
curl -X POST "https://your-instance.qualytics.io/api/containers/5021/result-sessions" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"filter": "anomaly_uuid = '\''f11d4e7c-e757-4bf1-8cd6-d156d5bc4fa5'\''"
}'
Response (columns abbreviated):
{
"session_id": "rs_4b8e1c0f9a2d4e6b8c1d",
"datastore_id": 100,
"state": "completed",
"columns": [
{
"name": "anomaly_uuid",
"type": "String",
"masked": false,
"source": { "container_id": 5021, "field_id": 88102, "field_name": "anomaly_uuid", "active_anomaly_count": 0 }
},
{
"name": "record",
"type": "String",
"masked": true,
"source": { "container_id": 5021, "field_id": 88105, "field_name": "record", "active_anomaly_count": 0 }
}
],
"rows_written": 1,
"total_rows": 1,
"message": null,
"revealed": false,
"can_reveal": false,
"offset": 0,
"rows": [
{
"source_container": "table_name",
"source_partition": "partition_name",
"anomaly_uuid": "f11d4e7c-e757-4bf1-8cd6-d156d5bc4fa5",
"context": null,
"record": "***MASKED***"
}
],
"next_offset": null
}
Failed checks of one anomaly
Find the _healthcare_prod_failed_checks container first, as above. This request returns only the fields it names.
Request:
curl -X POST "https://your-instance.qualytics.io/api/containers/5022/result-sessions" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"filter": "anomaly_uuid = '\''1a937875-6bce-4bfe-8701-075ba66be364'\''",
"fields": ["quality_check_id", "quality_check_rule_type", "quality_check_message", "operation_id", "detected_time"]
}'
Response (columns omitted):
{
"session_id": "rs_7c2a9e4d1b6f4a8c3e5d",
"datastore_id": 100,
"state": "completed",
"columns": ["..."],
"rows_written": 1,
"total_rows": 1,
"message": null,
"revealed": false,
"can_reveal": false,
"offset": 0,
"rows": [
{
"quality_check_id": 155481,
"quality_check_rule_type": "greaterThanField",
"quality_check_message": "{\"SNPSHT_TIMESTAMP\":\"2023-09-03 10:26:15.0\"}",
"operation_id": 28162,
"detected_time": "2024-03-29T15:08:07.585Z"
}
],
"next_offset": null
}
Scan operations of one operation
Find the _healthcare_prod_scan_operations container first, as above.
Request:
curl -X POST "https://your-instance.qualytics.io/api/containers/5023/result-sessions" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"filter": "operation_id = 22871"}'
Response (columns omitted):
{
"session_id": "rs_2d6f8a1c3e5b4d9a7c0e",
"datastore_id": 100,
"state": "completed",
"columns": ["..."],
"rows_written": 1,
"total_rows": 1,
"message": null,
"revealed": false,
"can_reveal": false,
"offset": 0,
"rows": [
{
"operation_id": 22871,
"datastore_id": 850,
"container_id": 7239,
"partition_name": "ACTION_TEST_CLIENT_V3",
"incremental": true,
"records_processed": 0,
"enrichment_source_record_limit": 10,
"max_records_analyzed": -1,
"anomaly_count": 0,
"start_time": "2023-12-04T20:35:54.194Z",
"end_time": "2023-12-04T20:35:54.692Z",
"result": "success",
"message": null
}
],
"next_offset": null
}
The same steps read remediation outputs (<prefix>_remediation_<container_id>) and Export outputs (_<datastore_name>_export_anomalies, _<datastore_name>_export_checks, _<datastore_name>_export_field_profiles). Choose filters from the columns available in the output you are querying. For the columns of every output, see Enrichment Outputs and Export Outputs.
Read by Path (Deprecated)¶
Endpoint: GET /api/datastores/{enrichment_id}/source-records?path={table_name}&filter={predicate}
Permission: Member user role + Viewer team permission on the destination
This endpoint still works and returns up to 100 rows as a JSON string in source_records. It reads path through the output's container, so two rules apply:
pathmust name a synced output. It matches a container of the destination by name, ignoring case, also when the database shortened the name or a file datastore adds its format extension. A path that matches no container returns404, with a message asking you to sync the datastore. Sync the destination and call the endpoint again. A path that matches two outputs equally well (for example the same name with two file formats, or in two letter cases) returns409; send the output's full name, with its format and its exact case.- The output's own masked fields are masked too. The endpoint masks the fields masked on the output itself, as well as the fields the output inherits from its source container. A filter or sort on a masked column is refused with
422.RECORDstays masked, as described above.
Deprecated request and response
Request:
curl -X GET "https://your-instance.qualytics.io/api/datastores/100/source-records?path=_healthcare_prod_scan_operations&filter=operation_id=22871" \
-H "Authorization: Bearer YOUR_TOKEN"
Response: source_records holds the rows as a JSON string, so parse it to read them.
Error Responses¶
| Status Code | Description |
|---|---|
401 Unauthorized |
Missing or invalid API token. |
403 Forbidden |
User does not have the required role or team permission. |
404 Not Found |
The source datastore or the destination does not exist, or no synced output of the destination matches the path of a deprecated path read. |
409 Conflict |
A deprecated path read matches more than one output, the target is not an enrichment datastore, its connector cannot host one, the prefix is already used on that destination, remediation is enabled without a linked destination, or the unlink is blocked by Export or Materialize operations. |
422 Unprocessable Entity |
Invalid request body (e.g., a remediation strategy other than none, append, overwrite). |
Error response examples
403 Forbidden:
404 Not Found:
404 Not Found (a deprecated path read names an output no Sync has registered):
{ "detail": "No synced table matches _healthcare_prod_failed_checks in this datastore. Sync the datastore and try again" }
409 Conflict (the target is not an enrichment datastore):
409 Conflict (creating a destination on a connector Qualytics cannot write to):
409 Conflict (another source already writes to that destination with the same prefix):
{ "detail": "Datastore 'Retail Warehouse' already writes enrichment data into datastore id: 100 with the prefix '_healthcare_prod'" }
409 Conflict (unlinking with Export or Materialize operations in flows or schedules):
Permission Summary¶
| Operation | Minimum Permission |
|---|---|
| Link or change the destination | Member user role + Editor team permission on the source |
| Unlink | Admin user role |
| Update enrichment settings | Member user role + Editor team permission on the source |
| Get enrichment info | Member user role + Reporter team permission on the source |
| Create a destination | Manager user role |
| Browse the written outputs | Member user role + Reporter team permission on the destination |
| Read source records | Member user role + Viewer team permission on the destination |
Prefix Normalization
enrichment_prefix is normalized to lowercase with underscores and a leading underscore. For example, Analytics Bronze becomes _analytics_bronze. Maximum length is 60 characters.