In superAI, webhooks are triggered upon job submission. Users can provide a callbackUrl
in the payload when submitting a job (or enable project wide callbacks. When the job is completed, superAI will send a POST request to the specified callbackUrl
with the job details.
Here's an example of a job submission with a callbackUrl
:
curl "https://api.super.ai/v1/apps/<project_uuid>/jobs" \
-X POST \
-H "API-KEY: <your_api_key>" \
-H "Content-Type: application/json" \
-d '{ "inputs": [ {"documentUrl":"<public_ur_or_data_url>"} ], "callbackUrl": "<your_callback_url>"}'
In this example, the callbackUrl
will be called with a POST request containing the job results when the job is completed.
This URL should be fully qualified, meaning it must include the protocol (http://
or https://
) and end with a trailing slash (/
).
Example of a valid callback URL: https://example.com/callbacks/
Callback Data Structure:
Below is an overview of the data structure you can expect to receive in the callback:
Callback attributes
Attribute | Type | Description |
---|---|---|
id | string | Job identifier, corresponding to its identifier in the super.AI dashboard |
uuid | string | A universally unique identifier for the job |
state | string | The current status of the job, with the options FAILED , SUSPENDED , CANCELED , EXPIRED , COMPLETED , REVIEWED , POST PROCESSING , POST PROCESSED or NEEDS REVIEW |
postProcessingEnabled | string | Indicating whether a post-processing step (validation rules, redaction, etc.) is enabled, meaning a job automatically moves from COMPLETED state to POST PROCESSED or NEEDS REVIEW |
action | string | Whether the webhook was triggered by a job state change (RESOLVED ), an edit (EDITED ), an added tag (TAG ADDED ), a deleted tag (TAG REMOVED ), or the action of marking a job as correct or incorrect ( ACCEPTED ). |
This structure provides comprehensive details about the job's state and any relevant metadata, allowing your system to respond or update accordingly.
Additional Information
If you need further details about the job related to the callback event, you can use the Retrieve a Single Job Object API. It supports passing the uuid
as the job_id
parameter. This API offers extended information, including the Project ID (appId
), allowing for deeper insights into the job's context.