CoiPatrol API

Read your subs and certificates from your own system, add subs, and ask a sub for a missing certificate. JSON in and out. Paid plans.

Authentication

An owner makes the key in Settings, API. It is shown once, so copy it then. Each company has one key. Making a new one or revoking it stops the old one right away. Send it on every request:

Authorization: Bearer cpk_your_key

A missing, wrong or revoked key gets 401. A key from a company now on Free gets 403. The demo's key never works here.

Limits and errors

60 requests a minute per key. Past that you get 429 with a Retry-After header in seconds. Every error is JSON with a message field, like {"message": "name is required."}. Lists come 200 subs a page.

Method and pathWhat it does
GET /api/v1/statusCounts as on the dashboard (green, yellow, red, needs review, held, unassigned), your plan and its sub limit.
GET /api/v1/subsYour active subs with status, next expiry, W-9 on file, whether they meet your requirements and why not, and each current policy. Filters: ?project= (a name, an id, or none) and ?status= (green, yellow, red). Paged with ?page=.
GET /api/v1/subs/{id}One sub, the same fields, plus every certificate uploaded for it with a download URL.
GET /api/v1/certificates/{id}/fileThe certificate PDF. Takes the same Bearer key.
POST /api/v1/subsAdd a sub: name (required), email, trade, project, phone. Same checks and plan limit as the form. Returns the sub and its upload link, status 201.
POST /api/v1/subs/{id}/request-certificateEmails the sub what they owe you: a missing certificate or a renewal that is due. Same as the "Send reminder now" button, at most once a day per sub.

Examples

Status

curl -H "Authorization: Bearer $COIPATROL_KEY" https://app.coipatrol.com/api/v1/status

Subs on one project that are red

curl -H "Authorization: Bearer $COIPATROL_KEY" "https://app.coipatrol.com/api/v1/subs?project=Elm%20Street&status=red"

One sub

curl -H "Authorization: Bearer $COIPATROL_KEY" https://app.coipatrol.com/api/v1/subs/42

A certificate PDF

curl -H "Authorization: Bearer $COIPATROL_KEY" -o certificate.pdf https://app.coipatrol.com/api/v1/certificates/7/file

Add a sub

curl -X POST -H "Authorization: Bearer $COIPATROL_KEY" -H "Content-Type: application/json" \
  -d '{"name": "Oak Framing", "email": "[email protected]", "trade": "Framing", "project": "Elm Street"}' \
  https://app.coipatrol.com/api/v1/subs

Ask a sub for a missing certificate

curl -X POST -H "Authorization: Bearer $COIPATROL_KEY" https://app.coipatrol.com/api/v1/subs/42/request-certificate

Webhooks

To hear about changes as they happen instead of asking, an owner sets a webhook URL in Settings, Webhooks. We post these events as JSON:

  • certificate.filed, certificate.needs_review, certificate.held (the name on it is someone else's): the certificate and its policies.
  • policy.expiring: once when a policy is 30 days out, then once at each of your reminder days. policy.expired: once. Both carry the policy and days left.
  • sub.missing_certificate: the missing insurance types. document.received: the kind and file name, never the file. sub.added.
  • agent.escalated: the sub's insurance agent was emailed after unanswered reminders. Carries the agent's email and what is missing or expired.

Every event has event, id, timestamp, company and, when there is one, sub (id, name, trade, project, email). The header X-CoiPatrol-Signature is sha256= followed by the HMAC-SHA256 of the raw body with your secret, so you can check it came from us.