Authentication
All webhooks are sent with a signature in theX-Mosaic-Signature header when you have a webhook secret configured. The signature is your webhook secret sent as a plaintext string for simple validation.
Important: This is NOT encryption or hashing - it’s a direct plaintext string comparison for authentication.
Signature Validation Example
Webhook Types
Mosaic sends three types of webhooks:- RUN_STARTED - Sent when an agent run begins processing
- RUN_FINISHED - Sent when an agent run completes (successfully or with failures)
- TEST - Sent when testing your webhook endpoint
RUN_STARTED
Sent immediately when an agent run begins processing. This webhook includes information about all input videos being processed.Payload Structure
Field Descriptions
| Field | Type | Description |
|---|---|---|
flag | "RUN_STARTED" | Webhook type identifier |
agent_id | string | UUID of the agent being executed |
run_id | string | UUID of the agent run (same as agent_state_id) |
status | "running" | Current status of the run |
inputs | VideoInput[] | Array of input videos being processed |
triggered_by | TriggerInfo | Optional information about what triggered this run |
RUN_FINISHED
Sent when an agent run completes processing (successfully or with failures). This webhook includes all final outputs produced by the run.Payload Structure
Field Descriptions
| Field | Type | Description |
|---|---|---|
flag | "RUN_FINISHED" | Webhook type identifier |
agent_id | string | UUID of the agent that was executed |
run_id | string | UUID of the agent run (same as agent_state_id) |
status | "completed" | "partial_complete" | "failed" | Final status of the run |
inputs | VideoInput[] | Array of input videos that were processed |
outputs | VideoOutput[] | Array of final output videos produced by the run |
triggered_by | TriggerInfo | Optional information about what triggered this run |
Status Values
Thestatus field can have the following values:
"completed"- All videos processed successfully with outputs generated"partial_complete"- Some videos processed successfully, but others failed"failed"- The entire run failed, no outputs generated
TEST
Sent when testing your webhook endpoint via the webhook testing API. This webhook helps you verify that your endpoint is working correctly.Payload Structure
Field Descriptions
| Field | Type | Description |
|---|---|---|
flag | "TEST" | Webhook type identifier |
run_id | "test" | Always “test” for test webhooks |
timestamp | string | ISO 8601 timestamp when test was sent |
message | string | Human-readable test message |
user_id | string | UUID of the user who initiated the test |
test_data | object | Additional test data |
Common Data Types
VideoInput
Input video information included in webhook payloads.| Field | Type | Required | Description |
|---|---|---|---|
video_url | string | ✅ | Signed URL to access the video file (expires after 1 hour) |
thumbnail_url | string | ✅ | Signed URL to access the video thumbnail |
VideoOutput
Output video information included in webhook payloads.| Field | Type | Required | Description |
|---|---|---|---|
video_url | string | ✅ | Signed URL to download the rendered video (expires after 1 hour) |
thumbnail_url | string | ✅ | Signed URL to download the video thumbnail |
completed_at | string | ✅ | ISO 8601 timestamp when rendering completed |
TriggerInfo
Information about what triggered the agent run. The structure varies by trigger type.YouTube Trigger
Schedule Trigger
Manual Trigger
Webhook Response
Your webhook endpoint should return a JSON response with HTTP status 200-299 to indicate successful receipt. The response format is optional, but we recommend:Error Handling
- Webhook delivery will be retried up to 3 times with exponential backoff if your endpoint returns a non-2xx status code
- Webhooks will timeout after 30 seconds
- Failed webhooks are logged and can be viewed in your dashboard
Setting Up Webhooks
For Agent Runs
Include thecallback_url when starting an agent run:
For Triggers
Configure webhooks when setting up triggers to be notified of automatic runs:TypeScript Types
For TypeScript users, here are the type definitions:Next Steps
- Review agent operations for the complete workflow
- Set up triggers for automatic processing