Skip to main content
Parchment Health uses webhooks to notify your application in real-time when events happen in your account. This guide will help you integrate with our webhook system to receive and process event notifications.

Overview

  • Delivery: HTTP POST requests to your configured endpoint
  • Retry Logic: Up to 3 attempts with exponential backoff (see Retry Behavior)
  • Request Timeout: 10 seconds per attempt
  • Supported Events: Prescription lifecycle events
Prerequisite: each organization must first call GET /v1/organizations/{organization_id}/validate. Until /validate succeeds for an organization, no webhooks are sent for it.

How Webhooks Work

  1. An event occurs in Parchment (e.g., a prescription is created)
  2. Parchment sends an HTTPS POST request to your webhook endpoint
  3. Your application processes the event
  4. Your endpoint returns a 2xx status code to confirm receipt

How to Activate Webhooks

1

Validate the organization

Call GET /v1/organizations/{organization_id}/validate once per organization you connect. This is a prerequisite — it flags the organization as integrated with your platform, and Parchment only emits webhooks for organizations that have been validated.
2

Provide your webhook endpoint

Contact Parchment support at hello@parchment.health with:
  • Your webhook endpoint URL (must be HTTPS)
  • Your partner ID
3

Receive your webhook secret

Parchment registers your endpoint and provides a confirmation with your webhook secret. This secret is shown only once — store it securely.
Save the webhook_secret immediately. It cannot be retrieved again. If lost, contact Parchment support to rotate it.
4

Implement your webhook handler

Build an endpoint that verifies the signature and routes events by type. Here’s a complete Node.js example:
See Webhook Signature Verification for Python examples and more details.
5

Test your integration

Once deployed, verify that:
  • Your endpoint returns a 2xx status code
  • Signature verification passes
  • Events are routed correctly

Webhook Endpoint Requirements

Your webhook endpoint must:
  • Use HTTPS with a valid SSL certificate
  • Return a 2xx response within 10 seconds — process events asynchronously if needed
  • Handle retries idempotently — use the event_id to prevent duplicate processing

Request Headers

Every webhook request includes the following headers:

Retry Behavior

Parchment automatically retries failed webhook deliveries using exponential backoff.

Retry Schedule

Each event is attempted up to 3 times. A request is considered failed if it does not return a 2xx status code within the 10-second timeout, or if a network error occurs. After the 3rd attempt fails, the event is not retried further and is logged as permanently failed on Parchment’s side.

Retryable vs. Non-Retryable Responses

Parchment distinguishes between transient and permanent failures to avoid pointless retries: Retryable (will retry up to the limit):
  • Network errors (connection refused, DNS failure, TLS errors)
  • Request timeouts (no response within 10 seconds)
  • 408 Request Timeout
  • 429 Too Many Requests
  • Any 5xx server error
Non-retryable (fails immediately after the first attempt):
  • Any other 4xx client error (e.g. 400, 401, 403, 404)
A 4xx response (other than 408 / 429) signals a problem with your endpoint configuration — bad signature handling, wrong auth, missing route — that retrying won’t fix. Fix the endpoint and contact Parchment support if you need the event re-sent.

When Retries Stop

Parchment stops retrying a webhook event as soon as any one of the following occurs:
  1. Successful delivery — your endpoint returns a 2xx status code.
  2. Non-retryable response — your endpoint returns a 4xx other than 408 or 429. The event fails immediately with no further attempts.
  3. Retry budget exhausted — all 3 attempts have failed with retryable errors.
Once retries stop, the event is not re-sent automatically. Failures are logged on Parchment’s side; contact hello@parchment.health if you need a failed event replayed.

Idempotency

Because retries can occasionally result in duplicate deliveries (e.g. if your endpoint returned a non-2xx status but still processed the event), your handler must be idempotent. Use the top-level event.id field from the payload as an idempotency key and skip any event ID you have already processed.

Rate Limiting

If your endpoint needs to throttle Parchment, return 429 Too Many Requests. Parchment will back off and retry according to the schedule above.

Event Types

Parchment sends webhooks for these event types: See Webhook Events for detailed payload examples.