Data Quality

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
POST
GET
GET

List all data quality runs

Every check-suite run in the project, newest first. Narrow it to one subject with subject_type and subject_uuid.

Required API key scopes

query:read

Query parameters

  • limit
    integer
  • offset
    integer
  • subject_type
    string
    One of: "metric""posthog_table""table""view"
  • subject_uuid
    string

Response


Example request

GET /api/projects/:project_id/data_quality_runs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/data_quality_runs/

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"trigger": "string",
"status": "string",
"subject_type": "string",
"subject_uuid": "f50d0d7b-008d-4d86-9bfa-ff1551adaedc",
"workflow_id": "string",
"checks_passed": 0,
"checks_failed": 0,
"checks_errored": 0,
"checks_skipped": 0,
"started_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"error": "string",
"created_at": "2019-08-24T14:15:22Z"
}
]
}

Create data quality runs

Run checks now: the ones named by check_ids, every enabled check on the subject named by subject_type and subject_uuid, or every enabled check in the project when neither is given. Returns the suite run to poll for the report.

Required API key scopes

query:read

Request parameters

  • check_ids
    array
  • subject_type
  • subject_uuid
    string

Response


Example request

POST /api/projects/:project_id/data_quality_runs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/data_quality_runs/\
-d check_ids="array"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"trigger": "string",
"status": "string",
"subject_type": "string",
"subject_uuid": "f50d0d7b-008d-4d86-9bfa-ff1551adaedc",
"workflow_id": "string",
"checks_passed": 0,
"checks_failed": 0,
"checks_errored": 0,
"checks_skipped": 0,
"started_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"error": "string",
"created_at": "2019-08-24T14:15:22Z"
}

Retrieve data quality runs

Check-suite executions: start one over a selection, and read every run the project has had.

A suite run may sweep several subjects at once -- a manual project-wide run, a materialization, a source sync -- so it is reported here rather than under any one of them.

Required API key scopes

query:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/data_quality_runs/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/data_quality_runs/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"trigger": "string",
"status": "string",
"subject_type": "string",
"subject_uuid": "f50d0d7b-008d-4d86-9bfa-ff1551adaedc",
"workflow_id": "string",
"checks_passed": 0,
"checks_failed": 0,
"checks_errored": 0,
"checks_skipped": 0,
"started_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"error": "string",
"created_at": "2019-08-24T14:15:22Z"
}

List all data quality runs check runs

Every check execution in this suite run.

Required API key scopes

query:read

Path parameters

  • id
    string

Example request

GET /api/projects/:project_id/data_quality_runs/:id/check_runs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/data_quality_runs/:id/check_runs/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"quality_check": "5b7c54ee-fd30-47a5-9145-e51595a4799c",
"check_name": "string",
"suite_run": "055b78d3-f06e-47d5-aea7-eaaaeb0ef818",
"subject_type": "table",
"subject_uuid": "f50d0d7b-008d-4d86-9bfa-ff1551adaedc",
"subject_name": "string",
"check_type": "not_null",
"column_name": "string",
"check_config": {},
"check_severity": "error",
"status": "string",
"failed_row_count": 0,
"observed_value": 0,
"compiled_query": "string",
"audited_staged_refresh": true,
"error": "string",
"duration_ms": 0,
"started_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z"
}