Skip to main content
Version: 1.0.0

Public API Enterprise Audit Service API spec

The Audit API can be used to export audit data for user events.

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.

brandIduserIduserNametimestampsessionIdcolor
mybrandUR_123user12021-01-30T20:00:00.000Zsession1red
mybrandUR_125user22021-01-30T21:00:00.000Zsession2green
mybrandUR_123user12021-01-30T22:00:00.000Zsession3orange
mybrandUR_125user22021-01-31T05:00:00.000Zsession4green
mybrandUR_125user22021-01-31T07:00:00.000Zsession4red

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"}

Authentication​

This is a schema for x-api-token header authentication.

Security Scheme Type:

apiKey

Header parameter name:

X-API-TOKEN