Sidelatch Docs
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.

Base URLhttps://sidelatch.com

Your 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.

  1. 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"}'
  2. 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>
  3. 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.

Never in the browser.Your page gets a link token instead: single use, tied to one user and one portal, and expired after 10 minutes.

The connect window

link.js opens our sign-in window over your page. The user picks nothing: the link token already names the portal.

OptionDescription
tokenThe 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).

StepWhat the user sees
One-time codeA code field, for authenticator apps, text messages and email.
Delivery methodA choice of where to send the code.
Push approvalA waiting message while they approve on their phone.
Security questionsOne field per question.
Image CAPTCHAThe 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.

OperationParamsReturns
list_policiesPolicy[]
get_policypolicy_numberPolicy
list_commission_statementsCommissionStatement[]
list_claimsClaim[]

Policy

FieldTypeNotes
policy_numberstringThe carrier's policy number.
carrierstringThe carrier's display name.
insured_namestringPerson or business the policy covers.
line_of_businessstringcommercial_auto, general_liability, homeowners, workers_comp, business_owners, or the carrier's own code in lower case.
statusstringPolicy: active, cancelled, expired, pending. Claim: open, closed, denied. unknown if unmapped.
effective_datedateCoverage start.
expiration_datedateCoverage end.
annual_premiumnumberIn dollars.

CommissionStatement

FieldTypeNotes
statement_idstringThe carrier's statement id.
carrierstringThe carrier's display name.
periodstringMonth the statement covers, YYYY-MM.
totalnumberCommission paid on the statement, in dollars.
linesCommissionLine[]One line per policy on the statement.

CommissionLine

FieldTypeNotes
policy_numberstringThe carrier's policy number.
premiumnumberPremium the commission was paid on.
ratenumberCommission rate as a fraction: 0.12 is 12%.
amountnumberCommission paid for this policy.

Claim

FieldTypeNotes
claim_numberstringThe carrier's claim number.
policy_numberstringThe carrier's policy number.
carrierstringThe carrier's display name.
statusstringPolicy: active, cancelled, expired, pending. Claim: open, closed, denied. unknown if unmapped.
loss_datedateDate of loss.
reported_datedateDate the claim was reported.
paid_amountnumberPaid 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.

StatusErrorWhat to do
409reconnect_neededThe 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.
503portal_downThe portal is down or timing out. Retry later.
502schema_driftThe portal changed what it returns. We are alerted and fix the connector.
400bad_paramsYour params don't fit the operation. detail says why.
404unknown_operationThe portal has no such operation.
404not_foundNo such record, or no such connection on your account.
401Missing 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.

EventWhen
connection.connectedA user linked an account, or relinked one (relinked: true).
connection.reconnect_neededThe portal refused the stored login. Ask the user to relink.
connection.deletedA connection was disconnected.
webhook.testYou 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.

PortalTest loginShows
demo_carrieragency1 / pw1The insurance model: policies, commissions, claims.
demoagent1 / pw1A plain portal with listings.
demoagent3 / pw3, code 123456A verification-code sign-in.
demoagent4 / pw4, then code 654321Pick text or email, then enter the code.
demoagent5 / pw5A phone push (the sandbox approves it after 5 seconds).
demoagent6 / pw6, answers rex and chicagoSecurity 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.

NameInTypeDescription
user_idbodystringYour id for the user. Up to 200 characters.
portalbodystringA 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.

NameInTypeDescription
user_id optionalquerystringOnly 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.

NameInTypeDescription
conn_idpathstringThe 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.

NameInTypeDescription
conn_idpathstringThe connection id.
operationbodystringAn operation the portal offers.
params optionalbodyobjectThe 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.

NameInTypeDescription
conn_idpathstringThe 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.

NameInTypeDescription
conn_idpathstringThe 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.

NameInTypeDescription
allowed_origins optionalbodystring[]Up to 20 origins, like https://dash.acme.com.
webhook_url optionalbodystring | nullA 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.

NameInTypeDescription
key_idpathstringThe 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.

NameInTypeDescription
days optionalqueryinteger1 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.

NameInTypeDescription
companybodystringYour company name.
emailbodystringA 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"
  ]
}