Quickstart
This guide runs entirely in the sandbox. Nothing is emailed, no one is called, and nothing is charged. Every step is a plain HTTP request; copy them in order. You need curl and, for readability, jq.
What you’ll build: a subcontractor, a certificate of insurance (COI) uploaded for it, TradeGuard’s verdict on that COI, and a webhook delivered to your endpoint when the verdict changes.
1. Get a sandbox API key
- Sign in to the TradeGuard dashboard and open Settings → API Keys.
- Turn on Sandbox mode. An orange banner confirms you’re in the sandbox. The first time, this creates your organization’s sandbox, with its own data and a default compliance profile.
- Click Create API key and give it a name. For this guide, select every scope. Copy the secret (
ak_…); it is shown once.
Set it and the base URL in your shell:
There is one host for production and sandbox. The key decides which environment you reach.
Check the key works and that you’re in the sandbox:
If you see "environment": "production", the key was created outside Sandbox mode. Create a new one with Sandbox mode on.
2. Point a webhook at a URL you can watch
TradeGuard pushes results to you as webhooks. Webhook endpoints are set up in the dashboard, not through the API. With Sandbox mode still on, open Settings → Webhooks, then:
- Click Add Endpoint.
- For Endpoint URL, paste a URL you can watch. For a first run a free request inspector works: open webhook.site and copy “Your unique URL”.
- Under events, subscribe to
compliance.status_changed(or leave all selected) and create the endpoint.
Prefer the terminal? POST /v1/webhooks/portal returns a short-lived link to the same portal (the key needs the webhooks:write scope): curl -s -X POST "$TG/v1/webhooks/portal" -H "Authorization: Bearer $TG_KEY" | jq -r '.data.url // .error' (without that scope it prints the 403 error instead of a link)
3. Create a subcontractor
The subcontractor is enrolled in your organization and attached to your default compliance profile. In a new sandbox that profile is Sandbox Standard Requirements: a General Liability COI with 2M aggregate, and an additional-insured endorsement. Nothing has been uploaded yet, so its record reads pending with the reason Awaiting document. No issue is opened for a requirement that is still awaiting its first document:
(If statusReason is still empty, the first compliance run hasn’t finished. Wait a second and run it again.)
The email and phone above are made unique with the current time. Subcontractors are matched by email and phone, so reusing them returns 409 subcontractor_match with the existing record’s id in details; send that id as existingSubcontractorId to add it.
4. Upload a certificate of insurance
The sandbox doesn’t read real documents; it reads sample documents, test certificates with known outcomes. Each one is made for the subcontractor you ask for: it prints that sub’s name and address and dates counted from today. Download the one that passes every check:
Upload it for your subcontractor:
TradeGuard now works in the background:
- It validates the document and extracts the policy details.
- It checks them against the requirement.
- It verifies the policy with the insurance broker. In the sandbox that call is simulated; the sample’s broker phone number,
(202) 555-0100, always confirms the policy.
5. Read the verdict
Poll the subcontractor’s compliance until the status settles. It usually takes well under a minute:
You’ll see pending (the document is being processed), then compliant_pending_verification (the document passes, and broker verification is under way), then compliant.
6. See the webhook
Back in your request inspector, you’ll find a compliance.status_changed delivery for each status change on the way to compliant. The last one looks like this:
In your own endpoint, verify the signature before trusting a delivery. Every request carries svix-id, svix-timestamp and svix-signature headers; see Verifying signatures.
That’s a working integration. Your system created a subcontractor, submitted its COI, and got the verdict pushed to it.
7. Try the other outcomes
List every sample and what it demonstrates:
Repeat steps 3–5 with a new subcontractor for each sample, replacing coi-compliant with its key:
Uploading the same file twice for the same subcontractor returns the existing document (TradeGuard deduplicates identical content). Use a new subcontractor per sample.
Next steps
- Onboarding Guide: the concepts behind what you just did: profiles, requirements, coverages, compliance runs.
- Sandbox Guide: every sample document (COIs, W-9s, OSHA cards and more), magic broker phone numbers, and simulating verification outcomes directly.
- Errors & Rate Limits: error codes and the 100 requests/minute limit.
- API Reference: every endpoint, with a request builder.
- Going live: turn Sandbox mode off, create a production key, and swap it in. It’s the same host and the same API.
