Skip to main content
Baselayer’s API can run requests asynchronously, depending on your API key’s default request mode and the Prefer header (see Synchronous & Asynchronous Request Execution). Most verification and enrichment operations happen in the background, with results delivered via webhooks when processing completes.

Why Webhooks?

Certain Baselayer products can take a few seconds to complete. During this time, the API is:
  • Querying authoritative data sources
  • Scraping and analyzing websites
  • Running AI-powered enrichment
  • Performing multi-step verification workflows
Webhooks provide real-time notifications the moment your data is ready, eliminating the need to constantly poll our API.

Webhooks vs. API Polling

Recommendation: Use webhooks for production integrations. Baselayer’s async architecture is optimized for webhook delivery.

Setting Up Webhook Endpoints

  1. Log into the Baselayer console
  2. Click your name at the bottom of the sidebar, then Webhooks & Logs
  3. Click Add Endpoint
  1. Enter your endpoint parameters URL (must be HTTPS)
    1. Subscribe to the required events
    2. We recommend creating one single endpoint per event type
  1. Save the endpoint
  2. Copy your signing secret - you’ll need this to verify webhook signatures
The signing secret will look like: whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD ⚠️ Important: Your endpoint must use HTTPS. HTTP endpoints will be rejected.

Via API (Programmatic Setup)

You can also create webhook endpoints programmatically:

cURL Example

Python Example

The API will automatically generate a signing secret. The response does not include it, so copy it from Webhooks & Logs in the console. You can also send your own secret (starting with whsec_) in the request body. Store it securely - you’ll need it to verify incoming webhooks. For signature verification details, see the Authentication guide.

Understanding Webhook Events

Every webhook Baselayer sends includes standardized metadata and event-specific data.

Event Structure

All webhook events include an __event__ field with metadata:

Common Event Patterns

Baselayer webhooks follow consistent naming patterns:
  • .submitted - Request received and queued for processing
  • .completed - Processing finished successfully, data is ready
  • .failed - Processing failed (insufficient data, invalid input, etc.)
  • .cancelled - Request was cancelled before completing (Business Search only)
  • .updated - Initial results have been updated with additional data
  • .created and .deleted - A resource such as a portfolio item, portfolio group, lien filing or API key was created or deleted
Not all products emit all event types. Check product-specific documentation for complete event listings.

Event Names vs. Resource state

Webhook event names are lowercase and describe something that happened. The state field on the resource itself is uppercase and describes where the request is in its lifecycle: PENDING, EXECUTING, COMPLETED, FAILED, or CANCELLED. They map as follows: .updated is a webhook-only event with no corresponding resource state.

Webhook Lifecycle Examples

Example 1: Standard Async Flow

Most Baselayer API calls follow this pattern:

Sample BusinessSearch.completed Webhook

Example 2: Updated Events - TIN Retry

Some data may be unavailable initially but delivered later via .updated webhooks. Scenario: IRS TIN Matching Temporarily Unavailable
For detailed information about IRS TIN verification and outage handling, see the IRS Outage Handling guide. Requesting liens or dockets triggers an additional verification pass:
Key Insight: Always handle .updated webhooks to ensure you have the most current data.

Webhook Delivery & Retries

Baselayer uses Svix for reliable webhook delivery.

Retry Behavior

If your endpoint fails to respond with a 2xx status code, Baselayer will automatically retry:
  • Initial attempt: Immediate delivery
  • Retry schedule: Exponential backoff over several attempts
If all retries fail, the webhook is marked as failed. You can replay failed webhooks from the Baselayer console.

Handling Retries in Your Code

Webhooks may be delivered more than once (retries, network issues, etc.). Implement idempotency using the svix-id header. It is unique to each webhook message and stays the same on retries. The id in the body is the resource ID, which repeats across .completed and .updated events:

Best Practices

1. Return 200 Quickly
Your webhook endpoint should acknowledge receipt immediately. Don’t perform long-running operations before returning 200, or Baselayer may time out and retry.
2. Always Verify Signatures
Never trust webhook data without verification. See the Authentication guide for implementation details.
3. Handle .updated Events
Some workflows (TIN verification, liens or docket searches) may send updated data after initial completion.
4. Implement Idempotency
Use the svix-id header to prevent duplicate processing. In production, store processed IDs in your database or cache.
5. Monitor Webhook Health
Regularly check the Baselayer console’s webhook dashboard for failed deliveries or high error rates. Failed webhooks can be manually replayed from the console.

When to Use API Polling Instead

Webhooks are recommended for most use cases, but polling may be appropriate for: Business Search supports synchronous mode using the Accept header for immediate results:

cURL Example

Python Example

Note: Synchronous mode is not limited to Business Search. All task-based endpoints support it through the Prefer header. See Synchronous & Asynchronous Request Execution.

2. Testing & Development

For quick testing without webhook infrastructure:

3. Simple One-Off Integrations

If you’re only running occasional searches and don’t want to set up webhook infrastructure, polling is acceptable. Important: For production use at scale, webhooks are significantly more efficient.

Next Steps

Now that you understand webhooks, you’re ready to: For detailed webhook event schemas and specifications, see the API reference. For questions about webhooks or integration support, contact your Baselayer account manager.