# Webhooks

Pass a `webhook_url` when creating a render and DevMotion will POST the result to your endpoint when the render completes or fails.

## Payload

Your endpoint receives a JSON POST body with an `event` field and the full `render` object.

render.completed payload

    {
      "event": "render.completed",
      "render": {
        "id": "render_abc123",
        "status": "completed",
        "output_url": "https://storage.../video.mp4",
        "file_size_bytes": 2456789,
        "duration_ms": 5000,
        "metadata": { "order_id": "12345" },
        "created_at": "2025-01-15T10:30:00Z",
        "completed_at": "2025-01-15T10:30:15Z"
      }
    }

render.failed payload

    {
      "event": "render.failed",
      "render": {
        "id": "render_abc123",
        "status": "failed",
        "output_url": null,
        "error_message": "Rendering error: codec not available",
        "error_code": "RENDER_FAILED",
        "metadata": { "order_id": "12345" },
        "created_at": "2025-01-15T10:30:00Z",
        "completed_at": "2025-01-15T10:30:05Z"
      }
    }

## Responding to webhooks

Your endpoint should return a `2xx` status code. DevMotion marks the webhook as `sent` on success or `failed` on non-2xx responses. There is currently no automatic retry.

## Security

Webhook payloads do not include a signature header today. We recommend filtering by IP or verifying the render ID via `GET /renders/:id` before processing the payload.