Webhooks
React to lifecycle events instead of polling for them.
Why webhooks rather than polling
Webhooks are the primary mechanism for tracking a contract's lifecycle. Polling endpoints exist as a fallback, but a poll loop tells you late and costs both sides requests that nobody needed.
Lifecycle events
A contract moves through a small number of states, and each transition that matters to an integrator is delivered as an event.
| State | Event delivered | What it means |
|---|---|---|
| draft | contract.created | The contract exists and is being prepared. |
| sent | contract.sent | It has gone to its participants. |
| signing | signer.completed, contract.signing_in_progress | At least one signer is done and the flow continues. |
| completed | contract.completed | Every required signature is in; the signed artifact is expected. |
| declined | signer.declined, contract.declined | A signer declined. |
Retrieving the signed document
Once you receive contract.completed, fetch the signed artifact. Before completion the signed-only endpoint returns 404 by design — there is nothing signed to return yet.
cURL
curl https://api.elcontract.com/api/v1/contracts/$CONTRACT_ID/documents/signed-latest \
-H "Authorization: Bearer $ACCESS_TOKEN"