Skip to main content

Webhook Callbacks

Instead of polling the status endpoint, you can provide a callback URL when submitting tasks to receive automatic notifications when generation completes.

How It Works

  1. Submit with callback URL: Include a callback_url in your task submission
  2. Receive notification: When the task completes (success or failure), Vidgo API sends a POST request to your URL
  3. Process result: Your server receives the complete task data including generated files

Callback Request

When a task reaches finished or failed, Vidgo API sends a flat task object to your callback URL. Unlike the status endpoint response, the callback body is not wrapped in code and data:

Failed Task Callback

Requirements

Your callback endpoint must meet the following requirements:
  • Public endpoint: Use a publicly reachable HTTP(S) URL
  • Response timeout: Respond within 30 seconds
  • Success response: Should return HTTP 200-299 status code

Retry Policy

If delivery times out, encounters a network error, or receives a 5xx response:
  • Retry attempts: Up to 5 automatic retries
  • Retry delays: Exponential backoff with jitter, capped at 10 minutes between attempts
  • Final failure: After all retries are exhausted, no further callback attempts are made
  • Client errors: 4xx responses are recorded and are not retried
If all retry attempts fail, you can still retrieve the results by polling the status endpoint.

Example Implementation

Python (Flask)

Node.js (Express)

Go

Security Best Practices

Verify requests: Consider adding a signature verification mechanism to ensure requests are from Vidgo API
Idempotency: Design your webhook handler to be idempotent in case of duplicate deliveries
Async processing: Process the callback asynchronously and return 200 quickly to avoid timeouts
Logging: Log all webhook requests for debugging and monitoring

Testing

Using ngrok for Local Testing

During development, you can use ngrok to expose your local server:

Webhook vs Polling

For production systems handling high volumes, webhooks are recommended to reduce API calls and get instant notifications.

Next Steps

Task Status

Learn about polling task status

Image Generation

Generate images with GPT-4o

Video Generation

Create videos with Sora 2

Quick Start

Back to Quick Start guide