- Docs
- API reference
- Endpoints and schemas
- GraphQL
- Selection
BackgroundTask
A background task is work that the API completes after it sends a response.
Selection. This type is a selection. An intent returns it, and you choose which of its fields come back.
A background task is work that the API completes after it sends a response. The response lists each background task under extensions.backgroundTasks, with its id and status. Send the id to the backgroundTask query to get the current state and the result. The query returns a background task only to the API key that created it.
Where it appears
Section titled “Where it appears”No connection leads here from a primary entity.
backgroundTaskreturns it.
Fields
Section titled “Fields”| Field | Type | Description |
|---|---|---|
id |
UUID! |
The ID of the background task. Send it to the backgroundTask query to get the current state. |
apiKeyId |
String! |
The ID of the API key that created the background task. Only this API key can read the background task. |
backgroundTaskType |
String! |
The kind of background task. LIST_GENERATION writes the results of a search or an enrichment to files. PARTIAL_CONTENT completes the data of a response that the API sent early with HTTP status 206. |
status |
String! |
The state of the background task. The values are PROCESSING, POST_PROCESSING, SUCCESS, FAILED, CANCELLED, and INSUFFICIENT_CREDITS. The result is available when the status is SUCCESS. |
args |
JSON |
The input data that the background task runs with. |
result |
JSON |
The output of the background task. For LIST_GENERATION, it holds the download URLs of the result files. For PARTIAL_CONTENT, it holds the complete response data. |
progressPercentComplete |
Float |
The part of the work that is complete, as a fraction from 0 to 1. |
progressMessage |
String |
A short message about the progress of the background task, such as the number of rows that are complete. |
lastError |
String |
The most recent error message emitted during execution. |
executionAttempts |
Int! |
The number of attempts to execute the background task. |
etag |
String! |
A version tag of the background task. The value changes each time the background task changes. |
createdTimestamp |
DateTime! |
The date and time when the background task was created. |
updatedTimestamp |
DateTime! |
The date and time of the last change to the background task. |
lastExecutionTimestamp |
DateTime |
The most recent execution timestamp. |
nextExecutionTimestamp |
DateTime! |
The upcoming execution timestamp, if any (e.g. impending retry). |
Example
Section titled “Example”This intent needs an ID from an earlier answer, so the reference does not run it. Replace the ID with one from your own account.
query { backgroundTask(id: "00000000-0000-4000-8000-000000000001") { id status progressPercentComplete result }}