Docs

Coverage

Store or replace a patient's primary insurance coverage with one idempotent request.

PUT /coverage/ stores the patient's active primary insurance coverage, where the patient is the policyholder. Each request submits or replaces that one record.

curl -X PUT "$DOCTRONIC_API_URL/coverage/" \
  -H "Authorization: Bearer $DOCTRONIC_API_TOKEN" \
  -H "X-Doctronic-User-ID: $DOCTRONIC_USER_ID" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"payerId": "00590", "payerName": "Example Health Plan", "memberId": "ABC1234567", "groupNumber": "GROUP-42"}'
200 response
{
  "code": "success",
  "message": "Request successful",
  "data": null
}

When to call it

Call it when the patient gives you their insurance details, and again whenever those details change. Before the first call, the user needs firstName, lastName, dateOfBirth, and sex on file; see Users.

X-Doctronic-User-ID selects the patient. Repeated requests update the same record and leave the patient's other coverage records unchanged.

Request fields

Send every required field on every request.

FieldRequiredContents
payerIdYesClaim.MD/EDI payer identifier, supplied or confirmed during integration setup. 1 to 100 characters.
payerNameYesDisplay name of the payer for payerId. 1 to 255 characters.
memberIdYesThe member number on the patient's plan card, not a Doctronic user ID. 1 to 255 characters.
groupNumberNoThe plan's group number, up to 255 characters. Omit it, send null, or send a blank value to clear it.
const baseUrl = process.env.DOCTRONIC_API_URL ?? 'https://staging-partners.doctronic.ai/api/v1';

// Create idempotencyKey once per intended change and reuse it when retrying.
export async function setCoverage(userId: string, idempotencyKey: string) {
  const response = await fetch(`${baseUrl}/coverage/`, {
    method: 'PUT',
    headers: {
      Authorization: `Bearer ${process.env.DOCTRONIC_API_TOKEN}`,
      'X-Doctronic-User-ID': userId,
      'Idempotency-Key': idempotencyKey,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      payerId: '00590',
      payerName: 'Example Health Plan',
      memberId: 'ABC1234567',
      groupNumber: 'GROUP-42',
    }),
  });

  if (!response.ok) {
    const body = await response.json().catch(() => ({}));
    throw new Error(`Coverage update failed: HTTP ${response.status} ${body.code ?? ''}`);
  }
}

Errors

StatusCodeHandling
400error.coverage.missing_patient_demographicsSet firstName, lastName, dateOfBirth, and sex on the user, then retry.
400error.validation_errorFix the fields listed in data.
409, 503NoneIdempotency conflict or coordination failure. See idempotent requests.

401, 403, and the X-Doctronic-User-ID errors mean what they mean on every request; see Authentication.

Idempotency

PUT /coverage/ accepts an Idempotency-Key. Create one key per intended change and reuse it when you retry; the key rules are in idempotent requests.

Limits

The endpoint stores coverage only. It doesn't:

  • Verify eligibility or benefits.
  • Discover a patient's insurance.
  • Return or delete a coverage record.
  • Accept secondary policies, dependents, or effective dates.

On this page