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

# Setting up Webhooks

> Configure webhook destinations, validate endpoints, verify signatures, and handle payloads.

Webhooks are the recommended way to receive monitor results. When a monitor triggers, Pubrio sends a POST request with a JSON payload to your configured URL — in real-time.

## Prerequisites

* A Pubrio API key with monitor access
* A publicly accessible HTTPS endpoint (or a test URL from [usewebhook.com](https://usewebhook.com))

<Tip>
  **Quick testing:** Use [usewebhook.com](https://usewebhook.com) to generate a free temporary webhook URL. You can inspect every incoming payload without deploying anything.
</Tip>

***

## Step 1: Create a Monitor with Webhook Destination

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.pubrio.com/monitors/create \
    -H "Content-Type: application/json" \
    -H "pubrio-api-key: YOUR_API_KEY" \
    -d '{
      "name": "My First Monitor",
      "detection_mode": "signal_first",
      "signal_types": ["jobs"],
      "signal_filters": [
        {
          "signal_type": "jobs",
          "filters": {
            "locations": ["US"]
          }
        }
      ],
      "destination_type": "webhook",
      "destination_config": {
        "webhook_url": "https://usewebhook.com/YOUR_WEBHOOK_ID",
        "headers": {
          "X-Custom-Auth": "your-secret-token"
        },
        "body": {
          "pipeline": "my-webhook"
        }
      },
      "max_records_per_trigger": 5,
      "profile_id": 1
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.pubrio.com/monitors/create",
      headers={
          "Content-Type": "application/json",
          "pubrio-api-key": "YOUR_API_KEY"
      },
      json={
          "name": "My First Monitor",
          "detection_mode": "signal_first",
          "signal_types": ["jobs"],
          "signal_filters": [
              {
                  "signal_type": "jobs",
                  "filters": {
                      "locations": ["US"]
                  }
              }
          ],
          "destination_type": "webhook",
          "destination_config": {
              "webhook_url": "https://usewebhook.com/YOUR_WEBHOOK_ID",
              "headers": {
                  "X-Custom-Auth": "your-secret-token"
              },
              "body": {
                  "pipeline": "my-webhook"
              }
          },
          "max_records_per_trigger": 5,
          "profile_id": 1
      }
  )

  print(response.json())
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.pubrio.com/monitors/create", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "pubrio-api-key": "YOUR_API_KEY"
    },
    body: JSON.stringify({
      name: "My First Monitor",
      detection_mode: "signal_first",
      signal_types: ["jobs"],
      signal_filters: [
        {
          signal_type: "jobs",
          filters: {
            locations: ["US"]
          }
        }
      ],
      destination_type: "webhook",
      destination_config: {
        webhook_url: "https://usewebhook.com/YOUR_WEBHOOK_ID",
        headers: {
          "X-Custom-Auth": "your-secret-token"
        },
        body: {
          pipeline: "my-webhook"
        }
      },
      max_records_per_trigger: 5,
      profile_id: 1
    })
  });

  console.log(await response.json());
  ```
</CodeGroup>

**Response:**

```json theme={null}
{
  "data": {
    "monitor_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "name": "My First Monitor",
    "detection_mode": "signal_first",
    "destination_type": "webhook",
    "is_active": true,
    "is_paused": false,
    "masked_signature": "7••••••••••••••••8df",
    "created_at": "2026-04-06T10:00:00.000Z",
    "signature": "71a2b3c4-d5e6-f789-0abc-def123456789"
  }
}
```

The `headers` object adds custom HTTP headers to every delivery (useful for authentication). The `body` object adds custom fields to the root of the webhook payload.

<Tip>
  Save the `signature` from the response — you will need it to verify incoming payloads. It is only returned at creation time and via the [Signature Reveal](/en/api-reference/endpoint/monitors/signature_reveal) endpoint.
</Tip>

***

## Step 2: Validate Your Webhook Connection

Use the [Validate Webhook](/en/api-reference/endpoint/monitors/webhook_validate) endpoint to test that your endpoint is reachable. This sends a **sample payload** with placeholder data — no credits are consumed, no real signals are fetched.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.pubrio.com/monitors/webhook/validate \
    -H "Content-Type: application/json" \
    -H "pubrio-api-key: YOUR_API_KEY" \
    -d '{
      "monitor_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "detection_mode": "signal_first",
      "signal_types": ["jobs"],
      "signal_filters": [
        {
          "signal_type": "jobs",
          "filters": { "locations": ["US"] }
        }
      ],
      "destination_type": "webhook",
      "destination_config": {
        "webhook_url": "https://usewebhook.com/YOUR_WEBHOOK_ID",
        "headers": { "X-Custom-Auth": "your-secret-token" },
        "body": { "pipeline": "my-webhook" }
      },
      "profile_id": 1
    }'
  ```
