Skip to content
Hermes Health API
API referenceOpenAPI spec

Reference

Fees and quotes

What a billable call will cost before you make it, and how to match each fee you were charged to the call that charged it.

Quoting a call before you make it

To learn what a call will cost before you make it, send the same request with ?quote=true. The body is checked as the call would check it and an error comes back as the call would return it, but nothing is created, changed, charged or sent. The response is a fee quote: one line for each fee the call would charge, saying when it is charged (billedWhen), the least and most it can be (low and high), and in notes why, such as perLastName for a search charged per last name or onlyOnHit for a bundle discount; totalLow and totalHigh add the lines up.

Quote a patient create with Site Sonar on
curl
curl "https://api.hermeshealth.ai/v0/companies/COMPANY_ID/projects/PROJECT_ID/patients?quote=true" \
  -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "firstName": "Jane",
  "lastNames": [
    "Doe"
  ],
  "dateOfBirth": "1990-04-12",
  "sex": "female",
  "zipCodes": [
    "94110"
  ],
  "siteSonar": true
}'
import requests

response = requests.post(
    "https://api.hermeshealth.ai/v0/companies/COMPANY_ID/projects/PROJECT_ID/patients?quote=true",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "firstName": "Jane",
        "lastNames": [
            "Doe",
        ],
        "dateOfBirth": "1990-04-12",
        "sex": "female",
        "zipCodes": [
            "94110",
        ],
        "siteSonar": True,
    },
)
response.raise_for_status()
print(response.json()["totalHigh"])
const response = await fetch("https://api.hermeshealth.ai/v0/companies/COMPANY_ID/projects/PROJECT_ID/patients?quote=true", {
    method: "POST",
    headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    body: JSON.stringify({
      "firstName": "Jane",
      "lastNames": [
        "Doe"
      ],
      "dateOfBirth": "1990-04-12",
      "sex": "female",
      "zipCodes": [
        "94110"
      ],
      "siteSonar": true
    }),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data.totalHigh);

Every route whose reference lists a quote parameter takes one. The value is checked: anything other than true or false, or quote given more than once, is refused with 400. The parameter’s name is not: a misspelt name such as qoute=true is ignored like any other unknown query parameter, and the call is made.

Confirming a quote

A quote carries a confirmationToken. To make the call at no more than the quote’s totalHigh, send the same request again with the token as confirmQuote in place of quote=true:

Create the quoted patient
curl
curl "https://api.hermeshealth.ai/v0/companies/COMPANY_ID/projects/PROJECT_ID/patients?confirmQuote=CONFIRMATION_TOKEN" \
  -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "firstName": "Jane",
  "lastNames": [
    "Doe"
  ],
  "dateOfBirth": "1990-04-12",
  "sex": "female",
  "zipCodes": [
    "94110"
  ],
  "siteSonar": true
}'
import requests

