Documentation Index
Fetch the complete documentation index at: https://mintfax.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Outcome
You will send a fax to a sandbox magic number, poll for its status, receive a webhook event, and verify the HMAC signature. Everything runs against the sandbox. No real faxes are sent and no credits are charged.Prerequisites
- A mintfax sandbox API key (
fx_test_...). Sign up here if you do not have one. - Node.js 18 or later (for native
fetchandcrypto). - A PDF file to fax. Any single-page PDF works.
- A publicly reachable URL for webhooks, or a tunnel tool such as ngrok.
Step 1: Send a fax
Post a fax to the sandbox success number+15005550001. This number always delivers on the first attempt.
Create send-fax.mjs:
201 and the status field is queued. Save the returned id for the next step.
The Idempotency-Key header makes this request safe to retry. If the network drops and you re-run the same script, mintfax returns the original response without sending a duplicate fax. See Idempotency keys for details.
Step 2: Check fax status
PollGET /fax/{id} until the fax reaches a terminal state (delivered or failed).
Create check-status.mjs:
delivered printed to the console.
Step 3: Receive a webhook event
mintfax sends afax.delivered or fax.failed event to your webhook URL when a fax reaches a terminal state. The server below listens for these events and verifies the HMAC signature before trusting the payload.
Create webhook-server.mjs:
Received fax.delivered for fax <id> and the signature check passes.
The Webhook signing guide covers replay protection, secret rotation, and signature verification in other languages.
Step 4: Handle errors
Swap the destination number insend-fax.mjs to trigger different outcomes:
| Number | Behavior |
|---|---|
+15005550001 | Always succeeds on first attempt |
+15005550002 | Returns busy on every attempt |
+15005550005 | Always fails permanently |
error_code and error_message fields tell you what went wrong and whether a retry makes sense. See the Error catalog for every error code and its recommended action. The Sandbox guide lists all magic numbers and the scenarios they simulate.
Verify
You have now:- Sent a fax with
POST /faxand an idempotency key. - Polled for status until delivery.
- Received a webhook event and verified its HMAC signature.
- Triggered error scenarios with sandbox magic numbers.
fx_live_...), purchase credits, and use a real E.164 number as the destination.
What to do next
- Webhook signing - replay protection, secret rotation, and verification in other languages.
- Idempotency keys - how keys are stored and matched, TTL behavior, and retry best practices.
- Error catalog - every error code, its trigger, and the recommended action.
- Events schema - all event types and their payload shapes.
- Sandbox - magic numbers, simulated failures, and sandbox behavior.