Manage DQ Rules via API
|
The REST API is currently in Early Access Preview. The API specification and endpoints might change before being marked as stable. We recommend testing thoroughly and being prepared to adapt to potential changes in future releases. |
This guide shows you how to manage DQ rules programmatically: create rules, update their logic, and publish them for use in DQ monitors.
Before using the Data Quality API, configure authentication as described in API Authentication.
When to use this API
Use the DQ rules API when you need to:
-
Automate rule setup: Create rules from scripts or CI/CD pipelines instead of in the web application.
-
Import rules from external sources: Migrate rule definitions maintained in external tools (for example, Excel or Collibra) into Ataccama ONE.
-
Audit rule definitions: List and inspect the rules configured in your environment.
Limitations of the DQ rules API
Rule logic built in Condition Builder cannot be read or changed through the API.
The API works with advanced expressions only, so for a condition built in Condition Builder, responses never return the logic.
The stringExpression of such a condition is empty, or holds a leftover value from an earlier API request.
Sending a stringExpression for such a condition does not switch it to an advanced expression.
The request succeeds and the value is stored, but the rule keeps evaluating the Condition Builder logic.
The expression type can be changed only in the web application.
You can still update fields other than the expression, publish drafts, and delete the rule. To move such rules between environments, see Rules built with Condition Builder.
Draft and publish lifecycle
DQ rule changes made through the API follow a draft and publish lifecycle.
Each draft has a draftType that indicates what publishing it does:
-
NEW: Creating a rule produces a draft of a new rule. Publishing promotes it to the first published version. -
CHANGE: Updating a published rule opens a draft on top of the latest published version. Publishing promotes the draft. -
DELETE: The rule is marked for deletion. Publishing deletes the rule. -
RESURRECT: A deleted rule is marked for restoration. Publishing restores the rule.DELETEandRESURRECTdrafts are created in the web application only; the API never creates them, but you can retrieve them (?version=DRAFT) and publish them like any other draft. To delete a rule through the API, use the delete operation instead: it deletes the rule immediately, without a draft (see Delete a rule).
After a rule is published, it has no draft: only the published version exists, and responses report draftType: NONE.
Publishing again returns the currently published version.
A rule can be created and saved as incomplete while in draft, for example without a name or implementation. However, the rule must be complete before you can publish it (see Publish a rule).
Rule structure
A rule definition consists of the following fields. None are required to create a draft; see Publish a rule for what is required to publish.
| Field | Description | ||
|---|---|---|---|
|
Human-readable name of the rule. |
||
|
Optional description of the rule. |
||
|
Groups of input attributes the rule consumes.
Each input attribute has a name and data type (for example, |
||
|
The rule logic:
|
||
|
Parameters that configure the rule. Each parameter has the following properties:
|
||
|
Variables derived from inputs and reused within the rule logic, computed either from an expression or by applying transformations to an input attribute. |
||
|
Default threshold applied when the rule is used in a monitor: a |
||
|
Stewardship assignment of the rule: an object with the |
The following fields are read-only and appear in responses only:
-
urnanddraftType: Assigned automatically. On a published version,draftTypeisNONE.
| To find the URNs of DQ dimensions, dimension results, and DQ transformations, list them via the API (see List DQ dimensions and List DQ transformations). |
Example: Rule that validates the email format
The following example shows a rule definition with the fields required for publishing.
The keys prefixed with new_, such as new_email, name the rule’s new sub-entities (see How to identify rule sub-entities):
{
"name": "Email Format Validation",
"description": "Checks that the value is a syntactically valid email address.",
"inputGroups": {
"new_input-group": {
"name": "Input",
"inputs": {
"new_email": { "name": "email", "dataType": "STRING" }
}
}
},
"implementation": {
"ruleType": "SINGLE_TABLE",
"dqDimensionUrn": "urn:ata:{your-tenant}:data-quality:dq-dimension:...",
"conditions": {
"new_condition-1": {
"order": 0,
"name": "Does not match the email pattern",
"expression": {
"stringExpression": "not matches(@\"^\\w+\\.\\w+@\\w+$\", email)"
},
"resultUrn": "urn:ata:{your-tenant}:data-quality:dq-dimension-result:..."
}
},
"fallback": {
"resultUrn": "urn:ata:{your-tenant}:data-quality:dq-dimension-result:..."
}
}
}
Example: Rule that uses a parameter and a variable
Reference parameters and variables by name in the condition expression, in the same way as the input attributes.
The parameter has no value in the rule itself: each monitor that applies the rule supplies its own value in the parameterValues field of the rule instance (see Assign rules and set thresholds).
{
"name": "Delivery Date Valid",
"inputGroups": {
"new_input-group": {
"name": "Input",
"inputs": {
"new_date": { "name": "date", "dataType": "DATETIME" }
}
}
},
"implementation": {
"ruleType": "SINGLE_TABLE",
"dqDimensionUrn": "urn:ata:{your-tenant}:data-quality:dq-dimension:...",
"conditions": {
"new_condition-1": {
"order": 0,
"name": "Date is after the deadline or in the future",
"expression": {
"stringExpression": "(date > deadline) or (date > current_time)"
},
"resultUrn": "urn:ata:{your-tenant}:data-quality:dq-dimension-result:..."
}
},
"fallback": {
"resultUrn": "urn:ata:{your-tenant}:data-quality:dq-dimension-result:..."
}
},
"parameters": {
"new_deadline": {
"name": "deadline",
"dataType": "DATETIME"
}
},
"variables": {
"new_current-time": {
"name": "current_time",
"variableType": "EXPRESSION",
"expression": "now()"
}
}
}
How to identify rule sub-entities
A rule definition consists of fields, listed in the preceding table, and sub-entities inside some of them: the input groups (with their inputs), conditions, group-by inputs, parameters, and variables (with their transformations).
In the preceding examples, inputGroups and inputs are fields, and the objects under the new_ keys are their sub-entities.
Because a rule can contain any number of sub-entities, each of them is identified by its own ID. This way, requests can address each sub-entity separately and leave the rest of the rule unchanged.
The ID of a sub-entity is a UUID assigned when the sub-entity is created and has the following properties:
-
In responses, it appears as the key under which the sub-entity is stored, for example,
"7b074cbc-…": { "name": "email" }for an input. To find the IDs of existing sub-entities, retrieve the rule (see Retrieve a rule). -
For sub-entities that have a
urn, the ID matches the UUID part of theurn.
New sub-entities have no ID yet, so you need to name each new sub-entity yourself with a temporary key, such as new_email in the rule definition example.
You can choose any temporary key that follows these rules:
-
It starts with
new_. The prefix is what marks the sub-entity as new. -
It continues with letters, digits, underscores (
_), and hyphens (-), up to 36 characters. This part only helps you recognize the sub-entity in the response. -
It is different for each new sub-entity in the request.
Which identifier you use depends on the request:
-
When creating a rule, use temporary keys to address sub-entities, since every sub-entity is new (see Create a rule).
-
When updating a rule, use IDs to address existing sub-entities and temporary keys for new sub-entities. One request can combine both (see Update a rule).
In either case, the response returns each new sub-entity under its assigned ID, with your temporary key in the correlationId field:
{
"inputGroups": {
"0d94ae1c-...": {
"name": "Input",
"correlationId": "new_input-group",
"inputs": {
"7b074cbc-...": {
"name": "email",
"dataType": "STRING",
"correlationId": "new_email"
}
}
}
}
}
The temporary key appears only in this one response.
Later retrievals return the sub-entity without correlationId.
List rules
List the DQ rules in your environment.
curl -X GET "https://{your-environment}.ataccama.one/api/data-quality/v1/rules?size=20&sort=name" \
-H "Authorization: Bearer {access_token}"
| Parameter | Type | Required | Description |
|---|---|---|---|
|
integer |
No |
Number of rules to return per page. Default: Max: |
|
string |
No |
Comma-separated field names for sorting (for example, |
|
string |
No |
Cursor for forward pagination.
Use the value from |
The response contains a data array with up to size rules, and a meta object with the pagination information:
-
meta.next: Cursor for retrieving the next batch of rules; pass it as theafterparameter in the next request. Omitted when there are no more rules to retrieve. -
meta.total: Total number of rules, across all pages.
The listing is not isolated from concurrent changes. If rules are created or deleted between page requests, some rules might be missing from the results.
List DQ dimensions and transformations
Rule definitions reference DQ dimensions, dimension results, and DQ transformations by their URNs. To find the URNs, use the following read-only listings.
List DQ dimensions
List the DQ dimensions in your environment, together with their dimension results.
curl -X GET "https://{your-environment}.ataccama.one/api/data-quality/v1/dq-dimensions" \
-H "Authorization: Bearer {access_token}"
The endpoint returns published dimensions only, with the same forward-only pagination as List rules.
In the response, each dimension carries:
-
urn: The dimension’s URN, referenced asdqDimensionUrnin rule implementations. -
results: All dimension results of the dimension, stored inline. Theurnof a result is what rule conditions and fallbacks reference asresultUrn. -
defaultConditionResultUrnanddefaultFallbackResultUrn: The results assigned by default to conditions and fallbacks in that dimension.
List DQ transformations
List the DQ transformations in your environment, for use in the variables of your rules.
curl -X GET "https://{your-environment}.ataccama.one/api/data-quality/v1/dq-transformations" \
-H "Authorization: Bearer {access_token}"
The endpoint returns published transformations only, with the same forward-only pagination as List rules.
By default, the transformations are sorted by group, and by name within each group.
In the response, each transformation carries:
-
urn: The transformation’s URN, referenced astransformationUrnin the transformations of a rule variable. -
name: The display name, such asTo float. Names are not unique: several transformations can share a name and differ only in the input data type. Identify a transformation by itsurn, never by its name. -
inputDataType: The data type the transformation accepts. A transformation can only be applied to a variable whose value is of a matching type.The value is either one data type or a family of types. The data types are
STRING,INTEGER,LONG,FLOAT,BOOLEAN,DATE, andDATETIME. The families areNUMBERS_TYPES(any numeric type),DATETIME_TYPES(any date or datetime type), andALL_TYPES(any type). -
expression: The expression the transformation applies, with the%INPUT%placeholder standing for the value the transformation is applied to.
Create a rule
Create a new rule.
The rule is created as a draft (draftType: NEW) and can be incomplete: finish it via updates, then publish it to make it live.
See Draft and publish lifecycle.
The request body accepts the fields described in Rule structure.
If you send the read-only fields urn and draftType, they are ignored.
The URN is assigned automatically and draftType is set to NEW.
Store each input group, input, condition, parameter, and variable under a temporary key that you choose, such as new_email (see How to identify rule sub-entities).
curl -X POST "https://{your-environment}.ataccama.one/api/data-quality/v1/rules" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"name": "Email Format Validation",
"description": "Checks that the value is a syntactically valid email address.",
"inputGroups": {
"new_input-group": {
"name": "Input",
"inputs": {
"new_email": { "name": "email", "dataType": "STRING" }
}
}
}
}'
A successful request returns 201 Created with the created rule draft, including its URN.
Save the URN for publishing the rule and for assigning it to monitors.
| To create many rules at once as published versions, use Create rules in batch instead. |
Retrieve a rule
Retrieve a rule by URN.
By default, the endpoint returns the latest published version; use ?version=DRAFT to fetch the current draft.
curl -X GET "https://{your-environment}.ataccama.one/api/data-quality/v1/rules/{ruleUrn}" \
-H "Authorization: Bearer {access_token}"
| Parameter | Type | Required | Description |
|---|---|---|---|
|
string |
No |
Which version of the rule to retrieve: If the rule has no current draft, a Default: |
The response includes the URN of each rule input attribute (the urn field of each input in inputs), which you need when mapping the rule to catalog item attributes in a DQ monitor.
Update a rule
Update a rule using JSON Merge Patch. The following rules apply to both the rule fields and its sub-entities (input groups, inputs, conditions, group-by inputs, parameters, and variables with their transformations):
-
To change a field or a sub-entity, send only the new values. For a sub-entity, send them under the sub-entity’s ID.
-
To clear a field or delete a sub-entity, set it to
null.The
namefield is the exception: it cannot benull, only replaced with another non-empty value. -
To add a sub-entity, use a
new_<id>key. -
To keep anything unchanged, do not mention it in the request.
A single request can combine all of these anywhere in the rule, for example, update the description, rename one input, and delete another.
New sub-entities appear in the response under their new IDs, with your temporary key returned in the correlationId field (see How to identify rule sub-entities).
The request body accepts the fields described in Rule structure.
If you build the update from a retrieved rule, you can send the edited body back without removing the read-only fields, such as urn and draftType.
The API checks just one of them, the urn of each sub-entity.
The urn must match the ID under which the sub-entity is stored.
A mismatch is rejected with 400 Bad Request.
Updates are applied to the current draft.
Patching a published rule opens a new draft (draftType: CHANGE) on top of the latest published version.
See Draft and publish lifecycle.
curl -X PATCH "https://{your-environment}.ataccama.one/api/data-quality/v1/rules/{ruleUrn}" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"description": "Checks that the value is a syntactically valid email address (RFC 5322).",
"inputGroups": {
"{inputGroupId}": {
"inputs": {
"{inputId}": { "name": "email_address" },
"{obsoleteInputId}": null,
"new_currency": { "name": "currency", "dataType": "STRING" }
}
}
}
}'
The response returns the updated rule draft.
Publish a rule
Publish the current draft, promoting it to the latest published version. See Draft and publish lifecycle.
The rule must meet the following requirements; otherwise, the publish request fails with a 400 error listing what is missing:
-
nameis set. -
implementationis set, contains at least one condition, and every condition has a non-empty expression. -
inputGroupscontains at least one group withjoined: false.
curl -X POST "https://{your-environment}.ataccama.one/api/data-quality/v1/rules/{ruleUrn}/publish" \
-H "Authorization: Bearer {access_token}"
The response returns the published rule. If the rule has no current draft, the request still succeeds and returns the currently published version.
Delete a rule
Permanently delete a rule. This is a hard delete: both the draft and published versions are removed, and no draft is created.
| Deleting a rule also removes its rule instances from all DQ monitors that apply it. |
curl -X DELETE "https://{your-environment}.ataccama.one/api/data-quality/v1/rules/{ruleUrn}" \
-H "Authorization: Bearer {access_token}"
A successful request returns 204 No Content.
Create rules in batch
Create up to 100 rules in a single request.
Each item requires name, inputGroups, and implementation.
Store each sub-entity under a temporary key that you choose, such as new_email (see How to identify rule sub-entities).
| Unlike Create a rule, batch-created rules skip the draft stage and are created directly as published versions. Each rule must therefore be complete and meet the publish requirements. |
Each item is processed independently: a failure on one item does not cancel the rest.
The response is 207 Multi-Status.
It contains a meta summary (total, success, fail) and per-item results.
On success, a result carries only the URN of the created rule.
On failure, it carries the error instead.
By default, results are paired with the request items by position: the first result belongs to the first item you sent.
You can also add your own id to each item; the response returns it in the matching result.
curl -X POST "https://{your-environment}.ataccama.one/api/data-quality/v1/rules/batch/create" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"data": [
{
"id": "row-1",
"name": "Email Format Validation",
"inputGroups": { ... },
"implementation": { ... }
},
{
"id": "row-2",
"name": "Phone Format Validation",
"inputGroups": { ... },
"implementation": { ... }
}
]
}'
{
"meta": { "total": 2, "success": 1, "fail": 1 },
"results": [
{
"id": "row-1",
"status": "OK",
"data": { "urn": "urn:ata:{your-tenant}:data-quality:rule:..." }
},
{
"id": "row-2",
"status": "VALIDATION_ERROR",
"error": {
"type": "VALIDATION_ERROR",
"title": "Validation Error",
"detail": "The rule implementation has no conditions."
}
}
]
}
Error handling
The API returns standard HTTP status codes and problem details for errors:
| Status code | Description |
|---|---|
|
Request successful. |
|
Rule created (as a draft). |
|
Rule deleted. |
|
Batch processed; check each item’s result for its individual outcome. |
|
Invalid request parameters or body, or publishing an incomplete rule.
The response body includes a |
|
Invalid or expired access token. |
|
Insufficient permissions to access the requested resource. |
|
Rule does not exist, or you requested |
API reference
For detailed API reference, including all endpoints, parameters, request and response schemas, and examples, see Data Quality API specification.
Next steps
-
Set up DQ Rules and Monitors via API: Set up DQ rules and monitors end-to-end for a new data source.
-
Manage DQ Monitors via API: Assign rules to DQ monitors and manage monitor configuration.
-
Run DQ Evaluation from Pipelines: Run DQ evaluation from your pipelines.
Was this page useful?