Audit Exports
Number of APIs: 4
The Audit API can be used to export audit data for user events.
This API is currently not available to brands in the US Government Data Center.
Walkthrough
The following Audit API can be used to fetch a list of all available events that get audited.
curl --location --request GET 'https://ca1.qualtrics.com/API/v3/audit-events'
--header 'X-API-TOKEN: '
It would result in a response containing a list of all available events, such as
{
"events": ["event1", "event2", "event3"]
}
These event names can be used with the other APIs to perform operations related to those specific events.
Apart from this, there is a set of three APIs intended to be called in sequence to export the audit data asynchronously.
The first API is used to submit a query for the data that needs to be exported. The second API is used to get the status of the export. The third API is used to fetch the actual file containing the data.
For example, consider the following audit data stored by us for a hypothetical event color_change
.
brandId | userId | userName | timestamp | sessionId | color |
---|---|---|---|---|---|
mybrand | UR_123 | user1 | 2021-01-30T20:00:00.000Z | session1 | red |
mybrand | UR_125 | user2 | 2021-01-30T21:00:00.000Z | session2 | green |
mybrand | UR_123 | user1 | 2021-01-30T22:00:00.000Z | session3 | orange |
mybrand | UR_125 | user2 | 2021-01-31T05:00:00.000Z | session4 | green |
mybrand | UR_125 | user2 | 2021-01-31T07:00:00.000Z | session4 | red |
The first API can be called with the query in the payload as follows.
curl --location --request POST 'https://ca1.qualtrics.com/API/v3/audit-exports'
--header 'Content-Type: application/json'
--header 'X-API-TOKEN: '
--data-raw '{
"eventName": "color_change",
"startDate": "2021-01-30T16:00:00.000Z",
"endDate": "2021-01-30T23:00:00.000Z",
"userId": "UR_123"
}'
This would result in a response containing an exportId
, such as
"6d89d26a-715f-443c-8cc4-b181f9f4d204"
The second API can now be called with this exportId
to fetch its status as follows.
curl --location --request GET 'https://ca1.qualtrics.com/API/v3/audit-exports/6d89d26a-715f-443c-8cc4-b181f9f4d204'
--header 'X-API-TOKEN: '
This would result in a response with the status of the export, such as
{
"status": "In Progress"
}
Once the export is ready, this API would return the fileId
associated with the export, with a response like
{
"status": "Completed",
"fileId": "fce1aa78-a4f9-4117-9f81-8d434c6bf0d3"
}
The third API can now be called to download the file with the query results, as follows.
curl --location --request GET 'https://ca1.qualtrics.com/API/v3/audit-exports/6d89d26a-715f-443c-8cc4-b181f9f4d204/files/fce1aa78-a4f9-4117-9f81-8d434c6bf0d3'
--header 'X-API-TOKEN: '
This would return a JSONL file, where each line is an individual event record in JSON format.
For example, in this case the resulting file would look like this.
{"brandId":"mybrand","userId":"UR_123","userName":"user1","timestamp":"2021-01-30T20:00:00.000Z","sessionId":"session1","color":"red"}
{"brandId":"mybrand","userId":"UR_123","userName":"user1","timestamp":"2021-01-30T22:00:00.000Z","sessionId":"session3","color":"orange"}
Contact Support: Email: eng-eax@qualtrics.com
-
audit-events - This returns all audit event types GET {{baseUrl}}/audit-events
-
audit-exports-{exportId}-files-{fileId} - Retrieves a download for an export job GET {{baseUrl}}/audit-exports/:exportId/files/:fileId
-
audit-exports-{exportId} - Retrieves the status of an export job GET {{baseUrl}}/audit-exports/:exportId
-
audit-exports - Create a new export job POST {{baseUrl}}/audit-exports