Skip to content
Hermes Health API
API referenceOpenAPI spec

Guide

Check an authorization with the API

Run the auth check on any document and read the verdicts as JSON.

The auth check reads a signed authorization and reports, item by item, whether it will hold up: the signature, the patient’s name and date of birth, the expiry, the recipient, and more. You can run it on any document, outside any patient or project, and read the result as JSON.

To show the result to your own users, embed the UI instead of rendering this JSON: see Embed the auth-check UI. The JSON schema changes as coverage grows, and the iframe absorbs that.

1. Request an upload URL and token

PUT /v0/auth-check/{filename}, with the patient the document should be for. This body is what produces the embedToken you need in step 3:

Request an upload URL and token
curl
curl https://api.hermeshealth.ai/v0/auth-check/jane-doe-authorization.pdf \
  -X PUT \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "firstName": "Jane",
  "lastName": "Doe",
  "dateOfBirth": "1990-04-12",
  "referenceId": "MRN-00042"
}'
import requests

response = requests.put(
    "https://api.hermeshealth.ai/v0/auth-check/jane-doe-authorization.pdf",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "firstName": "Jane",
        "lastName": "Doe",
        "dateOfBirth": "1990-04-12",
        "referenceId": "MRN-00042",
    },
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.hermeshealth.ai/v0/auth-check/jane-doe-authorization.pdf", {
    method: "PUT",
    headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    body: JSON.stringify({
      "firstName": "Jane",
      "lastName": "Doe",
      "dateOfBirth": "1990-04-12",
      "referenceId": "MRN-00042"
    }),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();

The response carries an uploadUrl, any uploadHeaders to send with it, and the embedToken:

Response (excerpt)
json
{
  "uploadUrl": "https://...",
  "uploadHeaders": {},
  "embedToken": "YOUR_TOKEN"
}

Keep the embedToken. It is required to read the result in step 3, even if you never embed the UI and only read the JSON. It lasts one hour.

The patient details are what the check compares the document against, and they are stored with the submission. Keys are camelCase, and dateOfBirth is YYYY-MM-DD. A body that does not parse returns 400 naming what was wrong.

referenceId is optional: your own identifier for the patient, such as an MRN, of up to 255 characters. It is shown with the submission in the auth-checker’s Submissions tab, so you can match each one back to your patient.

filename names the document among your own uploads. Uploading again under the same name records a new submission.

filename must be one path segment of at most 255 bytes, must not start with a dot, and needs a name before its extension. Anything else returns 400.

If you don’t have the patient’s details yet, send no body. You get an upload URL and embedToken is null, so you must call POST /v0/auth-check/{filename}/embed-token before step 3; see Get a token later.

2. Upload the document

PUT the PDF to uploadUrl as raw bytes, with any uploadHeaders and no Authorization header:

Upload the PDF
curl
curl "UPLOAD_URL" \
  -X PUT \
  --data-binary @jane-doe-authorization.pdf
import requests

with open("jane-doe-authorization.pdf", "rb") as document:
    response = requests.put("UPLOAD_URL", data=document)
response.raise_for_status()
import { readFile } from "node:fs/promises";

const response = await fetch("UPLOAD_URL", {
    method: "PUT",
    body: await readFile("jane-doe-authorization.pdf"),
});
if (!response.ok) throw new Error(`Upload failed: ${response.status}`);

Send the URL exactly as issued. Its signature is in the query string, so changing any part of it returns 403.

The check starts on its own once the upload lands.

3. Read the result

GET /v0/auth-check/{filename}?token=<embedToken>, with the embedToken from step 1 or from Get a token later:

Read the result
curl
curl "https://api.hermeshealth.ai/v0/auth-check/jane-doe-authorization.pdf?token=YOUR_TOKEN" \
  -H "Authorization: Bearer YOUR_API_KEY"
import requests

