> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salad.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> For autonomous tasks, use live SaladCloud API responses for current state, availability, quotas, models, and other dynamic values. Use current OpenAPI specifications where provided for paths, schemas, required fields, and enums. Never invent endpoints, fields, prices, availability, quotas, models, or state. Prefer API workflows over Portal steps. Read before changing and never expose credentials, signed media URLs, prompts, or sensitive outputs. Retry only safe or idempotent operations with bounded backoff, honoring Retry-After. Verify every write with a read. Stop rather than repeat an uncertain non-idempotent or billable request. AI Gateway uses an organization-specific Bearer key and live /v1/models discovery. Do not delete, cancel, stop, or reduce capacity without explicit user intent. Bind shared operation IDs to the selected product path. Treat Container Engine instances as interruptible and local state as ephemeral. Install the SaladCloud skills (npx skills add https://docs.salad.com), start from the salad skill and /agents/overview; docs MCP: https://docs.salad.com/mcp.

# Validating Webhook Signatures

> Learn how to validate webhook signatures for the Job Queue API in SaladCloud.

*Last Updated: October 6, 2026*

# Validating Webhook Signatures

When using the Salad Job Queue API, you can set up webhooks to receive the output of your jobs. To ensure the integrity
and authenticity of the webhook payloads, you can validate the signatures included in the webhook requests.

A webhook request will include headers `webhook-signature`, `webhook-id` and `webhook-timestamp`, which contains a
signature of the payload. This signature can be validated using your webhook secret key, available in the portal, and
the `svix` library.

![Webhook Signature Example](https://mintcdn.com/salad/B_utM-6XUMV1Xhv8/container-engine/images/webhook-secret-key.png?fit=max\&auto=format\&n=B_utM-6XUMV1Xhv8\&q=85\&s=542c00d0ed07bc8a45aa71f66f1b2041)

## The secret key format

The webhook secret key is a base64 string with no `whsec_` prefix. The `svix` library's `Webhook(secret)` accepts it as
it is. If you use a different library, the signature follows the [Standard Webhooks](https://www.standardwebhooks.com/)
scheme:

1. Base64-decode the secret.
2. Compute an HMAC-SHA256 over `{webhook-id}.{webhook-timestamp}.{raw body}`, using the decoded secret as the key.
3. Base64-encode the result and compare it with the value after `v1,` in the `webhook-signature` header.

Always use the raw request body, exactly as received, and not a re-serialized copy of the parsed JSON.

## Webhook payload

For a job that succeeded, SaladCloud sends one `POST` to your webhook URL shortly after the job finishes:

```json theme={null}
{
  "type": "queue.job.succeeded",
  "timestamp": "2026-10-05T21:15:34.4256376Z",
  "data": {
    "id": "50150edd-e182-47b5-a754-2d2a04d6ee31",
    "status": "succeeded",
    "input": {},
    "output": {},
    "events": [
      { "type": "created", "time": "2026-10-05T21:15:32.1180000Z" },
      { "type": "started", "time": "2026-10-05T21:15:33.0120000Z" },
      { "type": "succeeded", "time": "2026-10-05T21:15:34.4010000Z" }
    ],
    "create_time": "2026-10-05T21:15:32.1180000Z",
    "update_time": "2026-10-05T21:15:34.4010000Z",
    "webhook": "https://callback.example.com/result",
    "organization_name": "my-organization",
    "project_name": "my-project",
    "queue_name": "my-queue"
  }
}
```

`input` and `output` hold your job's input and your application's response. The values above are placeholders.

> [!NOTE]
>
> In this payload each event is keyed `type`. In the Job Queue API's job document the same field is called `action`. We
> have documented only the payload for a succeeded job. The `type` values for failed or cancelled jobs are not covered
> here.

## Validating the Signature

### Node.js Example

First, install `svix`:

```bash theme={null}
npm install svix
```

Then, you can use the following code to validate the signature. Set `SALAD_WEBHOOK_SECRET` to the webhook secret key
from the portal. The middleware needs the raw request body, so register it on a route that uses `express.raw()` rather
than `express.json()`:

```javascript theme={null}
const { Webhook } = require('svix')

const secret = process.env.SALAD_WEBHOOK_SECRET

// Express.js middleware. Use with express.raw({ type: 'application/json' }) so req.body is the raw body.
function validateWebhookSignature(req, res, next) {
  const webhook = new Webhook(secret)
  try {
    webhook.verify(req.body, req.headers)
    next()
  } catch (error) {
    console.error('Webhook verification failed:', error)
    return res.status(401).send('Invalid signature')
  }
}
```

### Python Example

First, install `svix`:

```bash theme={null}
pip install svix
```

Then, you can use the following code to validate the signature. Set `SALAD_WEBHOOK_SECRET` to the webhook secret key
from the portal:

```python theme={null}
import os
from fastapi import FastAPI, Request, HTTPException
from svix import Webhook
from typing import Any, Dict

webhook_secret = os.environ["SALAD_WEBHOOK_SECRET"]

async def validate_webhook(request: Request) -> Dict[str, Any]:
    """
    FastAPI Dependency to validate webhook signatures
    """
    try:
        # Get the raw body
        body = await request.body()

        # Create webhook instance
        webhook = Webhook(webhook_secret)

        # Verify the webhook signature
        payload = webhook.verify(body, dict(request.headers))

        return payload
    except Exception as e:
        print(f"Webhook verification failed: {e}")
        raise HTTPException(status_code=401, detail="Invalid webhook signature")
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.