Contents
Sidelatch docs
Read portal data through one API.
Your users link their logins to portals that have no API. You read their data with named operations that return the same validated JSON from every portal, and a webhook tells you when a connection needs the user again.
https://sidelatch.comYour backend holds the API key. Your page only ever sees a short-lived link token. Passwords go from the user straight into our connect window, are encrypted with a key derived for your account, and are never returned by the API.
Quick start
Get a free sandbox key on the home page, then link the Demo Carrier with the test login
agency1 / pw1.
- Create a link token on your backend.
Shellcurl -X POST https://sidelatch.com/v1/link-tokens \ -H "X-API-Key: $SIDELATCH_API_KEY" -H "Content-Type: application/json" \ -d '{"user_id": "agency-42", "portal": "demo_carrier"}' - Open the connect window on your page.
HTML<script src="https://sidelatch.com/link.js"></script> <script> Sidelatch.create({ token: linkToken, onSuccess(connectionId, meta) { /* send connectionId to your backend and save it */ }, onExit(error) { /* the user closed the window */ }, }).open(); </script> - Read their data from your backend.
Shellcurl -X POST https://sidelatch.com/v1/connections/$CONNECTION_ID/run \ -H "X-API-Key: $SIDELATCH_API_KEY" -H "Content-Type: application/json" \ -d '{"operation": "list_policies"}'
Authentication
Send your API key in the X-API-Key header on every /v1 call. Keys start with
pc_, are stored only as a hash, and reach only your own account's connections.
To rotate without downtime: create a new key with POST /v1/api-keys
or in the console, deploy it, then revoke the old one.
The connect window
link.js opens our sign-in window over your page. The user picks nothing: the link token already
names the portal.
| Option | Description |
|---|---|
token | The link token from your backend. |
onSuccess(connectionId, meta) | The account is linked. Save connectionId on your backend; meta.portal names the portal. |
onExit(error) | The user closed the window. error is null unless something failed. |
Verification steps (MFA, CAPTCHAs)
When a portal asks the user to prove who they are, the window shows that step to the user and passes their answer to the portal. Steps can follow one another (pick a phone, then type the code).
| Step | What the user sees |
|---|---|
| One-time code | A code field, for authenticator apps, text messages and email. |
| Delivery method | A choice of where to send the code. |
| Push approval | A waiting message while they approve on their phone. |
| Security questions | One field per question. |
| Image CAPTCHA | The portal's image and a field to type it. |
The user always answers these themselves; we never solve a challenge automatically. Widget checks such as
reCAPTCHA, hCaptcha or Turnstile only work on the portal's own site, so the window explains that sign-in is
blocked there instead. Trusted-device cookies are kept encrypted, so later sign-ins usually skip the step.
When a background re-login meets a step, the connection moves to reconnect_needed and you get
the connection.reconnect_needed webhook; we do not keep retrying it.
Relinking
Create a link token for the same user_id and portal and open the window again. The connection id
doesn't change, so nothing on your side needs updating.
Allowed origins
Set allowed_origins in settings and only those pages can embed
the window or hear its result. Leave it empty while developing.
Reading data
Call run with an operation name.
GET /v1/portals lists each portal's operations and example params.
Results are validated before you get them, so a changed portal shows up as an error, never as bad data.
Sessions are kept warm between calls. If the portal has logged the user out, we sign in again from the vault before running your call.
Insurance model
Every insurance carrier returns these shapes, whatever the carrier's own portal calls its fields.
| Operation | Params | Returns |
|---|---|---|
list_policies | Policy[] | |
get_policy | policy_number | Policy |
list_commission_statements | CommissionStatement[] | |
list_claims | Claim[] |
Policy
| Field | Type | Notes |
|---|---|---|
policy_number | string | The carrier's policy number. |
carrier | string | The carrier's display name. |
insured_name | string | Person or business the policy covers. |
line_of_business | string | commercial_auto, general_liability, homeowners, workers_comp, business_owners, or the carrier's own code in lower case. |
status | string | Policy: active, cancelled, expired, pending. Claim: open, closed, denied. unknown if unmapped. |
effective_date | date | Coverage start. |
expiration_date | date | Coverage end. |
annual_premium | number | In dollars. |
CommissionStatement
| Field | Type | Notes |
|---|---|---|
statement_id | string | The carrier's statement id. |
carrier | string | The carrier's display name. |
period | string | Month the statement covers, YYYY-MM. |
total | number | Commission paid on the statement, in dollars. |
lines | CommissionLine[] | One line per policy on the statement. |
CommissionLine
| Field | Type | Notes |
|---|---|---|
policy_number | string | The carrier's policy number. |
premium | number | Premium the commission was paid on. |
rate | number | Commission rate as a fraction: 0.12 is 12%. |
amount | number | Commission paid for this policy. |
Claim
| Field | Type | Notes |
|---|---|---|
claim_number | string | The carrier's claim number. |
policy_number | string | The carrier's policy number. |
carrier | string | The carrier's display name. |
status | string | Policy: active, cancelled, expired, pending. Claim: open, closed, denied. unknown if unmapped. |
loss_date | date | Date of loss. |
reported_date | date | Date the claim was reported. |
paid_amount | number | Paid so far, in dollars. |
Errors
Errors from run come back as {"error": "..."} with one of these codes, so you can
tell whose move it is.
| Status | Error | What to do |
|---|---|---|
| 409 | reconnect_needed | The user's password changed or the portal refused the login. Create a link token for the same user and portal and open the connect window again. The connection id stays the same. |
| 503 | portal_down | The portal is down or timing out. Retry later. |
| 502 | schema_drift | The portal changed what it returns. We are alerted and fix the connector. |
| 400 | bad_params | Your params don't fit the operation. detail says why. |
| 404 | unknown_operation | The portal has no such operation. |
| 404 | not_found | No such record, or no such connection on your account. |
| 401 | Missing or unknown API key. |
Webhooks
Set webhook_url in settings and we POST these events.
Payloads carry ids and statuses only, never portal data or credentials.
| Event | When |
|---|---|
connection.connected | A user linked an account, or relinked one (relinked: true). |
connection.reconnect_needed | The portal refused the stored login. Ask the user to relink. |
connection.deleted | A connection was disconnected. |
webhook.test | You sent a test from the console or the API. |
Event body{ "id": "evt_1f0c...", "type": "connection.reconnect_needed", "created": 1795700000, "data": { "connection_id": "conn_8f2c41d07a9b4e6f", "user_id": "agency-42", "portal": "demo_carrier", "status": "reconnect_needed" } }
Verify the signature
Every request has a Sidelatch-Signature: t=<unix time>,v1=<hex> header: an
HMAC-SHA256 of "<t>.<raw body>" keyed with your webhook secret. Reject anything older
than five minutes. Failed deliveries are retried after 5 seconds, 30 seconds and 2 minutes.
Pythonimport hashlib, hmac, time
def verify(secret: str, header: str, body: bytes) -> bool:
"""header is the Sidelatch-Signature value; body is the raw request body."""
parts = dict(p.split("=", 1) for p in header.split(","))
if abs(time.time() - int(parts["t"])) > 300:
return False
expected = hmac.new(secret.encode(), f"{parts['t']}.".encode() + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])
Node.jsimport crypto from "node:crypto";
export function verify(secret, header, rawBody) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}
Sandbox
Sandbox accounts can link the sandbox portals only. Live portals need a live plan; we'll reach you at your signup email.
| Portal | Test login | Shows |
|---|---|---|
demo_carrier | agency1 / pw1 | The insurance model: policies, commissions, claims. |
demo | agent1 / pw1 | A plain portal with listings. |
demo | agent3 / pw3, code 123456 | A verification-code sign-in. |
demo | agent4 / pw4, then code 654321 | Pick text or email, then enter the code. |
demo | agent5 / pw5 | A phone push (the sandbox approves it after 5 seconds). |
demo | agent6 / pw6, answers rex and chicago | Security questions. |
API reference
Endpoints
Every endpoint takes and returns JSON. Want to try calls in the browser? Use the
interactive explorer or fetch openapi.json.
Portals
GET/v1/portals
List portals. Every portal you can connect to, its operations with example params, and its health over the last 24 hours.
RequestGET /v1/portals X-API-Key: pc_...
Response 200{ "portals": [ { "portal": "demo_carrier", "display_name": "Demo Carrier", "sandbox": true, "health": { "status": "healthy", "canaries_24h": 12, "results_24h": { "ok": 12 } }, "operations": [ { "operation": "list_policies", "example_params": {} }, { "operation": "get_policy", "example_params": { "policy_number": "CA-100231" } } ] } ] }
Linking
POST/v1/link-tokens
Create a link token. A single-use token that lets one of your users link one portal. It expires in 10 minutes and is safe to send to the browser.
| Name | In | Type | Description |
|---|---|---|---|
user_id | body | string | Your id for the user. Up to 200 characters. |
portal | body | string | A portal name from /v1/portals. |
RequestPOST /v1/link-tokens X-API-Key: pc_... { "user_id": "agency-42", "portal": "demo_carrier" }
Response 200{ "link_token": "gAAAAABn...", "expires_in": 600 }
404 for an unknown portal. 403 when a sandbox account asks for a live portal.
Connections
GET/v1/connections
List connections. Every account your users have linked, newest last.
| Name | In | Type | Description |
|---|---|---|---|
user_id optional | query | string | Only this user's connections. |
RequestGET /v1/connections X-API-Key: pc_...
Response 200{ "connections": [ { "connection_id": "conn_8f2c41d07a9b4e6f", "user_id": "agency-42", "portal": "demo_carrier", "status": "connected", "created_at": 1795700000.0 } ] }
GET/v1/connections/{conn_id}
Get a connection. One connection and its status.
| Name | In | Type | Description |
|---|---|---|---|
conn_id | path | string | The connection id. |
RequestGET /v1/connections/{conn_id} X-API-Key: pc_...
Response 200{ "connection_id": "conn_8f2c41d07a9b4e6f", "user_id": "agency-42", "portal": "demo_carrier", "status": "connected" }
POST/v1/connections/{conn_id}/run
Run an operation. Read data through a connection. If the portal has logged the user out, we sign in again first.
| Name | In | Type | Description |
|---|---|---|---|
conn_id | path | string | The connection id. |
operation | body | string | An operation the portal offers. |
params optional | body | object | The operation's parameters. |
RequestPOST /v1/connections/{conn_id}/run X-API-Key: pc_... { "operation": "get_policy", "params": { "policy_number": "CA-100231" } }
Response 200{ "data": { "policy_number": "CA-100231", "carrier": "Demo Carrier", "insured_name": "Riverside Plumbing LLC", "line_of_business": "commercial_auto", "status": "active", "effective_date": "2026-03-01", "expiration_date": "2027-03-01", "annual_premium": 18450.0 } }
Failures use the codes in Errors.
POST/v1/connections/{conn_id}/canary
Check a connection. Runs the portal's health check on one connection. Always returns 200; the outcome is in result.
| Name | In | Type | Description |
|---|---|---|---|
conn_id | path | string | The connection id. |
RequestPOST /v1/connections/{conn_id}/canary X-API-Key: pc_...
Response 200{ "portal": "demo_carrier", "result": "ok" }
DELETE/v1/connections/{conn_id}
Disconnect. Deletes the stored login and sends connection.deleted.
| Name | In | Type | Description |
|---|---|---|---|
conn_id | path | string | The connection id. |
RequestDELETE /v1/connections/{conn_id} X-API-Key: pc_...
Response 200{ "status": "disconnected" }
Account
GET/v1/settings
Get settings. Your plan, allowed origins and webhook.
RequestGET /v1/settings X-API-Key: pc_...
Response 200{ "customer_id": "cus_3k9w2m", "name": "Acme Agency Software", "plan": "sandbox", "allowed_origins": [ "https://dash.acme.com" ], "webhook_url": "https://api.acme.com/hooks/sidelatch", "webhook_secret": "whsec_..." }
PATCH/v1/settings
Update settings. Send only the fields you are changing. Saving a webhook URL for the first time creates a signing secret.
| Name | In | Type | Description |
|---|---|---|---|
allowed_origins optional | body | string[] | Up to 20 origins, like https://dash.acme.com. |
webhook_url optional | body | string | null | A public https:// URL, or null to turn webhooks off. |
RequestPATCH /v1/settings X-API-Key: pc_... { "allowed_origins": [ "https://dash.acme.com" ], "webhook_url": "https://api.acme.com/hooks/sidelatch" }
Response 200{ "customer_id": "cus_3k9w2m", "name": "Acme Agency Software", "plan": "sandbox", "allowed_origins": [ "https://dash.acme.com" ], "webhook_url": "https://api.acme.com/hooks/sidelatch", "webhook_secret": "whsec_..." }
POST/v1/settings/webhook-secret
Rotate the webhook secret. Signs every later event with a new secret. Update your handler right after.
RequestPOST /v1/settings/webhook-secret X-API-Key: pc_...
Response 200{ "webhook_secret": "whsec_..." }
GET/v1/api-keys
List API keys. Keys are shown by their last four characters.
RequestGET /v1/api-keys X-API-Key: pc_...
Response 200{ "api_keys": [ { "id": "key_5d1e0c7a9f3b", "hint": "x7Qa", "created_at": 1795700000.0, "revoked_at": null } ] }
POST/v1/api-keys
Create an API key. Returns the new key once. Switch your backend to it, then revoke the old one.
RequestPOST /v1/api-keys X-API-Key: pc_...
Response 200{ "id": "key_9a8b7c6d5e4f", "api_key": "pc_..." }
DELETE/v1/api-keys/{key_id}
Revoke an API key. The key stops working immediately.
| Name | In | Type | Description |
|---|---|---|---|
key_id | path | string | The key id from the list. |
RequestDELETE /v1/api-keys/{key_id} X-API-Key: pc_...
Response 200{ "status": "revoked" }
GET/v1/usage
Usage. Calls per day, portal, action and outcome, and your connection counts by status.
| Name | In | Type | Description |
|---|---|---|---|
days optional | query | integer | 1 to 365. Defaults to 30. |
RequestGET /v1/usage X-API-Key: pc_...
Response 200{ "days": 30, "calls": [ { "day": "2026-11-26", "portal": "demo_carrier", "action": "list_policies", "outcome": "ok", "count": 42 } ], "connections": [ { "portal": "demo_carrier", "status": "connected", "count": 3 } ] }
Webhooks
POST/v1/webhooks/test
Send a test event. Queues a webhook.test event to your webhook URL.
RequestPOST /v1/webhooks/test X-API-Key: pc_...
Response 200{ "status": "queued" }
400 if no webhook URL is set.
Signup
POST/v1/signupNo API key
Create a sandbox account. No API key needed. Returns the account's first key, once.
| Name | In | Type | Description |
|---|---|---|---|
company | body | string | Your company name. |
email | body | string | A work email we can reach you at. |
RequestPOST /v1/signup { "company": "Acme Agency Software", "email": "dev@acme.com" }
Response 200{ "customer_id": "cus_3k9w2m", "plan": "sandbox", "api_key": "pc_...", "sandbox_portals": [ "demo", "demo_carrier" ] }
429 when signups are busy; try again in an hour.
Service
GET/healthNo API key
Health. Liveness check. No API key needed. A human view is at /status.
RequestGET /health
Response 200{ "status": "ok", "portals": [ "bleachernotes", "demo", "demo_carrier" ] }