response = requests.get(
    "https://api.hermeshealth.ai/v0/auth-check/jane-doe-authorization.pdf?token=YOUR_TOKEN",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.hermeshealth.ai/v0/auth-check/jane-doe-authorization.pdf?token=YOUR_TOKEN", {
    method: "GET",
    headers: {
        Authorization: "Bearer YOUR_API_KEY",
    },
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();

token is required. Without it the call returns 400; with an expired or altered token, or one created for a different filename, it returns 401. Each error message says which, so neither is a problem with your API key.

While the check is running, verdicts is null. A check can take a minute or more, so poll every few seconds until verdicts is filled in.

Poll on verdicts, not extraction. extraction can appear, with empty data, before the check has finished.

Response (excerpt)
json
{
  "verdicts": {
    "signature":          { "status": "Passed",  "message": "Signed and dated by the patient.", "basis": "legal" },
    "patientDateOfBirth": { "status": "Failed",  "message": "Date of birth does not match.",     "basis": "legal" },
    "dateOfExpiration":   { "status": "Warning", "message": "Expires in 12 days.",               "basis": "requestCoverage" },
    "datesOfService":     { "status": "Passed",  "message": "Form does not ask for dates of service", "basis": "requestCoverage" }
  },
  "verdictCounts": { "passed": 15, "failed": 1, "warning": 2 },
  "downloadUrl": "https://..."
}
FieldWhat it is
verdictsOne entry per check. Each has a status (Passed, Warning or Failed), a message saying what was found, and a basis naming the kind of requirement (legal, requestCoverage, providerAcceptance or operational).
verdictCountsHow many checks passed, failed or warned.
extractionThe fields read off the document. Its schema changes as coverage grows.
downloadUrlA short-lived link to the uploaded document.

A null verdict means that check did not run, not that it passed. A standalone check has no record request behind it, so datesOfService judges the form on its own: it fails only when the form asks for dates of service and they are left blank.

Get a token later

If you uploaded without the patient’s details, this step is required before you can read the result. It is also how you replace an expired token. Create one with POST /v0/auth-check/{filename}/embed-token, sending the same body: firstName, lastName, dateOfBirth and, optionally, referenceId. The response’s token is used exactly like embedToken. Tokens last one hour.

Sending different details for the same filename corrects the ones stored with the submission.

Run the check again

Upload the document again: repeat steps 1 and 2 under the same filename. That records a new submission, which is checked and billed like the first, and the read in step 3 reports its result. Each file written to an uploadUrl is checked and billed on its own, so write to an uploadUrl once; writing to the same one again starts another check and is billed again.

Delete a submission

DELETE /v0/auth-check/{filename}, with no body, permanently deletes the submission: every stored version of the uploaded document, its analysis, the patient details sent with it, and any other files uploaded under it. It answers 204 and cannot be undone. Afterwards a read of the filename answers 404 and embeds made for it stop loading.

The delete itself charges nothing. Fees already billed for the document stay on your invoices; in place of a download link they carry documentDeletedAt, and their document download answers 410.

A submission whose check is still running cannot be deleted yet: wait until the read in step 3 reports verdicts, then delete it. You can upload under the same filename again afterwards, which starts a new submission.

A submission uploaded before September 2026 also has a copy in a write-protected archive, where it is retained for seven years from upload. Deleting the submission removes everything the API and your users can reach, but not that archived copy.

With a sandbox key

A sandbox API key gets the same responses with nothing behind them. The uploadUrl accepts your file and discards it unread, so it is never analyzed, stored or billed, and the read in step 3 returns a fixed sample analysis of an authorization for the patient John Doe, whatever you uploaded. Deleting succeeds without doing anything. Use a production key to check real documents.

A sandbox uploadUrl answers 413 to a file over 50 MiB, the largest document the analysis accepts, 408 to an upload that stalls or does not finish before the URL expires, and 429 when your company is over its rate limit or too many uploads are already in progress. One upload runs at a time for each filename.

When a request fails

StatusCause
400The filename breaks the naming rules above, the body sent in step 1 does not parse, or the read in step 3 has no token.
401The token is expired, altered, or was created for a different filename. The message says which.
403On the upload: the upload URL was changed.
404On a delete: nothing is stored under that filename for your user.
409On a delete: the submission’s check is still running. Wait for verdicts, then try again.

Next steps