CARESIGN WEBHOOK MANUAL
Every event.
Your next action.
Connect your own system to CareSign events. Set up a receiver, verify signed requests and keep your workflow in sync—from the first send to the completed agreement.
Register your public HTTPS endpoint
Verify the signature and timestamp
Store once. Acknowledge promptly.
Process events in your system
Your app hears about it automatically.
A webhook is an HTTPS request from CareSign to your backend when something happens.
Use webhooks to update your CRM, notify your team or start a document-download job. After agreement.completed, download the signed PDF through the authenticated API. recipient.signed means one person finished; the agreement may still be in progress.
30 events cover agreement, recipient and agreement email/SMS delivery activity. Events follow the API key’s organization and configured sender, including that sender’s UI and bulk-send agreements. Template/draft administration, simulations and standalone application SMS without an agreement are outside this contract.
New to API access? Start with the API connection guide. Keep occasional status polling for reconciliation: events can repeat, arrive out of order or fail delivery.
Prepare three things.
Your receiver URL, an organization API key and a place to store the signing secret.
- A public HTTPS receiverYour backend must accept POST requests at a real URL, such as
https://your-app.example.com/hooks/caresign. Use port 443 and a valid TLS certificate. Localhost, IP literals, private/reserved addresses, redirects, URL credentials and fragments are refused. For local development, expose your receiver through a public HTTPS tunnel. - A key with explicit webhook permissionsAsk your CareSign administrator for an organization API key with
webhooks:readandwebhooks:manage. Select the sender whose agreements you need. Addagreements:readfor status lookups anddocuments:readfor PDF downloads. Existing keys do not gain scopes automatically. - Backend secret storageKeep your organization API key and the endpoint’s
whsec_...signing secret on your server. The signing secret is returned once on registration and again only when rotated. Each endpoint has its own secret.
# Run on your backend, never in browser code.
export CARESIGN_BASE_URL="https://your-caresign-domain.com/api/v1/integrations"
export CARESIGN_API_KEY="YOUR_ORGANIZATION_API_KEY"
export RECEIVER_URL="https://your-app.example.com/hooks/caresign"Self-hosting CareSign? Operator prerequisites
Ask the CareSign operator to apply migrations through 049-outbound-webhooks, configure a dedicated WEBHOOK_ENCRYPTION_KEY and restart the backend. Generate this independent 32-byte hex key with openssl rand -hex 32. In development, store it in CareSign’s ignored .env; in production, use the deployment’s backend secret mechanism. Keep it stable across instances and restarts.
This operator encryption key stays inside CareSign. Your receiving application uses the endpoint’s whsec_... secret to verify requests. You do not need the operator’s encryption key to integrate. If it is unset, endpoint registration returns 409and the delivery worker does not run.
Register your receiver. Subscribe to every event.
Use your server-side API key. All example paths are relative to the base URL above.
Discover the catalog with GET /webhooks/events, then send its complete events array to POST /webhooks. There is no wildcard. Future event types require an explicit subscription update. The commands below require curl and jq; Postman users can copy the returned events array into a JSON body with their receiver url.
# Requires curl and jq. This only registers an endpoint; it sends no invitations.
curl --fail-with-body --silent --show-error \
"$CARESIGN_BASE_URL/webhooks/events" \
-H "Authorization: Bearer $CARESIGN_API_KEY" \
| jq --arg url "$RECEIVER_URL" '{url: $url, events: .events}' \
> webhook-request.json
# Run only after event discovery succeeds and the JSON contains the expected events.
curl --fail-with-body --silent --show-error \
"$CARESIGN_BASE_URL/webhooks" \
-H "Authorization: Bearer $CARESIGN_API_KEY" \
-H "Content-Type: application/json" \
--data @webhook-request.json{
"endpoint": {
"id": "44444444-4444-4444-8444-444444444444",
"url": "https://your-app.example.com/hooks/caresign",
"events": [
"agreement.completed"
],
"enabled": true,
"createdAt": "2026-11-17T10:00:00.000Z",
"updatedAt": "2026-11-17T10:00:00.000Z"
},
"secret": "whsec_SAVE_THE_ACTUAL_RETURNED_SECRET"
}The response echoes your full subscription; the illustration shows one event for brevity. Save endpoint.id as ENDPOINT_ID and store the returned secret securely in your receiver’s backend. Registration enables the endpoint immediately, so configure verification promptly and replay any deliveries that failed during setup.
To subscribe to fewer events, replace the events array with the names you need, for example ["agreement.completed", "delivery.failed"]. Registration does not backfill old events or send invitations. Each sender can register up to 20 endpoints.
Verify first. Persist before you acknowledge.
The same rules apply in Node.js, PHP, Python or any backend that can read raw request bytes and compute HMAC-SHA256.
- Read the original bodyVerify the exact raw UTF-8 request bytes before JSON parsing. Parsing and serializing the JSON again can change whitespace and break verification.
- Check the signature and timestampThe signature header contains
t=UNIX_SECONDS,v1=HEX_DIGEST. Compute HMAC-SHA256 overtimestamp + "." + rawBodyusing the completewhsec_...string as the UTF-8 key. Do not decode its suffix. Compare using a timing-safe function and reject timestamps outside five minutes. Keep clocks synchronized. - Validate and durably save the eventCheck the API version, organization and event ID. Use a unique event ID in a database inbox. Return a prompt
2xxafter persistence, including for duplicates already stored. Return503when persistence fails. - Process asynchronouslyA separate job should claim stored events, handle the event types your app supports and mark work complete. Retry that work independently; a webhook acknowledgment means received, not that your business action finished.
Copy a runnable Node.js receiver with a durable inbox Node.js 26 · SQLite
Save this as receiver.mjs on your server. It uses Node.js 26 built-ins and a private SQLite inbox; no npm packages are required. It acknowledges verified events only after storage succeeds. Run one instance on durable disk, behind your HTTPS reverse proxy, which forwards /hooks/caresign to 127.0.0.1:8080.
// receiver.mjs — Node.js 26; no npm dependencies.
import { createHmac, timingSafeEqual } from 'node:crypto';
import { createServer } from 'node:http';
import { DatabaseSync } from 'node:sqlite';
const secret = process.env.CARESIGN_WEBHOOK_SECRET;
const organizationId = process.env.CARESIGN_ORGANIZATION_ID;
if (!secret || !organizationId) throw new Error('Configure receiver secrets and organization ID.');
const db = new DatabaseSync(process.env.WEBHOOK_INBOX_PATH || 'webhook-inbox.sqlite');
db.exec(`PRAGMA journal_mode = WAL;
PRAGMA synchronous = FULL;
CREATE TABLE IF NOT EXISTS webhook_inbox (
id TEXT PRIMARY KEY, body TEXT NOT NULL, received_at TEXT NOT NULL
);`);
const save = db.prepare(`INSERT INTO webhook_inbox (id, body, received_at)
VALUES (?, ?, ?) ON CONFLICT(id) DO NOTHING`);
function verified(rawBody, header) {
if (typeof header !== 'string') return false;
const match = /^t=(\d{1,12}),v1=([a-f0-9]{64})$/.exec(header);
if (!match || Math.abs(Date.now() / 1000 - Number(match[1])) > 300) return false;
const expected = createHmac('sha256', secret)
.update(match[1] + '.').update(rawBody).digest();
return timingSafeEqual(expected, Buffer.from(match[2], 'hex'));
}
const server = createServer(async (req, res) => {
const reply = (status) => res.writeHead(status).end();
if (req.method !== 'POST' || req.url !== '/hooks/caresign') return reply(404);
const chunks = [];
let size = 0;
try {
for await (const chunk of req) {
size += chunk.length;
if (size > 8192) return reply(413);
chunks.push(chunk);
}
const raw = Buffer.concat(chunks);
if (!verified(raw, req.headers['x-caresign-signature'])) return reply(401);
let event;
try { event = JSON.parse(raw.toString('utf8')); }
catch { return reply(400); }
if (!event || event.apiVersion !== 1 || typeof event.id !== 'string' ||
typeof event.type !== 'string' || event.organizationId !== organizationId ||
!event.data || typeof event.data.agreementId !== 'string' ||
event.id !== req.headers['x-caresign-event-id']) return reply(400);
// Persist first. Duplicate IDs are already accepted; acknowledge them again.
save.run(event.id, raw.toString('utf8'), new Date().toISOString());
return reply(204);
} catch {
// A storage failure must be retryable. Never acknowledge an unpersisted event.
return reply(503);
}
});
server.requestTimeout = 8000;
server.listen(Number(process.env.PORT || 8080), '127.0.0.1', () => {
console.log('Receiver listening on port ' + server.address().port);
});
# Supply through your backend's secret manager or environment.
export CARESIGN_WEBHOOK_SECRET="whsec_SECRET_FROM_ENDPOINT_REGISTRATION"
export CARESIGN_ORGANIZATION_ID="YOUR_CARESIGN_ORGANIZATION_UUID"
# Use a private, durable location that exists and is writable by your app.
export WEBHOOK_INBOX_PATH="/absolute/private/path/webhook-inbox.sqlite"
node receiver.mjsReplace the placeholders with your endpoint signing secret and CareSign organization UUID. The inbox directory must already exist and be writable. Keep the database outside public web directories. This example stores events; add your own background processor to update your system or fetch PDFs. For multiple instances, use a shared durable database or queue with a unique event ID instead of separate SQLite files.
Every event, explained.
Choose the events your system needs. Email/SMS delivery is separate from agreement progress.
Delivery events cover recipient messages associated with agreements, including reminders and completion notifications. Use messageKind to distinguish their purpose. A recipient decline produces two distinct events: recipient.declined and agreement.declined.
30 matching events
- agreement.sent
- The agreement was sent and its initial routing was recorded.
- agreement.finalizing
- Recipient actions are complete and the final documents are being prepared.
- agreement.finalization_failed
- Final document preparation failed. The completed PDF is not ready.
- agreement.completed
- The agreement is complete and its final artifacts have been prepared. Fetch the signed PDF with the documents API.
- agreement.declined
- A recipient declined, ending the agreement workflow.
- agreement.voided
- The sender voided the agreement, including replacement flows.
- agreement.expired
- The agreement reached its expiration deadline.
- agreement.corrected
- The agreement or a recipient was corrected, including recipient reassignment. Private correction details are omitted.
- agreement.expiry_warning
- An expiry-warning workflow action was recorded.
- recipient.link_opened
- A recipient opened a link according to the signing-session audit rules; this is not every page refresh.
- recipient.viewed
- The recipient entered the viewed state.
- recipient.consented
- The recipient recorded consent to the signing process.
- recipient.signed
- A signer completed their action. Other recipients or finalization may still be pending.
- recipient.filled
- A filler completed their assigned fields.
- recipient.approved
- An approver completed their approval action.
- recipient.declined
- A recipient declined. A separate agreement.declined event is also emitted.
- recipient.reminded
- A reminder action was recorded; provider delivery is a separate event.
- recipient.resent
- The sender intentionally resent a recipient invitation.
- recipient.downloaded
- The server finished transferring a completed PDF to a recipient. This does not establish that a person saved or read it.
- recipient.download_link_reissued
- Completed-document download access was reissued.
- recipient.download_access_revoked
- Completed-document download access was revoked.
- delivery.queued
- A recipient message was queued. A retry can return a message to this state.
- delivery.sending
- A worker claimed the message for submission.
- delivery.sent
- The email transport accepted the submission. Delivery is not yet confirmed.
- delivery.accepted
- The SMS provider accepted the submission. Delivery is not yet confirmed.
- delivery.delivered
- Verified provider feedback confirmed delivery.
- delivery.failed
- The message reached a failure state. Check its safe failure code and current status.
- delivery.bounced
- Verified email feedback reported a bounce.
- delivery.complained
- Verified email feedback reported a complaint.
- delivery.uncertain
- SMS submission may have occurred but its outcome is uncertain. CareSign does not blindly submit it again.
A small event. A stable identity.
The payload has the identifiers needed to reconcile state. Document contents and recipient contact details stay out of the event.
{
"id": "11111111-1111-4111-8111-111111111111",
"type": "agreement.completed",
"apiVersion": 1,
"occurredAt": "2026-11-17T10:00:00.000Z",
"organizationId": "22222222-2222-4222-8222-222222222222",
"data": {
"agreementId": "33333333-3333-4333-8333-333333333333",
"agreementVersion": 7,
"recipientId": null
}
}- id / X-CareSign-Event-Id
- Deduplicate using this event UUID. It stays the same across retries and manual replay, even if a request is received more than once.
- apiVersion / type / organizationId
- Validate version 1, the event type your processor handles and your expected organization.
- occurredAt / data.agreementVersion
- The event time and observed agreement version. Events can arrive out of order, and multiple events can share a version. Fetch current agreement state before applying updates that depend on ordering.
- data.agreementId / data.recipientId
- The agreement UUID and, when relevant, the recipient UUID. Agreement-wide events may have a null recipient.
- Delivery-only fields
channel(EMAIL/SMS),messageId(CareSign’s message UUID),messageKind,deliveryStatusand nullablefailureCode.
Content-Type: application/json
X-CareSign-Event-Id: 11111111-1111-4111-8111-111111111111
X-CareSign-Delivery-Id: 55555555-5555-4555-8555-555555555555
X-CareSign-Signature: t=1794909600,v1=HEX_HMAC_SHA256_DIGESTThe signature timestamp is refreshed for each attempt; it is different from the event’s occurredAt. No PDF bytes, field answers, signing links, names, emails, audit IPs or user agents are included. Fetch status with GET /agreements/{id}or the completed PDF with GET /agreements/{id}/completed using separately scoped API access.
Manage your connection.
Eight endpoints for discovery, configuration and recovery. All require an organization API key; paths are relative to /api/v1/integrations.
GET/webhooks/eventsDiscover supported events
- Permission
webhooks:read- Success
- 200
Returns { apiVersion: 1, events: [...] }. Use the complete returned array to subscribe to all current events; there is no wildcard.
GET/webhooksList your endpoints
- Permission
webhooks:read- Success
- 200
Returns { endpoints: [...] } for the API key’s organization and configured sender. Secrets are omitted. A sender can register up to 20 endpoints.
POST/webhooksRegister an endpoint
- Permission
webhooks:manage- Success
- 201
Body: { url, events }. Returns { endpoint, secret }. The endpoint is enabled immediately; save the one-time secret. Existing historical events are not backfilled.
PUT/webhooks/{id}Update event subscriptions or pause delivery
- Permission
webhooks:manage- Success
- 200
Body: { enabled, events }. Both are required. Returns { endpoint }. The URL is immutable; create a new endpoint to change destinations. Subscription edits affect future events. Already queued events retain their original body.
DELETE/webhooks/{id}Remove an endpoint
- Permission
webhooks:manage- Success
- 204 · no body
Removes the endpoint and secret. Pending deliveries are subsequently skipped. Stored delivery history remains in the database, but this endpoint’s delivery-list API is no longer accessible. An in-flight request can finish.
POST/webhooks/{id}/rotate-secretRotate the receiver signing secret
- Permission
webhooks:manage- Success
- 200
No request body required. Returns { endpoint, secret }. The new secret applies immediately to subsequent attempts, including retries. Keep a short previous-secret overlap at your receiver for requests already in flight.
GET/webhooks/{id}/deliveriesInspect recent deliveries
- Permission
webhooks:read- Success
- 200
Returns { deliveries: [...] }, the latest 100 deliveries, newest first. Includes IDs, event type, status, cumulative attempts, HTTP status, safe error code and timestamps. Payloads, secrets and remote response bodies are omitted.
POST/webhooks/{id}/deliveries/{deliveryId}/replayReplay a failed or skipped delivery
- Permission
webhooks:manage- Success
- 200
No request body required. The endpoint must be enabled and the delivery FAILED or SKIPPED. Returns { delivery }. Adds eight allowed attempts while retaining cumulative attempts, the same event ID and the exact body. Other states return 409.
Access is always limited to the key’s organization and configured sender, including administrator senders. URL changes require a new endpoint. Disable an endpoint to pause future delivery; a request already in flight can finish.
Recover without losing the event.
Delivery is at least once. Your receiver must accept duplicates and your processor must tolerate out-of-order events.
- 2xx → DELIVERED
- Your receiver acknowledged the request. Acknowledge only after durable storage. CareSign does not automatically retry a delivered record.
- Network error, timeout, 408, 429 or 5xx → retry
- Up to eight automatic attempts. The delay starts at 30 seconds, doubles per attempt, is capped at one hour and adds under five seconds of jitter. Each HTTP attempt, including DNS, has a ten-second deadline.
- Other HTTP statuses → FAILED
- Other statuses, including redirects and 400/401/403/404, do not automatically retry. Unsafe destinations and unreadable encrypted secrets also fail closed.
- Unavailable endpoint, organization or sender → SKIPPED
- Enable the endpoint and resolve access or account issues before replaying. Deleted endpoints cannot be replayed through their former endpoint URL.
Delivery runs in a background worker, separately from signing. Database leases allow another worker to recover after a crash. A timeout can occur after your receiver stored an event; retries keep the same event ID and exact payload, with a fresh signature timestamp.
curl --fail-with-body --silent --show-error \
"$CARESIGN_BASE_URL/webhooks/$ENDPOINT_ID/deliveries" \
-H "Authorization: Bearer $CARESIGN_API_KEY"Set ENDPOINT_ID to your registration ID. Choose a failed/skipped record and use its delivery id as DELIVERY_ID. Correct the problem first.
# Correct the failure first; the endpoint must be enabled.
curl --fail-with-body --silent --show-error -X POST \
"$CARESIGN_BASE_URL/webhooks/$ENDPOINT_ID/deliveries/$DELIVERY_ID/replay" \
-H "Authorization: Bearer $CARESIGN_API_KEY"Replay adds eight allowed attempts and retains cumulative attempt history. Queued, in-flight and delivered records cannot be replayed. Keep occasional agreement-status reconciliation, and monitor your own inbox processing failures separately from webhook delivery.
Prove the complete path.
Use a designated test agreement and contacts you control. These actions may send real recipient invitations.
- Bring the receiver onlineConfirm the public URL accepts POST without authentication redirects. Supply your expected organization UUID and endpoint signing secret. Verify raw-body signature checking and durable inbox storage before business processing.
- Trigger a real workflow eventSend a test agreement using the sender attached to your API key. Check for
agreement.sent, then open and complete the recipient’s action to observe the corresponding events. There is no dedicated test-event endpoint. - Compare both sidesInspect
GET /webhooks/{id}/deliveriesand your receiver inbox. MatcheventIdto the payloadid. ADELIVEREDwebhook means your endpoint returned 2xx, not that an email was delivered. - Exercise failure and duplicate handlingIn your controlled test environment, temporarily return 503, then restore successful responses and observe a retry. Confirm that repeated event IDs create only one inbox record and one business action. Use manual replay only for failed/skipped records.
- Confirm your completed-document jobAfter
agreement.completed, fetch the PDF usingdocuments:read. Keep the API key on your backend and handle asynchronous processing failures independently.
Sync your clocks and test rejection of a changed body and stale signature. During secret rotation, briefly accept the previous secret for in-flight requests and then retire it.
Find the failure. Fix the right side.
Use safe error codes and event IDs to correlate CareSign delivery records with your receiver’s logs.
401 / 403 from CareSign
Check the organization API key, its webhook scopes, expiry/revocation and configured sender. The organization and sender must be active, with password setup complete.
409 during registration or enabling
Ask the CareSign operator to configure WEBHOOK_ENCRYPTION_KEY and restart the backend. At the endpoint limit, remove an unused endpoint.
No delivery records
Confirm the endpoint is enabled, the event is subscribed and the agreement belongs to the key’s configured sender and organization. New endpoints do not receive historical events. Ask the operator to confirm the worker and migration are ready.
unsafe_endpoint / http_error
Use a public DNS name with HTTPS on port 443 and a valid certificate. DNS must not resolve to private/reserved addresses. Remove redirect responses and check the recorded HTTP status.
Receiver rejects the signature
Use the exact raw body and the complete whsec_ secret, not the organization API key or CareSign encryption key. Check timestamp tolerance, synchronized clocks and secret rotation.
network / timeout
Check public DNS, TLS, firewall and reverse-proxy routing. Persist the event and acknowledge promptly; run slow work in the background.
secret_unavailable
The CareSign operator must restore the encryption key or rotate/recreate endpoint secrets under the current key. Update the receiver secret, then replay failed deliveries.
endpoint_unavailable / SKIPPED
Check endpoint enabled state and organization/sender availability. A sender suspension, incomplete password setup or missing membership blocks delivery.
409 during replay
The endpoint must be enabled and the delivery must be FAILED or SKIPPED. Replaying a queued, in-flight or delivered record is rejected.
PDF is not ready / messages appear out of order
Wait for agreement.completed rather than recipient.signed. Treat delivery events as a separate signal and fetch authoritative agreement state before applying ordered updates.
The delivery API shows the latest 100 records per existing endpoint. CareSign does not store remote response bodies or expose signing secrets in read responses. This release has no automatic delivery-history expiry; agree a retention policy with your operator.
Keep building your integration.
Find the agreement status, sending and completed-PDF APIs in the main guide.
Webhook API v1 · Examples use placeholders · Feature availability depends on your deployment. No requests are sent from this manual.