response = requests.post(
    "https://api.hermeshealth.ai/v0/companies/COMPANY_ID/projects/PROJECT_ID/patients?confirmQuote=CONFIRMATION_TOKEN",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "firstName": "Jane",
        "lastNames": [
            "Doe",
        ],
        "dateOfBirth": "1990-04-12",
        "sex": "female",
        "zipCodes": [
            "94110",
        ],
        "siteSonar": True,
    },
)
response.raise_for_status()
print(response.json()["patient"]["searchStatus"])
const response = await fetch("https://api.hermeshealth.ai/v0/companies/COMPANY_ID/projects/PROJECT_ID/patients?confirmQuote=CONFIRMATION_TOKEN", {
    method: "POST",
    headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    body: JSON.stringify({
      "firstName": "Jane",
      "lastNames": [
        "Doe"
      ],
      "dateOfBirth": "1990-04-12",
      "sex": "female",
      "zipCodes": [
        "94110"
      ],
      "siteSonar": true
    }),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data.patient.searchStatus);

The call is made only if the token still fits it, and nothing is created, changed, charged or sent when it does not:

AnswerWhen
400The token was altered or issued to another caller, it was sent together with quote=true, or confirmQuote was given more than once.
409The method, path, query or body differs from the quoted call; the token is more than 15 minutes old; it was already used; or the call would now cost more than the quote’s totalHigh. Quote the call again and confirm the new quote. A 409 saying too many confirmations are outstanding means the call can be confirmed again shortly.

A token is spent once the call starts, so a call that then fails, for example on a 400 the body earns, needs a fresh quote. An API key’s or a signed-in person’s token is spent in memory, so it may be accepted again after a server restart within its 15 minutes; an AI agent’s is recorded against its access and is spent for good.

Confirming is optional for an API key or a signed-in person, who can still make the call without a token. An AI agent must confirm: its billable call without confirmQuote is answered with the quote and is not made.

An AI agent also spends within the allowance the person who connected it chose: a spending budget for the life of its access. An agent connected before the budget replaced the older caps may also carry a most for any one call. A call counts against it at the sum of each quoted fee’s most, with any discount left out (the sum of each line’s high that can be more than zero), until its fees are charged, then at what they come to; a call is allowed only if that sum fits. An agent given no allowance may still call the billable routes its grant holds, but can confirm only a call that charges nothing, such as any call on a sandbox project. A quote the agent could not afford carries no confirmationToken; its confirmationWithheld says why instead. A confirmation that would take the agent past its allowance is answered with 403 and the call is not made. When a confirmed call fails before it records anything, its charges are released just after the error is returned, so a retry sent at once may still find them counted for a moment.

Reconciling search fees

To learn what a search will cost before you request it, see Quoting a call before you make it.

Every fee your company is charged is a row on POST /v0/fees/browse, and GET /v0/fees/{fee_id} reads one by id. Both are read-only and return only the fees your credential can see: your own company’s fees, and for a sandbox API key only the fees on sandbox projects. Use them to match each search you ran to what it was billed.

Each Site Sonar or Patient Histories run for a patient is charged as exactly one fee, and its feeType says what that run found:

feeTypeThe run
PatientHistoriesPlusFound lab results the patient did not already have.
PatientHistoryHitFound no new lab results, but found new diagnoses, procedures or prescription fills. New visits on their own do not count.
PatientHistoryNoHitFound nothing new. A run whose records we withheld because they matched two conflicting identities (searchStatus AmbiguousIdentity) is also charged this tier.
SiteSonarHitFound the patient at one or more facilities.
SiteSonarNoHitFound no facility for the patient.

A Patient Histories tier describes what that run added to the patient’s record, not everything on file. The clinical-data browse routes (POST /v0/lab-results/browse, POST /v0/diagnoses/browse and the rest) return every row the patient has, from every search and every earlier run, so a patient whose lab results arrived on an earlier run can show lab results there while this run is charged PatientHistoryHit or PatientHistoryNoHit. For per-run counts of what was new, see Net-new clinical data.

A run searches every last name on file for the patient and is still charged as a single fee: amount is your per-search rate multiplied by the number of last names searched, so a patient with one previous last name on file is charged twice the rate.

If your company has a clinical data bundle discount, a patient whose Site Sonar run and Patient Histories run both find something earns a ClinicalDataBundleDiscount row with a negative amount. The row is added when the second of the two runs is charged, whether the runs finished together or months apart, and it is never larger than that second run’s fee. A run repeated after both products have already found something on the patient earns no further discount until the other product finds something again. Include these rows when you total what a patient cost.

A fee’s feeType and amount are provisional while its status is pending: Hermes can correct the tier of a pending fee before it is invoiced, and a correction recomputes amount from the last names on file at that time, which can differ from the number the run searched. Treat a pending fee’s values as an estimate and reconcile final figures against fees that carry an invoiceId; re-read pending fees by id rather than relying on the values you saw when the run completed.

The fee is normally recorded before the run is marked finished, so it is usually already on POST /v0/fees/browse when its siteSonar.completed or patientHistories.completed event reaches your endpoint, or when you see the patient’s siteSonar or patientHistories flag clear. To list every Patient Histories fee for one patient, newest first:

Patient Histories fees for one patient
json
{
  "select": {
    "fee": { "id": true, "feeType": true, "amount": true, "createdAt": true }
  },
  "where": {
    "fee": {
      "patientId": [ { "equals": "pat_456" } ],
      "feeType":   [ { "in": ["PatientHistoriesPlus", "PatientHistoryHit", "PatientHistoryNoHit"] } ]
    }
  },
  "orderBy": [
    { "fee": { "createdAt": "desc" } }
  ]
}