Home / Developers

Affirm Core API

Will this be affirmed, and what is missing? The same engine behind AffirmDME, callable from an ERP, an intake platform or your own scripts.

Access

Keys are issued by AffirmDME for one organization after its Business Associate Agreement is signed and the integration partner's agreement is on file. An organization admin requests a key under Settings → Integrations; the key's secret reaches the person who will install it through a one-time link that expires after 24 hours, never by email. The organization's admins see every key there and can revoke it at any time. Not a customer yet? Write to support@affirmdme.com. The steps are in the help article on API access.

Authorization: Bearer adk_…

The flow

  1. GET /api/v1/org for the organization's locations (PTAN, NPI, jurisdiction, DME MAC).
  2. POST /api/v1/cases with the beneficiary, the ordering practitioner and the HCPCS items.
  3. POST /api/v1/upload-url, PUT the PDF to the returned URL, then POST /api/v1/documents/{documentId}/process.
  4. GET /api/v1/cases/{caseId}/checklist — every coverage criterion MET, MISSING or FLAGGED, with what the record still has to say; /findings for the model's rationale and evidence.
  5. POST /api/v1/cases/{caseId}/submit, then PATCH the decision when the MAC answers.

Webhooks

An organization's admins register HTTPS endpoints for case.status_changed, checklist.rebuilt and decision.recorded. Each delivery is a POST with X-AffirmDME-Signature: t=<unix seconds>,v1=<hex> where v1 = HMAC-SHA256(secret, t + "." + body); reject timestamps older than five minutes. Failed deliveries retry after 1, 5 and 15 minutes. Payloads carry case identifiers and statuses, never patient details.

import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(secret, header, rawBody) {
  const { t, v1 } = Object.fromEntries(header.split(",").map((kv) => kv.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
  const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  return expected.length === v1.length && timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}

Reference

The OpenAPI 3.1 document is served by the API itself and is the source of truth for paths, request bodies and responses: https://api.affirmdme.com/api/v1/openapi.json.