</CodeGroup>

A successful response returns the sample request payload that was sent and the response your endpoint returned — so you can confirm the connection works before going live.

***

## Step 3: Test with Real Data

Once the connection is validated, trigger a real run using the [Process Try](/en/api-reference/endpoint/monitors/process_try) endpoint. This fetches actual signals and delivers them to your webhook — use `tried_at` with a recent past date to ensure data is available:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.pubrio.com/monitors/process/try \
    -H "Content-Type: application/json" \
    -H "pubrio-api-key: YOUR_API_KEY" \
    -d '{
      "monitor_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "tried_at": "2026-01-01T00:00:00.000Z",
      "profile_id": 1
    }'
  ```
</CodeGroup>

<Info>
  Unlike validate, the try endpoint runs a real scan and **consumes credits**. Use it to verify real payloads arrive correctly and to get a quick estimate of results before the scheduled scan kicks in.
</Info>

***

## Step 4: Verify Signatures

Each monitor has a unique signature for verifying that incoming payloads are genuinely from Pubrio.

<CodeGroup>
  ```bash cURL — Reveal Signature theme={null}
  curl -X POST https://api.pubrio.com/monitors/signature/reveal \
    -H "Content-Type: application/json" \
    -H "pubrio-api-key: YOUR_API_KEY" \
    -d '{
      "monitor_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "profile_id": 1
    }'
  ```
</CodeGroup>

```json theme={null}
{
  "data": {
    "monitor_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "signature": "71a2b3c4-d5e6-f789-0abc-def123456789"
  }
}
```

Compare this signature against the `monitor.monitor_id` in incoming payloads to verify authenticity.

***

## Webhook Payload Structure

Payloads differ based on the monitor's `detection_mode`:

<Tabs>
  <Tab title="Signal First">
    In `signal_first` mode, the payload contains a top-level `signals` array:

    ```json theme={null}
    {
      "monitor": {
        "monitor_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "name": "My Signal Monitor",
        "detection_mode": "signal_first",
        "signal_types": ["jobs", "news"],
        "signal_filters": [...],
        "company_filters": {...},
        "is_company_enrichment": true,
        "is_people_enrichment": true,
        "people_enrichment_configs": [...]
      },
      "metadata": {
        "total_signals": 3,
        "total_companies": 2,
        "total_people": 5
      },
      "triggered_at": "2026-04-05T20:29:43.832Z",
      "signals": [
        {
          "signal_type": "jobs",
          "signal": {
            "signal_type": "jobs",
            "job_search_id": "...",
            "companies": [
              {
                "domain_search_id": "...",
                "company_name": "...",
                "domain": "...",
                ...
              }
            ],
            ...
          },
          "companies": [
            {
              "domain_search_id": "...",
              "company_name": "...",
              "domain": "...",
              "logo_url": "...",
              "country_code": "...",
              "company_size": 5000,
              "industry": "...",
              "people": [...],
              "emails": [...],
              "phones": [...],
              ...
            }
          ]
        },
        {
          "signal_type": "news",
          "signal": {
            "signal_type": "news",
            "news_search_id": "...",
            "news_id": "...",
            "title": "...",
            "summary": "...",
            "published_at": "...",
            "source": "...",
            "category": "...",
            "companies": [...],
            ...
          },
          "companies": [...],
          ...
        },
        ...
      ]
    }
    ```

    Each signal entry contains the signal details and the associated enriched companies and people.
  </Tab>

  <Tab title="Company First">
    In `company_first` mode, the payload contains a top-level `companies` array with enriched company data and nested signals:

    ```json theme={null}
    {
      "monitor": {
        "monitor_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "name": "My Company Monitor",
        "detection_mode": "company_first",
        "signal_types": ["jobs", "news", "advertisements"],
        "signal_filters": [...],
        "company_filters": {...},
        "is_company_enrichment": true,
        "is_people_enrichment": true,
        "people_enrichment_configs": [...]
      },
      "metadata": {
        "total_signals": 4,
        "total_companies": 2,
        "total_people": 8
      },
      "triggered_at": "2026-04-03T17:45:27.228Z",
      "companies": [
        {
          "company_name": "Acme Corp",
          "domain": "acmecorp.com",
          "domain_search_id": "...",
          "country_code": "US",
          "logo_url": "...",
          "linkedin_name": "acmecorp",
          "company_size": 5200,
          "industry": "Enterprise Software",
          "estimated_revenue": 50000000,
          "founded_year": 2010,
          "company_address": "San Francisco, CA",
          "specialties": ["SaaS", "Cloud Computing", ...],
          "linkedin_url": "https://linkedin.com/company/...",
          "locations": ["US"],
          "signals": [
            {
              "signal_type": "news",
              "signal": {
                "news_id": "...",
                "title": "Acme Corp Launches New AI Product",
                "summary": "...",
                "published_at": "2026-04-03T16:35:00.000Z",
                "source": "techcrunch.com",
                "category": "launches",
                "news_category_name": "Product Launch",
                ...
              }
            },
            {
              "signal_type": "jobs",
              "signal": {
                "job_search_id": "...",
                ...
              }
            },
            ...
          ],
          "people": [
            {
              "name": "Jane Smith",
              "title": "VP of Engineering",
              "email": "j.smith@acmecorp.com",
              ...
            },
            ...
          ],
          "emails": ["info@acmecorp.com", ...],
          "phones": ["+14155551234", ...],
          "contacts": [...],
          ...
        },
        ...
      ]
    }
    ```

    Each company in the array includes the full enriched profile, all matching signals, and enriched people contacts.
  </Tab>
</Tabs>

<Note>
  Custom `body` fields from `destination_config` appear at the root level of the payload (e.g., `"pipeline": "my-webhook"` when configured in your destination).
</Note>

***

## Email Destination

For teams that prefer email delivery, set `destination_type` to `"email"`:

```json theme={null}
{
  "destination_type": "email",
  "destination_config": {
    "email": "alerts@your-company.com"
  }
}
```

<Info>
  Pubrio supports white-label email delivery for agencies and teams. [Get in touch](https://pubrio.com/en/get-in-touch) to learn about customizing the sender domain and branding.
</Info>

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Webhook not receiving payloads">
    * Verify your endpoint is publicly accessible (not behind a firewall or VPN)
    * Ensure it returns a `200` status code — other codes are treated as failures
    * Use the [Validate Webhook](/en/api-reference/endpoint/monitors/webhook_validate) endpoint to test connectivity
    * Check [Statistic Logs](/en/api-reference/endpoint/monitors/statistics_logs) for error messages and response codes
  </Accordion>

  <Accordion title="Monitor paused after failures">
    If your webhook returns non-200 codes consistently, the monitor pauses after reaching `max_failure_trigger` consecutive failures. Fix the issue and reactivate via [Update Monitor](/en/api-reference/endpoint/monitors/update).
  </Accordion>

  <Accordion title="Duplicate payloads">
    If a delivery fails and retries are configured, you may receive the same payload multiple times. Use `triggered_at` or the log ID to deduplicate on your end.
  </Accordion>

  <Accordion title="Payload too large">
    Reduce `max_records_per_trigger` to limit records per delivery. You can also narrow your filters to reduce matching signal volume.
  </Accordion>
</AccordionGroup>
