{
  "openapi": "3.1.0",
  "info": {
    "title": "MedBillAnalyzer",
    "version": "1.0.0",
    "summary": "Check a medical bill against the insurer\u2019s Explanation of Benefits.",
    "description": "MedBillAnalyzer reconciles a medical bill against the Explanation of Benefits the patient\u2019s plan issued for the same care, line by line, and reports where the two disagree.\n\nTwo things are worth knowing before you call it.\n\n**The comparison is not done by a model.** A reader transcribes what is printed on the documents; fixed, deterministic rules decide what it means. The same documents always produce the same findings, and every finding names the rule that produced it.\n\n**Never add the findings together.** `amount_in_question_cents` is already the de-duplicated total. Two findings routinely describe the same dollars from different angles \u2014 a line billed above the contracted rate is usually also part of a bill that asks for more than the plan says is owed \u2014 so summing them overstates the problem, in a letter the patient signs and sends.\n\n**A clean result is not always an all-clear.** `how_completely_we_checked` is `partial` when the comparison could not be finished \u2014 no Explanation of Benefits, or fields the reader could not make out. A `partial` scan that found nothing means nobody looked, not that the bill is right, and telling the patient otherwise is how they end up paying a bill they could have disputed. When `you_can` is present, use it as written.\n\n**Checking a bill takes time.** `check_medical_bill` reads the documents with a model and usually answers in 10\u201330 seconds, longer for a long itemized statement. Set a timeout of at least three minutes. Do not retry `check_medical_bill` automatically on a timeout: every call creates a new case and reads the documents again. The other operations answer immediately.\n\n**There is no API key.** A case is reached by its id, which is 128 random bits and is issued only to whoever created it; treat it as a credential and do not log it. Deleting needs a second credential, below.\n\n**Keep `delete_token`.** It comes back once, at creation, and only its digest is stored \u2014 it cannot be looked up or resent. Without it the case can only be waited out or removed by support.\n\nThis is not legal, medical, or financial advice. This report compares documents you supplied and helps you ask questions about them.",
    "contact": {
      "email": "support@medbillanalyzer.com",
      "url": "https://medbillanalyzer.com"
    }
  },
  "servers": [
    {
      "url": "https://app.medbillanalyzer.com"
    }
  ],
  "paths": {
    "/v1/cases": {
      "post": {
        "operationId": "check_medical_bill",
        "summary": "Check a medical bill against its Explanation of Benefits",
        "description": "Compare a medical bill against the Explanation of Benefits the patient\u2019s insurer issued for the same care, and report where the two disagree. Use when someone shares a medical bill, hospital statement, doctor bill, lab bill or EOB and asks whether it is correct, what they actually owe, or how to dispute it. The bill is required; the EOB is strongly recommended and is what makes most of the checks possible. If you can see the documents but cannot attach their bytes, transcribe them into `bill` and `eobs` exactly as printed. Free: returns a summary and the title of every finding, but not the detail behind them.\n\n**Access: Write.** Creates a case from the documents and keeps it for 30 days. Charges nothing.",
        "x-access": "write",
        "responses": {
          "200": {
            "description": "The case summary, and the findings once unlocked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "case_id": {
                      "type": "string"
                    },
                    "documents": {
                      "type": "string",
                      "description": "Which documents the check ran against."
                    },
                    "findings": {
                      "description": "The number of findings until the case is unlocked; the findings themselves \u2014 an array of Finding \u2014 once it is. The free tier deliberately carries the count and not the detail.",
                      "oneOf": [
                        {
                          "type": "integer"
                        },
                        {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Finding"
                          }
                        }
                      ]
                    },
                    "what_we_found": {
                      "type": "array",
                      "description": "The free preview: one entry per finding, carrying only what it is about. Present while the case is locked, and absent once it is unlocked \u2014 at that point `findings` holds the same list with the detail attached. Show these titles to the patient before offering the unlock; they are what makes the offer legible. They are **not** a probability that the bill is wrong: use `tier` for that, and see its description.",
                      "items": {
                        "$ref": "#/components/schemas/FindingPreview"
                      }
                    },
                    "discrepancies": {
                      "type": "integer"
                    },
                    "worth_asking_about": {
                      "type": "integer"
                    },
                    "flagged_without_an_amount": {
                      "type": "integer"
                    },
                    "amount_in_question": {
                      "type": "string",
                      "description": "Formatted, e.g. \"$657.20\"."
                    },
                    "amount_in_question_cents": {
                      "type": "integer",
                      "description": "The same figure in cents. **Do not add this to anything.** It is already de-duplicated: two findings routinely describe the same dollars at different altitudes, so the total is the larger of the document-level and per-line views, never the sum of the findings."
                    },
                    "entitled": {
                      "type": "boolean",
                      "description": "Whether the full findings have been unlocked."
                    },
                    "for_sale": {
                      "type": "boolean",
                      "description": "Whether unlock_case would sell this case now."
                    },
                    "nothing_to_act_on": {
                      "type": "boolean",
                      "description": "True when the case has findings but none of them is something to act on: the only finding is that no Explanation of Benefits was supplied, or that the plan says the patient may owe more than the bill asks. Such a case is not for sale; `you_can` says what to do instead."
                    },
                    "purchase": {
                      "type": "object",
                      "description": "Present only when `for_sale` is true: the purchase, stated before anything is bought \u2014 who sells it, each option's price, whether it recurs, its terms and its refund policy. `stripe_profile` is the Stripe profile a Shared Payment Token for unlock_case is granted to; it is present only when paying with one is switched on.",
                      "properties": {
                        "seller": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string",
                          "description": "ISO 4217, lower case: \"usd\"."
                        },
                        "support": {
                          "type": "string"
                        },
                        "terms_url": {
                          "type": "string"
                        },
                        "stripe_profile": {
                          "type": "string",
                          "description": "A Stripe profile id, profile_\u2026."
                        },
                        "options": {
                          "type": "array",
                          "description": "Every option on sale for this case now. `one_bill` is always first. `subscription`, the monthly membership, is listed only while it is sold to new members.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "plan": {
                                "type": "string",
                                "enum": [
                                  "one_bill",
                                  "subscription"
                                ]
                              },
                              "amount_cents": {
                                "type": "integer"
                              },
                              "recurring": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "monthly"
                                    ]
                                  },
                                  {
                                    "type": "boolean",
                                    "enum": [
                                      false
                                    ]
                                  }
                                ]
                              },
                              "terms": {
                                "type": "string"
                              },
                              "refund_policy": {
                                "type": "string"
                              },
                              "pay_with_shared_payment_token": {
                                "type": "boolean",
                                "description": "Whether unlock_case takes a shared_payment_token for this option."
                              }
                            }
                          }
                        }
                      }
                    },
                    "fields_we_could_not_read": {
                      "type": "integer"
                    },
                    "how_completely_we_checked": {
                      "type": "string",
                      "enum": [
                        "checked",
                        "partial"
                      ],
                      "description": "`partial` means the comparison could not be finished \u2014 no Explanation of Benefits was supplied, or fields could not be read. A `partial` scan that found nothing does **not** mean the bill is correct, and must never be presented to the patient as an all-clear. Use `you_can` verbatim when it is present; it is already worded for this distinction."
                    },
                    "you_can": {
                      "type": "string",
                      "description": "Present only when nothing was found. The patient-facing sentence for that result, worded to match `how_completely_we_checked`."
                    },
                    "delete_token": {
                      "type": "string",
                      "description": "Returned **once**, here, and never again \u2014 only its digest is stored. It is required to delete the case, and deleting is deliberately a different capability from reading: a case link can end up in a browser history or a forwarded message. Keep it with the case id, or the case can only be waited out (30 days) or removed by support. Do not show it to the patient: offer to delete the case for them, and call delete_case with it when they ask."
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "next_step": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request cannot be used as sent. Change it rather than retrying it. `error.code`: `missing_bill`, `mixed_document_forms`, `document_not_fetched`, `no_such_upload`, `wrong_document_kind`, `too_many_lines`, `too_many_documents`, `bad_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than we accept. `error.code`: `too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "We cannot read that kind of file, or the request body was not sent with `Content-Type: application/json`. `error.code`: `unsupported_document`, `unsupported_media_type`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The document could not be read well enough to check. `error.code`: `unusable_bill`, `unusable_eob`, `unrelated_documents`, `illegible`, `document_too_long`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait for `Retry-After` and try again. `error.code`: `rate_limited`, `too_many_requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Not the caller\u2019s fault. `error.code`: `auth_failed`, `internal`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "A dependency (the payment processor, the document reader) answered badly. `error.code`: `bad_response`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A dependency is unavailable, or the feature is not switched on for this deployment. `error.code`: `extraction_not_configured`, `budget_exhausted`, `service_unavailable`, `network`, `busy`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Reading the document took too long. A PDF reads faster than a photo. `error.code`: `timeout`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "anyOf": [
                  {
                    "required": [
                      "bill"
                    ]
                  },
                  {
                    "required": [
                      "bill_document"
                    ]
                  }
                ],
                "properties": {
                  "bill_document": {
                    "type": "object",
                    "description": "The bill as a file, read for you. Use this when you have the document itself \u2014 a photo, a scan, or a PDF from the provider\u2019s portal. Send it one of three ways: `data_base64` if you have the bytes; `upload_id` if the patient has to fetch the file themselves \u2014 reserve a slot with `POST /v1/uploads` and PUT the file there first; `url` if you only have a public https link. Send exactly one; if more than one is present, `data_base64` wins, then `upload_id`, then `url`. None of them is a promise the file is readable; that is decided from the bytes after they arrive.",
                    "anyOf": [
                      {
                        "required": [
                          "data_base64"
                        ]
                      },
                      {
                        "required": [
                          "url"
                        ]
                      },
                      {
                        "required": [
                          "upload_id"
                        ]
                      }
                    ],
                    "properties": {
                      "data_base64": {
                        "type": "string",
                        "description": "The file itself, base64-encoded. PDF, JPEG, PNG or WebP. The media type is read from the bytes rather than taken on trust, so it does not need to be declared \u2014 and a request claiming \"application/pdf\" over a JPEG would otherwise reach the reader as the wrong kind of thing."
                      },
                      "url": {
                        "type": "string",
                        "format": "uri",
                        "description": "An https link to the file, which this service retrieves. Use it when you have a link rather than the bytes. Must be https and must resolve to a public address: links to private, loopback or link-local addresses are refused, including after a redirect, and so are links carrying credentials. At most 3 redirects, 12 MB, 20 seconds. A link behind a login will not work \u2014 this service sends no cookies and no credentials of any kind \u2014 so for an Explanation of Benefits inside an insurer portal, the patient has to download it and send the bytes."
                      },
                      "upload_id": {
                        "type": "string",
                        "description": "A slot from `POST /v1/uploads` that the file has already been PUT into. Use this when you can neither attach the bytes nor give a link this service can follow \u2014 above all for an Explanation of Benefits inside an insurer portal, where the patient has to sign in and download it themselves. The id is good for one file and 15 minutes, and the bytes are held in memory only."
                      },
                      "filename": {
                        "type": "string",
                        "description": "Optional, for your own logs. Not used."
                      }
                    }
                  },
                  "eob_document": {
                    "type": "object",
                    "description": "The Explanation of Benefits as a file, read for you. It usually sits behind the insurer\u2019s login, which is what `upload_id` is for. When the bill covers more than one visit or claim there is usually one EOB per claim: send the rest in `eob_documents`. Send it one of three ways: `data_base64` if you have the bytes; `upload_id` if the patient has to fetch the file themselves \u2014 reserve a slot with `POST /v1/uploads` and PUT the file there first; `url` if you only have a public https link. Send exactly one; if more than one is present, `data_base64` wins, then `upload_id`, then `url`. None of them is a promise the file is readable; that is decided from the bytes after they arrive.",
                    "anyOf": [
                      {
                        "required": [
                          "data_base64"
                        ]
                      },
                      {
                        "required": [
                          "url"
                        ]
                      },
                      {
                        "required": [
                          "upload_id"
                        ]
                      }
                    ],
                    "properties": {
                      "data_base64": {
                        "type": "string",
                        "description": "The file itself, base64-encoded. PDF, JPEG, PNG or WebP. The media type is read from the bytes rather than taken on trust, so it does not need to be declared \u2014 and a request claiming \"application/pdf\" over a JPEG would otherwise reach the reader as the wrong kind of thing."
                      },
                      "url": {
                        "type": "string",
                        "format": "uri",
                        "description": "An https link to the file, which this service retrieves. Use it when you have a link rather than the bytes. Must be https and must resolve to a public address: links to private, loopback or link-local addresses are refused, including after a redirect, and so are links carrying credentials. At most 3 redirects, 12 MB, 20 seconds. A link behind a login will not work \u2014 this service sends no cookies and no credentials of any kind \u2014 so for an Explanation of Benefits inside an insurer portal, the patient has to download it and send the bytes."
                      },
                      "upload_id": {
                        "type": "string",
                        "description": "A slot from `POST /v1/uploads` that the file has already been PUT into. Use this when you can neither attach the bytes nor give a link this service can follow \u2014 above all for an Explanation of Benefits inside an insurer portal, where the patient has to sign in and download it themselves. The id is good for one file and 15 minutes, and the bytes are held in memory only."
                      },
                      "filename": {
                        "type": "string",
                        "description": "Optional, for your own logs. Not used."
                      }
                    }
                  },
                  "eob_documents": {
                    "type": "array",
                    "maxItems": 4,
                    "items": {
                      "type": "object",
                      "description": "A document. Send it one of three ways: `data_base64` if you have the bytes; `upload_id` if the patient has to fetch the file themselves \u2014 reserve a slot with `POST /v1/uploads` and PUT the file there first; `url` if you only have a public https link. Send exactly one; if more than one is present, `data_base64` wins, then `upload_id`, then `url`. None of them is a promise the file is readable; that is decided from the bytes after they arrive.",
                      "anyOf": [
                        {
                          "required": [
                            "data_base64"
                          ]
                        },
                        {
                          "required": [
                            "url"
                          ]
                        },
                        {
                          "required": [
                            "upload_id"
                          ]
                        }
                      ],
                      "properties": {
                        "data_base64": {
                          "type": "string",
                          "description": "The file itself, base64-encoded. PDF, JPEG, PNG or WebP. The media type is read from the bytes rather than taken on trust, so it does not need to be declared \u2014 and a request claiming \"application/pdf\" over a JPEG would otherwise reach the reader as the wrong kind of thing."
                        },
                        "url": {
                          "type": "string",
                          "format": "uri",
                          "description": "An https link to the file, which this service retrieves. Use it when you have a link rather than the bytes. Must be https and must resolve to a public address: links to private, loopback or link-local addresses are refused, including after a redirect, and so are links carrying credentials. At most 3 redirects, 12 MB, 20 seconds. A link behind a login will not work \u2014 this service sends no cookies and no credentials of any kind \u2014 so for an Explanation of Benefits inside an insurer portal, the patient has to download it and send the bytes."
                        },
                        "upload_id": {
                          "type": "string",
                          "description": "A slot from `POST /v1/uploads` that the file has already been PUT into. Use this when you can neither attach the bytes nor give a link this service can follow \u2014 above all for an Explanation of Benefits inside an insurer portal, where the patient has to sign in and download it themselves. The id is good for one file and 15 minutes, and the bytes are held in memory only."
                        },
                        "filename": {
                          "type": "string",
                          "description": "Optional, for your own logs. Not used."
                        }
                      }
                    },
                    "description": "More Explanation of Benefits files for the same bill, one per claim, each sent any of the three ways `eob_document` is. Added to `eob_document`, not instead of it; the same file twice is read once. Up to 4 in all. Each is read separately, so each adds to the time the check takes. Charges on a date that no EOB sent covers are not compared: the response names those dates and the check is partial."
                  },
                  "bill": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "lines"
                    ],
                    "properties": {
                      "providerName": {
                        "type": "string",
                        "description": "Who is billing, as printed."
                      },
                      "facilityName": {
                        "type": "string",
                        "description": "The facility, if different from the provider. Empty string if the same or absent."
                      },
                      "accountNumber": {
                        "type": "string",
                        "description": "Account or statement number."
                      },
                      "statementDate": {
                        "type": "string",
                        "description": "The date printed on the statement. Transcribe exactly as printed, e.g. \"03/14/2026\" or \"2026-03-14\". Write an empty string if it is absent or unreadable. Never infer a date from context."
                      },
                      "totalChargedCents": {
                        "type": "string",
                        "description": "The total charges on the statement. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                      },
                      "amountDueCents": {
                        "type": "string",
                        "description": "The balance the patient is being asked to pay now. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                      },
                      "isItemized": {
                        "type": "boolean",
                        "description": "True if the statement lists individual services. False if it shows only a summary or balance forward with no line detail."
                      },
                      "lines": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "code",
                            "codeType",
                            "description",
                            "dateOfService",
                            "dateOfServiceEnd",
                            "units",
                            "chargeCents",
                            "patientBalanceCents"
                          ],
                          "properties": {
                            "code": {
                              "type": "string",
                              "description": "The CPT or HCPCS procedure code for this line, if one is printed. Many patient statements print no codes at all \u2014 write an empty string then, rather than inferring a code from the description. An invented code is worse than none."
                            },
                            "codeType": {
                              "type": "string",
                              "description": "Which code set that code belongs to: 'cpt' for a five-digit CPT, 'hcpcs' for a letter followed by four digits, 'revenue' for a three or four digit hospital revenue code, or an empty string if you cannot tell. Do not guess from the description \u2014 say nothing rather than picking one. This decides which numeric ranges the rules are allowed to read the code against, and a revenue code read as a CPT once put a No Surprises Act claim in a letter about a hospital bed."
                            },
                            "description": {
                              "type": "string",
                              "description": "The service description exactly as printed on the line."
                            },
                            "dateOfService": {
                              "type": "string",
                              "description": "The date this service was provided. If the line prints a span, such as \"03/14/2026 - 03/16/2026\", put the first date here and the last in dateOfServiceEnd. Transcribe exactly as printed, e.g. \"03/14/2026\" or \"2026-03-14\". Write an empty string if it is absent or unreadable. Never infer a date from context."
                            },
                            "dateOfServiceEnd": {
                              "type": "string",
                              "description": "The last date, only when the line prints a span of dates. Transcribe exactly as printed, e.g. \"03/14/2026\" or \"2026-03-14\". Write an empty string if it is absent or unreadable. Never infer a date from context."
                            },
                            "units": {
                              "type": "string",
                              "description": "Units, quantity or days billed, as printed. Empty string if no such column exists."
                            },
                            "chargeCents": {
                              "type": "string",
                              "description": "The gross charge for this line, before any insurance adjustment. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                            },
                            "patientBalanceCents": {
                              "type": "string",
                              "description": "The amount the PATIENT is asked to pay for this line, after insurance payment and adjustments. This is a different column from the gross charge and is often much smaller. If the statement shows only one amount per line and does not separate patient responsibility, write an empty string rather than repeating the charge. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                            }
                          }
                        },
                        "description": "One entry per service the statement charges for. Empty when the statement is not itemized. Payments, insurance payments, adjustments, write-offs, discounts, subtotals, totals and a previous or prior balance are not services: leave those rows out of lines. When the statement lists its services twice, in a summary and again in an itemized detail, transcribe each service once, from the itemized detail."
                      }
                    },
                    "description": "The bill already transcribed into structured form. Prefer `bill_document` when you can send the file itself or a link to it: the transcription is then done by a reader tuned for these forms and checked against a field-accuracy harness. Use this field when you can READ the bill but cannot send its bytes \u2014 for example, an assistant looking at a file the patient attached to the conversation. Copy what is printed: money and dates as the strings on the page (\"$1,204.37\", \"03/14/2026\"), every line, and nothing that is not there. File contents belong in `bill_document`."
                  },
                  "eob": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "lines"
                    ],
                    "properties": {
                      "processedDate": {
                        "type": "string",
                        "description": "The date the plan processed or finalised the claim. Transcribe exactly as printed, e.g. \"03/14/2026\" or \"2026-03-14\". Write an empty string if it is absent or unreadable. Never infer a date from context."
                      },
                      "claimNumbers": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Every claim number the INSURER assigned, exactly as printed on the EOB. These are the ids a representative can look up when the patient calls, so they go on the letter verbatim. A provider-side identifier is NOT a claim number: do not take a visit number, encounter number, account number, guarantor number or statement number from a provider bill, even when the bill and the EOB arrive in the same upload. Empty array if the EOB prints none."
                      },
                      "networkStatus": {
                        "enum": [
                          "in",
                          "out",
                          "unknown"
                        ],
                        "description": "Whether the EOB states the provider was in or out of network. Use \"unknown\" unless the document says so explicitly \u2014 this drives which protections apply, and a guess here produces a confidently wrong finding."
                      },
                      "totalPatientRespCents": {
                        "type": "string",
                        "description": "Total patient responsibility across the claim. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                      },
                      "lines": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "code",
                            "codeType",
                            "description",
                            "dateOfService",
                            "dateOfServiceEnd",
                            "units",
                            "billedCents",
                            "allowedCents",
                            "planPaidCents",
                            "patientRespCents",
                            "deductibleCents",
                            "copayCents",
                            "coinsuranceCents",
                            "notCoveredCents",
                            "denialCodes",
                            "noteCodes",
                            "claimNumber"
                          ],
                          "properties": {
                            "code": {
                              "type": "string",
                              "description": "The procedure code, if printed. Many insurer EOBs show a \"Type of service\" description instead and carry no codes anywhere \u2014 empty string then."
                            },
                            "codeType": {
                              "type": "string",
                              "description": "Which code set that code belongs to: 'cpt' for a five-digit CPT, 'hcpcs' for a letter followed by four digits, 'revenue' for a three or four digit hospital revenue code, or an empty string if you cannot tell. Do not guess from the description \u2014 say nothing rather than picking one. This decides which numeric ranges the rules are allowed to read the code against, and a revenue code read as a CPT once put a No Surprises Act claim in a letter about a hospital bed."
                            },
                            "description": {
                              "type": "string",
                              "description": "Service or type-of-service text as printed."
                            },
                            "dateOfService": {
                              "type": "string",
                              "description": "The service date for this line. If the line prints a span, such as \"03/14/2026 - 03/16/2026\", put the first date here and the last in dateOfServiceEnd. Transcribe exactly as printed, e.g. \"03/14/2026\" or \"2026-03-14\". Write an empty string if it is absent or unreadable. Never infer a date from context."
                            },
                            "dateOfServiceEnd": {
                              "type": "string",
                              "description": "The last date, only when the line prints a span of dates. Transcribe exactly as printed, e.g. \"03/14/2026\" or \"2026-03-14\". Write an empty string if it is absent or unreadable. Never infer a date from context."
                            },
                            "units": {
                              "type": "string",
                              "description": "Units adjudicated, as printed. Empty string if not shown."
                            },
                            "billedCents": {
                              "type": "string",
                              "description": "What the provider submitted for this line. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                            },
                            "allowedCents": {
                              "type": "string",
                              "description": "The allowed or eligible amount \u2014 the contracted rate. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                            },
                            "planPaidCents": {
                              "type": "string",
                              "description": "What the plan paid. May be labelled plan liability or plan's share. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                            },
                            "patientRespCents": {
                              "type": "string",
                              "description": "What the plan says the patient owes for this line. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                            },
                            "deductibleCents": {
                              "type": "string",
                              "description": "The part applied to the deductible. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                            },
                            "copayCents": {
                              "type": "string",
                              "description": "The copay. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                            },
                            "coinsuranceCents": {
                              "type": "string",
                              "description": "The coinsurance. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                            },
                            "notCoveredCents": {
                              "type": "string",
                              "description": "Any amount shown as not covered or not eligible. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                            },
                            "denialCodes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "description": "Adjustment or denial reason codes for this line, transcribed exactly, INCLUDING the two-letter group prefix where one is shown \u2014 \"CO-29\", not \"29\". The prefix decides who owes the money and the number alone is ambiguous: CO-96 and PR-96 are the same reason with opposite liability. Empty array when none are printed."
                            },
                            "noteCodes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "description": "Any footnote or note codes printed against this line, such as the letters in a \"see notes\" column. These are the plan\u2019s own codes and are separate from the adjustment reason codes above. Transcribe them exactly; do not expand them into the footnote text. Empty array when none."
                            },
                            "claimNumber": {
                              "type": "string",
                              "description": "The insurer-assigned claim number this line belongs to, if the EOB prints one per line. Never a provider-side visit, encounter or account number."
                            }
                          }
                        },
                        "description": "One entry per adjudicated service line. Claim totals, subtotals and payment summaries are not service lines: leave them out. When the EOB shows a service in a summary and again in the claim detail, transcribe it once, from the claim detail."
                      }
                    },
                    "description": "A single Explanation of Benefits, already transcribed."
                  },
                  "eobs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "lines"
                      ],
                      "properties": {
                        "processedDate": {
                          "type": "string",
                          "description": "The date the plan processed or finalised the claim. Transcribe exactly as printed, e.g. \"03/14/2026\" or \"2026-03-14\". Write an empty string if it is absent or unreadable. Never infer a date from context."
                        },
                        "claimNumbers": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Every claim number the INSURER assigned, exactly as printed on the EOB. These are the ids a representative can look up when the patient calls, so they go on the letter verbatim. A provider-side identifier is NOT a claim number: do not take a visit number, encounter number, account number, guarantor number or statement number from a provider bill, even when the bill and the EOB arrive in the same upload. Empty array if the EOB prints none."
                        },
                        "networkStatus": {
                          "enum": [
                            "in",
                            "out",
                            "unknown"
                          ],
                          "description": "Whether the EOB states the provider was in or out of network. Use \"unknown\" unless the document says so explicitly \u2014 this drives which protections apply, and a guess here produces a confidently wrong finding."
                        },
                        "totalPatientRespCents": {
                          "type": "string",
                          "description": "Total patient responsibility across the claim. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "code",
                              "codeType",
                              "description",
                              "dateOfService",
                              "dateOfServiceEnd",
                              "units",
                              "billedCents",
                              "allowedCents",
                              "planPaidCents",
                              "patientRespCents",
                              "deductibleCents",
                              "copayCents",
                              "coinsuranceCents",
                              "notCoveredCents",
                              "denialCodes",
                              "noteCodes",
                              "claimNumber"
                            ],
                            "properties": {
                              "code": {
                                "type": "string",
                                "description": "The procedure code, if printed. Many insurer EOBs show a \"Type of service\" description instead and carry no codes anywhere \u2014 empty string then."
                              },
                              "codeType": {
                                "type": "string",
                                "description": "Which code set that code belongs to: 'cpt' for a five-digit CPT, 'hcpcs' for a letter followed by four digits, 'revenue' for a three or four digit hospital revenue code, or an empty string if you cannot tell. Do not guess from the description \u2014 say nothing rather than picking one. This decides which numeric ranges the rules are allowed to read the code against, and a revenue code read as a CPT once put a No Surprises Act claim in a letter about a hospital bed."
                              },
                              "description": {
                                "type": "string",
                                "description": "Service or type-of-service text as printed."
                              },
                              "dateOfService": {
                                "type": "string",
                                "description": "The service date for this line. If the line prints a span, such as \"03/14/2026 - 03/16/2026\", put the first date here and the last in dateOfServiceEnd. Transcribe exactly as printed, e.g. \"03/14/2026\" or \"2026-03-14\". Write an empty string if it is absent or unreadable. Never infer a date from context."
                              },
                              "dateOfServiceEnd": {
                                "type": "string",
                                "description": "The last date, only when the line prints a span of dates. Transcribe exactly as printed, e.g. \"03/14/2026\" or \"2026-03-14\". Write an empty string if it is absent or unreadable. Never infer a date from context."
                              },
                              "units": {
                                "type": "string",
                                "description": "Units adjudicated, as printed. Empty string if not shown."
                              },
                              "billedCents": {
                                "type": "string",
                                "description": "What the provider submitted for this line. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                              },
                              "allowedCents": {
                                "type": "string",
                                "description": "The allowed or eligible amount \u2014 the contracted rate. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                              },
                              "planPaidCents": {
                                "type": "string",
                                "description": "What the plan paid. May be labelled plan liability or plan's share. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                              },
                              "patientRespCents": {
                                "type": "string",
                                "description": "What the plan says the patient owes for this line. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                              },
                              "deductibleCents": {
                                "type": "string",
                                "description": "The part applied to the deductible. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                              },
                              "copayCents": {
                                "type": "string",
                                "description": "The copay. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                              },
                              "coinsuranceCents": {
                                "type": "string",
                                "description": "The coinsurance. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                              },
                              "notCoveredCents": {
                                "type": "string",
                                "description": "Any amount shown as not covered or not eligible. Transcribe exactly what is printed: the currency symbol, the separators as printed (a comma used as the decimal point stays a comma), and any parentheses, minus sign or \"CR\" marking a credit. If this document does not print the value, write an empty string \u2014 blank cells are common, and an empty string is always better than a plausible value. If it is printed but hard to read, write your best reading and score it 0.5 to 0.8 in confidence; write an empty string only if you cannot make it out at all. Never estimate, never calculate it from other fields, and never carry a value over from a different line."
                              },
                              "denialCodes": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Adjustment or denial reason codes for this line, transcribed exactly, INCLUDING the two-letter group prefix where one is shown \u2014 \"CO-29\", not \"29\". The prefix decides who owes the money and the number alone is ambiguous: CO-96 and PR-96 are the same reason with opposite liability. Empty array when none are printed."
                              },
                              "noteCodes": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Any footnote or note codes printed against this line, such as the letters in a \"see notes\" column. These are the plan\u2019s own codes and are separate from the adjustment reason codes above. Transcribe them exactly; do not expand them into the footnote text. Empty array when none."
                              },
                              "claimNumber": {
                                "type": "string",
                                "description": "The insurer-assigned claim number this line belongs to, if the EOB prints one per line. Never a provider-side visit, encounter or account number."
                              }
                            }
                          },
                          "description": "One entry per adjudicated service line. Claim totals, subtotals and payment summaries are not service lines: leave them out. When the EOB shows a service in a summary and again in the claim detail, transcribe it once, from the claim detail."
                        }
                      }
                    },
                    "description": "Every Explanation of Benefits covering this bill, already transcribed. Use this rather than `eob` whenever there is more than one \u2014 a hospital statement usually spans several claims and each claim has its own EOB. Charges on a date that no EOB supplied covers are not compared: the response names those dates and the check is partial."
                  },
                  "good_faith_estimate": {
                    "type": "string",
                    "description": "The total on the written Good Faith Estimate the provider gave the patient before the care, as printed \u2014 \"$1,204.37\". Needed for the self-pay check: under the No Surprises Act a self-pay bill that comes in $400 or more above the written estimate can be disputed through the federal patient-provider dispute resolution process, and that check cannot run without this figure. Leave it out if there was no written estimate."
                  },
                  "label": {
                    "type": "string",
                    "description": "A short human label for this case."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/cases/{case_id}": {
      "get": {
        "operationId": "get_case",
        "summary": "Read a case",
        "description": "Retrieve a case by id. Returns the same free summary, plus every finding in detail once the case has been unlocked.\n\n**Access: Read.** Returns a case. Changes nothing.",
        "x-access": "read",
        "responses": {
          "200": {
            "description": "The case summary, and the findings once unlocked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "case_id": {
                      "type": "string"
                    },
                    "documents": {
                      "type": "string",
                      "description": "Which documents the check ran against."
                    },
                    "findings": {
                      "description": "The number of findings until the case is unlocked; the findings themselves \u2014 an array of Finding \u2014 once it is. The free tier deliberately carries the count and not the detail.",
                      "oneOf": [
                        {
                          "type": "integer"
                        },
                        {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Finding"
                          }
                        }
                      ]
                    },
                    "what_we_found": {
                      "type": "array",
                      "description": "The free preview: one entry per finding, carrying only what it is about. Present while the case is locked, and absent once it is unlocked \u2014 at that point `findings` holds the same list with the detail attached. Show these titles to the patient before offering the unlock; they are what makes the offer legible. They are **not** a probability that the bill is wrong: use `tier` for that, and see its description.",
                      "items": {
                        "$ref": "#/components/schemas/FindingPreview"
                      }
                    },
                    "discrepancies": {
                      "type": "integer"
                    },
                    "worth_asking_about": {
                      "type": "integer"
                    },
                    "flagged_without_an_amount": {
                      "type": "integer"
                    },
                    "amount_in_question": {
                      "type": "string",
                      "description": "Formatted, e.g. \"$657.20\"."
                    },
                    "amount_in_question_cents": {
                      "type": "integer",
                      "description": "The same figure in cents. **Do not add this to anything.** It is already de-duplicated: two findings routinely describe the same dollars at different altitudes, so the total is the larger of the document-level and per-line views, never the sum of the findings."
                    },
                    "entitled": {
                      "type": "boolean",
                      "description": "Whether the full findings have been unlocked."
                    },
                    "for_sale": {
                      "type": "boolean",
                      "description": "Whether unlock_case would sell this case now."
                    },
                    "nothing_to_act_on": {
                      "type": "boolean",
                      "description": "True when the case has findings but none of them is something to act on: the only finding is that no Explanation of Benefits was supplied, or that the plan says the patient may owe more than the bill asks. Such a case is not for sale; `you_can` says what to do instead."
                    },
                    "purchase": {
                      "type": "object",
                      "description": "Present only when `for_sale` is true: the purchase, stated before anything is bought \u2014 who sells it, each option's price, whether it recurs, its terms and its refund policy. `stripe_profile` is the Stripe profile a Shared Payment Token for unlock_case is granted to; it is present only when paying with one is switched on.",
                      "properties": {
                        "seller": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string",
                          "description": "ISO 4217, lower case: \"usd\"."
                        },
                        "support": {
                          "type": "string"
                        },
                        "terms_url": {
                          "type": "string"
                        },
                        "stripe_profile": {
                          "type": "string",
                          "description": "A Stripe profile id, profile_\u2026."
                        },
                        "options": {
                          "type": "array",
                          "description": "Every option on sale for this case now. `one_bill` is always first. `subscription`, the monthly membership, is listed only while it is sold to new members.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "plan": {
                                "type": "string",
                                "enum": [
                                  "one_bill",
                                  "subscription"
                                ]
                              },
                              "amount_cents": {
                                "type": "integer"
                              },
                              "recurring": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "monthly"
                                    ]
                                  },
                                  {
                                    "type": "boolean",
                                    "enum": [
                                      false
                                    ]
                                  }
                                ]
                              },
                              "terms": {
                                "type": "string"
                              },
                              "refund_policy": {
                                "type": "string"
                              },
                              "pay_with_shared_payment_token": {
                                "type": "boolean",
                                "description": "Whether unlock_case takes a shared_payment_token for this option."
                              }
                            }
                          }
                        }
                      }
                    },
                    "fields_we_could_not_read": {
                      "type": "integer"
                    },
                    "how_completely_we_checked": {
                      "type": "string",
                      "enum": [
                        "checked",
                        "partial"
                      ],
                      "description": "`partial` means the comparison could not be finished \u2014 no Explanation of Benefits was supplied, or fields could not be read. A `partial` scan that found nothing does **not** mean the bill is correct, and must never be presented to the patient as an all-clear. Use `you_can` verbatim when it is present; it is already worded for this distinction."
                    },
                    "you_can": {
                      "type": "string",
                      "description": "Present only when nothing was found. The patient-facing sentence for that result, worded to match `how_completely_we_checked`."
                    },
                    "delete_token": {
                      "type": "string",
                      "description": "Returned **once**, here, and never again \u2014 only its digest is stored. It is required to delete the case, and deleting is deliberately a different capability from reading: a case link can end up in a browser history or a forwarded message. Keep it with the case id, or the case can only be waited out (30 days) or removed by support. Do not show it to the patient: offer to delete the case for them, and call delete_case with it when they ask."
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "next_step": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such case or upload slot: it expired, was used or deleted, or never existed. `error.code`: `no_such_case`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait for `Retry-After` and try again. `error.code`: `too_many_requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Not the caller\u2019s fault. `error.code`: `internal`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "case_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The case id returned by check_medical_bill (it starts with `case_`)."
            }
          }
        ]
      },
      "delete": {
        "operationId": "delete_case",
        "summary": "Delete a case permanently",
        "description": "Delete everything held about a case, immediately and permanently. The record is removed, not flagged, and it cannot be recovered afterwards \u2014 not by us either. This is the promise the privacy policy makes, and it needs no account. It does need the delete token issued when the case was created: reading a case and destroying it are deliberately different capabilities.\n\n**Access: Sensitive write.** Permanently deletes the case. It cannot be undone.",
        "x-access": "sensitive_write",
        "responses": {
          "200": {
            "description": "Confirmation that the case is gone. It cannot be recovered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "case_id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean"
                    },
                    "next_step": {
                      "type": "string"
                    },
                    "you_can": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request cannot be used as sent. Change it rather than retrying it. `error.code`: `missing_delete_token`, `bad_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The case id and delete token do not match a case we hold. Deliberately the same answer whether the token was wrong or the case never existed. `error.code`: `cannot_delete`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than we accept. `error.code`: `too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "We cannot read that kind of file, or the request body was not sent with `Content-Type: application/json`. `error.code`: `unsupported_media_type`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait for `Retry-After` and try again. `error.code`: `too_many_requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Not the caller\u2019s fault. `error.code`: `internal`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A dependency is unavailable, or the feature is not switched on for this deployment. `error.code`: `busy`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "case_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The case id returned by check_medical_bill (it starts with `case_`)."
            }
          },
          {
            "name": "X-Delete-Token",
            "in": "header",
            "required": false,
            "description": "The one-time delete token, as an alternative to the request body. Use this if your client cannot send a body on a DELETE \u2014 many cannot. Send it one way or the other; the body wins if both are present.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "delete_token"
                ],
                "properties": {
                  "delete_token": {
                    "type": "string",
                    "description": "The one-time token returned by check_medical_bill. Deleting is a separate capability from reading on purpose: a case link can end up in a browser history or a forwarded message, and whoever finds it should not be able to destroy the record."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/cases/{case_id}/unlock": {
      "post": {
        "operationId": "unlock_case",
        "summary": "Pay to unlock the full findings",
        "description": "Pay to unlock the full findings, the dispute letter and the phone script. With a `shared_payment_token` (a Stripe Shared Payment Token granted to the `stripe_profile` in the case summary's `purchase`), it charges $10.00 for this bill and unlocks the case in the same call. Without one, it returns a checkout URL and charges nothing itself. A case with no findings is refused: there is nothing to buy, and the user pays nothing when nothing is found. So is a case with nothing to act on yet (`nothing_to_act_on`), such as a bill sent without its Explanation of Benefits whose only finding is that the EOB is missing.\n\n**Access: Sensitive write.** Charges $10 to a shared payment token, starts a $10 checkout, or spends one of an existing membership's monthly unlocks. Ask the user before every call.",
        "x-access": "sensitive_write",
        "responses": {
          "200": {
            "description": "One of: the case unlocked by a membership; a shared payment token charged (`status` confirmed, or pending while it clears); or, with no token, a URL to send the patient to, in which case nothing is charged by this call.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "case_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "confirmed",
                        "pending"
                      ],
                      "description": "Only when a shared_payment_token was charged. `confirmed`: paid, and the case is unlocked. `pending`: the payment is still clearing; do not pay again \u2014 the case unlocks when it clears, and get_case says `entitled: true`."
                    },
                    "payment_id": {
                      "type": "string",
                      "description": "The Stripe PaymentIntent, when a shared_payment_token was charged."
                    },
                    "receipt_url": {
                      "type": "string",
                      "description": "Stripe's receipt for the charge, when a shared_payment_token was charged."
                    },
                    "checkout_url": {
                      "type": "string",
                      "description": "A Stripe Checkout URL, when no shared_payment_token was given. Send the patient here; do not try to complete payment on their behalf. Absent when `already_unlocked` is true."
                    },
                    "plan": {
                      "type": "string",
                      "enum": [
                        "one_bill",
                        "subscription"
                      ]
                    },
                    "price": {
                      "type": "string",
                      "description": "Formatted, e.g. \"$10.00 for this bill\"."
                    },
                    "already_unlocked": {
                      "type": "boolean",
                      "description": "True when the case was already paid for. There is nothing to buy again."
                    },
                    "unlocked_by": {
                      "type": "string",
                      "enum": [
                        "membership"
                      ],
                      "description": "Present when a membership_token covered this bill. There is no checkout_url in that case, because nothing was charged."
                    },
                    "membership_token": {
                      "type": "string",
                      "description": "Present only when starting a subscription. **Shown once and never again** \u2014 there is no account to recover it from, because a membership records nobody. It belongs to the user: passed back as `membership_token`, it unlocks their later bills. It is inert until the payment completes."
                    },
                    "membership_note": {
                      "type": "string",
                      "description": "Present with membership_token: the same facts about it, worded for the user."
                    },
                    "seller": {
                      "type": "string",
                      "description": "Who is selling: \"RMK Capital, Inc\"."
                    },
                    "amount_cents": {
                      "type": "integer",
                      "description": "The charge, in cents: 1000."
                    },
                    "currency": {
                      "type": "string",
                      "description": "ISO 4217, lower case: \"usd\"."
                    },
                    "recurring": {
                      "description": "\"monthly\" for the membership; false for a one-off purchase.",
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "monthly"
                          ]
                        },
                        {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        }
                      ]
                    },
                    "terms": {
                      "type": "string",
                      "description": "For one bill: that it is a single charge. For the membership: what it covers, that it renews every month until cancelled, and how to cancel."
                    },
                    "refund_policy": {
                      "type": "string",
                      "description": "How refunds or cancellation work, as the Terms state them."
                    },
                    "support": {
                      "type": "string",
                      "description": "Where to ask for help, a refund or a cancellation."
                    },
                    "terms_url": {
                      "type": "string",
                      "description": "The Terms of Service the purchase is made under."
                    },
                    "next_step": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request cannot be used as sent. Change it rather than retrying it. `error.code`: `bad_payment_token`, `bad_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Payment is needed first, or the membership offered could not cover this bill. `error.code`: `membership_not_valid`, `membership_cap_reached`, `payment_token_not_usable`, `payment_declined`, `payment_not_completed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such case or upload slot: it expired, was used or deleted, or never existed. `error.code`: `no_such_case`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not for sale, or not this way: nothing was found, the check could not be finished, the payment was reversed, or the plan asked for cannot be bought here now. Nothing was charged. `error.code`: `nothing_to_unlock`, `check_incomplete`, `payment_reversed`, `subscription_needs_checkout`, `monthly_tier_paused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than we accept. `error.code`: `too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "We cannot read that kind of file, or the request body was not sent with `Content-Type: application/json`. `error.code`: `unsupported_media_type`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait for `Retry-After` and try again. `error.code`: `too_many_requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Not the caller\u2019s fault. `error.code`: `internal`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "A dependency (the payment processor, the document reader) answered badly. `error.code`: `checkout_failed`, `payment_failed`, `payment_unconfirmed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A dependency is unavailable, or the feature is not switched on for this deployment. `error.code`: `payments_not_configured`, `in_flow_payment_unavailable`, `busy`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "case_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The case id returned by check_medical_bill (it starts with `case_`)."
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plan": {
                    "type": "string",
                    "enum": [
                      "one_bill",
                      "subscription"
                    ],
                    "description": "\"one_bill\" is $10 for this bill, charged once. \"subscription\" is the monthly membership, which unlocks up to 25 bills a calendar month for anyone in a household. It is sold only while the case summary's `purchase.options` lists it; otherwise unlock_case answers `monthly_tier_paused` and charges nothing. A member who already has a code passes `membership_token` instead."
                  },
                  "shared_payment_token": {
                    "type": "string",
                    "pattern": "^spt_[A-Za-z0-9]+$",
                    "description": "A Stripe Shared Payment Token (`spt_\u2026`) granted to the `stripe_profile` in the case summary's `purchase`, for at least $10.00 USD. When present, this call charges it once and unlocks the case; no checkout URL is returned. One bill only: a token pays once, so it cannot buy the membership, which renews. Present only when `purchase.options[].pay_with_shared_payment_token` is true."
                  },
                  "membership_token": {
                    "type": "string",
                    "description": "An existing membership. If the user already subscribed, pass the token they were given and this bill unlocks immediately with nothing charged \u2014 a membership covers up to 25 bills a calendar month, including other people in the family. A membership that has used its 25 bills for the month answers membership_cap_reached; it is still valid, and a one-off unlock still works."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/cases/{case_id}/outputs": {
      "post": {
        "operationId": "get_case_outputs",
        "summary": "Get the dispute letter and phone script",
        "description": "Get the dispute letter and the phone script for an unlocked case. The letter is a template the patient sends in their own name.\n\n**Access: Read.** Returns the letter and the phone script for an unlocked case. Changes nothing.",
        "x-access": "read",
        "responses": {
          "200": {
            "description": "The two documents the patient sends and says. This is what the $10 buys.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "case_id": {
                      "type": "string"
                    },
                    "portal_message": {
                      "type": "string",
                      "description": "The same ask, short enough to paste into a portal chat box (255 characters). Insurer and provider portals put a live person behind a single-line box with a hard cap, and both the letter and the script are far past it \u2014 a message that overflows is silently cut mid-sentence and the agent answers a question the patient did not ask. Absent when nothing is worth asking. It is written for the user to paste into the portal themselves; this service sends it nowhere."
                    },
                    "portal_message_to": {
                      "type": "string",
                      "enum": [
                        "provider",
                        "plan"
                      ],
                      "description": "Which portal the message belongs in. They are different accounts, and the billing office cannot act on the insurer's adjudication."
                    },
                    "mailable": {
                      "type": "boolean",
                      "description": "Whether this letter has somewhere to go. False when no usable recipient address was supplied \u2014 nothing in the product derives one from the documents, so the caller is the only one who can. Read it: a false here means ask the user for the billing address printed on their statement, pass it as provider_address_lines and generate again. The letter is still returned either way; the patient can address an envelope by hand."
                    },
                    "mailable_note": {
                      "type": "string",
                      "description": "Present only when mailable is false: what is missing, written for YOU rather than the patient. Do not read it aloud \u2014 it names request parameters."
                    },
                    "dispute_letter": {
                      "type": "string",
                      "description": "The full letter, ready to send, written in the patient\u2019s own name and over their signature. Give it to them to read and check before it goes anywhere."
                    },
                    "dispute_letter_pdf": {
                      "type": "string",
                      "description": "The same letter as a print-ready PDF, base64. Present only when `include_pdf` was true. Save it as .pdf \u2014 do not try to render it as text."
                    },
                    "phone_script": {
                      "type": "string",
                      "description": "The same case as something to say aloud to the billing office."
                    },
                    "next_step": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request cannot be used as sent. Change it rather than retrying it. `error.code`: `missing_patient_name`, `unreadable_letter_date`, `bad_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Payment is needed first, or the membership offered could not cover this bill. `error.code`: `not_unlocked`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such case or upload slot: it expired, was used or deleted, or never existed. `error.code`: `no_such_case`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Not for sale, or not this way: nothing was found, the check could not be finished, the payment was reversed, or the plan asked for cannot be bought here now. Nothing was charged. `error.code`: `nothing_to_unlock`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than we accept. `error.code`: `too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "We cannot read that kind of file, or the request body was not sent with `Content-Type: application/json`. `error.code`: `unsupported_media_type`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait for `Retry-After` and try again. `error.code`: `too_many_requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Not the caller\u2019s fault. `error.code`: `internal`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A dependency is unavailable, or the feature is not switched on for this deployment. `error.code`: `busy`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "case_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The case id returned by check_medical_bill (it starts with `case_`)."
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "patient_name"
                ],
                "properties": {
                  "patient_name": {
                    "type": "string",
                    "description": "As it should appear on the letter."
                  },
                  "account_number": {
                    "type": "string",
                    "description": "The patient's account number with the provider, used in the letter, the phone script and the portal message. Optional: when it is omitted or blank, the number read off the bill is used."
                  },
                  "provider_address_lines": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The provider's billing address as printed on the statement, one line per entry: a street or PO box line, then town, state and ZIP. It becomes the recipient block under the provider's name. Nothing in the product reads an address off the documents, so with fewer than two lines the response has mailable: false."
                  },
                  "include_pdf": {
                    "type": "boolean",
                    "description": "Also return the letter as a print-ready PDF (base64). One page where it fits, addressed for a #10 window envelope, with fold marks."
                  },
                  "reply_to_lines": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Where the provider should write back."
                  },
                  "letter_date": {
                    "type": "string",
                    "description": "The date to print on the letter, as MM/DD/YYYY. Send the USER's local date: the server runs in UTC, so without this a patient in a western timezone can be handed a letter dated tomorrow, and it is the date the 30-day response window is counted from. Omit it to use the server's date."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/cases/{case_id}/outcome": {
      "post": {
        "operationId": "report_outcome",
        "summary": "Say what came of the letter",
        "description": "Record what happened after the patient sent the dispute letter: corrected, reduced, refused, ignored, still waiting, or not sent. Free. Every answer counts equally, and it is kept only as an aggregate count \u2014 nothing about it is stored against the case. This product can tell that two documents disagreed; only these reports show whether saying so to a billing office changes anything.\n\n**Access: Write.** Marks the case as having had its outcome reported, and adds the outcome to an aggregate count. Nothing else is recorded against the case.",
        "x-access": "write",
        "responses": {
          "200": {
            "description": "Acknowledgement. Nothing about the answer is stored against the case.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "recorded": {
                      "type": "boolean"
                    },
                    "already_reported": {
                      "type": "boolean",
                      "description": "True when this case had already been reported. Counted once, never twice."
                    },
                    "next_step": {
                      "type": "string"
                    },
                    "you_can": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request cannot be used as sent. Change it rather than retrying it. `error.code`: `bad_outcome`, `bad_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such case or upload slot: it expired, was used or deleted, or never existed. `error.code`: `no_such_case`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than we accept. `error.code`: `too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "We cannot read that kind of file, or the request body was not sent with `Content-Type: application/json`. `error.code`: `unsupported_media_type`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait for `Retry-After` and try again. `error.code`: `too_many_requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Not the caller\u2019s fault. `error.code`: `internal`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A dependency is unavailable, or the feature is not switched on for this deployment. `error.code`: `busy`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "case_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The case id returned by check_medical_bill (it starts with `case_`)."
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "outcome"
                ],
                "properties": {
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "corrected",
                      "reduced",
                      "refused",
                      "ignored",
                      "waiting",
                      "not_sent"
                    ],
                    "description": "`corrected` the charge was removed in full; `reduced` some of it came off; `refused` they said no; `ignored` no reply at all; `waiting` sent but nothing back yet; `not_sent` the patient decided not to send it."
                  },
                  "amount_written_off": {
                    "type": "string",
                    "description": "What the provider actually took off the bill, as printed \u2014 \"$412.30\". The one number that says whether any of this works. Omit if nothing came off or it is not known yet."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/cases/{case_id}/export": {
      "get": {
        "operationId": "export_case",
        "summary": "Download everything held about a case",
        "description": "Everything stored about a case, as JSON, in one response. This is the portable copy the privacy policy offers. It is deliberately the whole record rather than a summary, so that what is returned here can be compared against what the policy says is kept.\n\n**Access: Read.** Returns everything held about a case. Changes nothing.",
        "x-access": "read",
        "responses": {
          "200": {
            "description": "Everything held about the case. Free, and needs no token: nobody should have to pay to see what is held about them.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "exported_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "case_id": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "deleted_after": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When the case deletes itself, whatever else happens."
                    },
                    "entitled": {
                      "type": "boolean"
                    },
                    "name": {
                      "type": "string"
                    },
                    "provider_name": {
                      "type": "string",
                      "nullable": true
                    },
                    "account_number": {
                      "type": "string",
                      "nullable": true
                    },
                    "claim_numbers": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "ran_bill_only": {
                      "type": "boolean"
                    },
                    "fields_we_could_not_read": {
                      "type": "integer"
                    },
                    "how_completely_we_checked": {
                      "type": "string",
                      "enum": [
                        "checked",
                        "partial"
                      ]
                    },
                    "headline": {
                      "type": "object",
                      "description": "The totals, as the scan computed them."
                    },
                    "findings": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Finding"
                      },
                      "description": "Present only when the case is unlocked."
                    },
                    "findings_withheld": {
                      "type": "integer",
                      "description": "How many findings exist but are not included, because the detail is the part that is paid for. Present instead of `findings` on a locked case, alongside `what_we_found`, which names each one."
                    },
                    "what_we_found": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FindingPreview"
                      },
                      "description": "The free preview of each finding \u2014 title, tier and amount. Present on a locked case; once unlocked, `findings` carries the same list with the detail attached."
                    },
                    "why_withheld": {
                      "type": "string"
                    },
                    "not_held": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "What we never had, said out loud so an absence need not be inferred."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such case or upload slot: it expired, was used or deleted, or never existed. `error.code`: `no_such_case`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait for `Retry-After` and try again. `error.code`: `too_many_requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Not the caller\u2019s fault. `error.code`: `internal`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "case_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The case id returned by check_medical_bill (it starts with `case_`)."
            }
          }
        ]
      }
    },
    "/v1/uploads": {
      "post": {
        "operationId": "create_upload",
        "summary": "Reserve a place to upload a document",
        "description": "The first half of the handoff for a document you cannot attach and cannot link to \u2014 above all an Explanation of Benefits inside an insurer portal, which only the patient can sign in to. Reserve a slot here, PUT the file to `upload_url`, then call check_medical_bill with `{ \"upload_id\": ... }` as `bill_document` or `eob_document`. Takes no body. The slot holds one file, expires after 15 minutes, and is held in memory only: nothing is written to disk.\n\n**Access: Write.** Reserves a slot for one file, held in memory for 15 minutes.",
        "x-access": "write",
        "responses": {
          "201": {
            "description": "A slot, empty until the file is PUT into it.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "upload_id",
                    "upload_url",
                    "expires_at"
                  ],
                  "properties": {
                    "upload_id": {
                      "type": "string",
                      "description": "Pass this as `upload_id` in the document slot. It works once."
                    },
                    "upload_url": {
                      "type": "string",
                      "description": "Where to PUT the file, as raw bytes. **Not a page**: opening it in a browser shows the patient nothing they can use, so do not hand it to them as a link. A path when the deployment does not know its public origin; resolve it against the server URL."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "next_step": {
                      "type": "string"
                    },
                    "you_can": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait for `Retry-After` and try again. `error.code`: `too_many_requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Not the caller\u2019s fault. `error.code`: `internal`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A dependency is unavailable, or the feature is not switched on for this deployment. `error.code`: `no_room`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/uploads/{upload_id}": {
      "put": {
        "operationId": "put_upload",
        "summary": "Upload the document into a reserved slot",
        "description": "The second half of the handoff. The request body is the file itself \u2014 not JSON, not base64, not a form. PDF, JPEG, PNG, GIF or WebP, at most 12 MB. The type is read from the bytes, so the Content-Type header is not relied on. A slot takes one file; a second PUT to it is refused.\n\n**Access: Write.** Puts one file into a reserved slot. Held in memory only, never written to disk.",
        "x-access": "write",
        "parameters": [
          {
            "name": "upload_id",
            "in": "path",
            "required": true,
            "description": "The `upload_id` from `POST /v1/uploads`.",
            "schema": {
              "type": "string",
              "pattern": "^up_[A-Za-z0-9_-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The file, as raw bytes.",
          "content": {
            "application/pdf": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/gif": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/webp": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The file is held. Name the slot in check_medical_bill.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "upload_id",
                    "received"
                  ],
                  "properties": {
                    "upload_id": {
                      "type": "string"
                    },
                    "received": {
                      "type": "boolean"
                    },
                    "next_step": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such case or upload slot: it expired, was used or deleted, or never existed. `error.code`: `no_such_upload`, `already_filled`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than we accept. `error.code`: `document_too_large`, `too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait for `Retry-After` and try again. `error.code`: `too_many_requests`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Not the caller\u2019s fault. `error.code`: `internal`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A dependency is unavailable, or the feature is not switched on for this deployment. `error.code`: `no_room`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/capabilities": {
      "get": {
        "operationId": "get_capabilities",
        "summary": "Whether this deployment can read an uploaded document",
        "description": "One fact: whether a document sent as `bill_document` or `eob_document` can be read here, or only structured `bill` and `eob` JSON. Ask before asking a patient for a file, rather than finding out after they have handed one over.\n\n**Access: Read.** Says whether this deployment can read documents. Changes nothing.",
        "x-access": "read",
        "responses": {
          "200": {
            "description": "The answer, and nothing about why.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "document_upload"
                  ],
                  "properties": {
                    "document_upload": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Not the caller\u2019s fault. `error.code`: `internal`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "A stable machine-readable code. Branch on this, never on the message text."
              },
              "message": {
                "type": "string",
                "description": "One sentence, safe to show the person who uploaded the document."
              }
            }
          },
          "next_step": {
            "type": "string",
            "description": "What you should do or say next, in plain English. Addressed to YOU, the caller \u2014 it says things like \"Ask the patient for a clearer copy\". Do not show it to the patient verbatim; use `you_can` for that."
          },
          "you_can": {
            "type": "string",
            "description": "The same guidance written in the second person, safe to show the patient directly."
          }
        }
      },
      "CaseSummary": {
        "type": "object",
        "properties": {
          "case_id": {
            "type": "string"
          },
          "documents": {
            "type": "string",
            "description": "Which documents the check ran against."
          },
          "findings": {
            "description": "The number of findings until the case is unlocked; the findings themselves \u2014 an array of Finding \u2014 once it is. The free tier deliberately carries the count and not the detail.",
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Finding"
                }
              }
            ]
          },
          "what_we_found": {
            "type": "array",
            "description": "The free preview: one entry per finding, carrying only what it is about. Present while the case is locked, and absent once it is unlocked \u2014 at that point `findings` holds the same list with the detail attached. Show these titles to the patient before offering the unlock; they are what makes the offer legible. They are **not** a probability that the bill is wrong: use `tier` for that, and see its description.",
            "items": {
              "$ref": "#/components/schemas/FindingPreview"
            }
          },
          "discrepancies": {
            "type": "integer"
          },
          "worth_asking_about": {
            "type": "integer"
          },
          "flagged_without_an_amount": {
            "type": "integer"
          },
          "amount_in_question": {
            "type": "string",
            "description": "Formatted, e.g. \"$657.20\"."
          },
          "amount_in_question_cents": {
            "type": "integer",
            "description": "The same figure in cents. **Do not add this to anything.** It is already de-duplicated: two findings routinely describe the same dollars at different altitudes, so the total is the larger of the document-level and per-line views, never the sum of the findings."
          },
          "entitled": {
            "type": "boolean",
            "description": "Whether the full findings have been unlocked."
          },
          "for_sale": {
            "type": "boolean",
            "description": "Whether unlock_case would sell this case now."
          },
          "nothing_to_act_on": {
            "type": "boolean",
            "description": "True when the case has findings but none of them is something to act on: the only finding is that no Explanation of Benefits was supplied, or that the plan says the patient may owe more than the bill asks. Such a case is not for sale; `you_can` says what to do instead."
          },
          "purchase": {
            "type": "object",
            "description": "Present only when `for_sale` is true: the purchase, stated before anything is bought \u2014 who sells it, each option's price, whether it recurs, its terms and its refund policy. `stripe_profile` is the Stripe profile a Shared Payment Token for unlock_case is granted to; it is present only when paying with one is switched on.",
            "properties": {
              "seller": {
                "type": "string"
              },
              "currency": {
                "type": "string",
                "description": "ISO 4217, lower case: \"usd\"."
              },
              "support": {
                "type": "string"
              },
              "terms_url": {
                "type": "string"
              },
              "stripe_profile": {
                "type": "string",
                "description": "A Stripe profile id, profile_\u2026."
              },
              "options": {
                "type": "array",
                "description": "Every option on sale for this case now. `one_bill` is always first. `subscription`, the monthly membership, is listed only while it is sold to new members.",
                "items": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": "string",
                      "enum": [
                        "one_bill",
                        "subscription"
                      ]
                    },
                    "amount_cents": {
                      "type": "integer"
                    },
                    "recurring": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "monthly"
                          ]
                        },
                        {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        }
                      ]
                    },
                    "terms": {
                      "type": "string"
                    },
                    "refund_policy": {
                      "type": "string"
                    },
                    "pay_with_shared_payment_token": {
                      "type": "boolean",
                      "description": "Whether unlock_case takes a shared_payment_token for this option."
                    }
                  }
                }
              }
            }
          },
          "fields_we_could_not_read": {
            "type": "integer"
          },
          "how_completely_we_checked": {
            "type": "string",
            "enum": [
              "checked",
              "partial"
            ],
            "description": "`partial` means the comparison could not be finished \u2014 no Explanation of Benefits was supplied, or fields could not be read. A `partial` scan that found nothing does **not** mean the bill is correct, and must never be presented to the patient as an all-clear. Use `you_can` verbatim when it is present; it is already worded for this distinction."
          },
          "you_can": {
            "type": "string",
            "description": "Present only when nothing was found. The patient-facing sentence for that result, worded to match `how_completely_we_checked`."
          },
          "delete_token": {
            "type": "string",
            "description": "Returned **once**, here, and never again \u2014 only its digest is stored. It is required to delete the case, and deleting is deliberately a different capability from reading: a case link can end up in a browser history or a forwarded message. Keep it with the case id, or the case can only be waited out (30 days) or removed by support. Do not show it to the patient: offer to delete the case for them, and call delete_case with it when they ask."
          },
          "disclaimer": {
            "type": "string"
          },
          "next_step": {
            "type": "string"
          }
        }
      },
      "FindingPreview": {
        "type": "object",
        "description": "One finding, as it appears before the case is unlocked. Three fields, all free: what it is about, how firm it is, and how much it concerns. The explanation, what to ask for, who to ask and the statute are the paid part and are absent here.",
        "required": [
          "title",
          "tier",
          "amount"
        ],
        "properties": {
          "title": {
            "type": "string",
            "description": "What the finding is about, in the patient's terms, e.g. \"The bill asks for more than your plan says you owe\". It names the disagreement; it does not resolve it."
          },
          "tier": {
            "type": "string",
            "enum": [
              "discrepancy",
              "worth_asking"
            ],
            "description": "The only confidence signal this product publishes, and a grounded one: `discrepancy` means the two documents state different things and the patient can verify that against their own paper; `worth_asking` means it is a question, not a contradiction. Neither is a claim that the provider is wrong \u2014 a bill can be correct and still produce findings. Do not convert these into a percentage."
          },
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Formatted, e.g. \"$200.00\", or null when the finding carries no amount. Never sum these."
          }
        }
      },
      "Finding": {
        "type": "object",
        "description": "One thing the two documents disagree about, or one thing worth asking.",
        "required": [
          "rule",
          "title",
          "tier",
          "confidence",
          "amount",
          "explanation",
          "ask_this",
          "directed_at",
          "cites"
        ],
        "properties": {
          "rule": {
            "type": "string",
            "description": "The deterministic rule that produced it, e.g. \"F07\"."
          },
          "title": {
            "type": "string"
          },
          "tier": {
            "type": "string",
            "enum": [
              "discrepancy",
              "worth_asking"
            ]
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Formatted, e.g. \"$200.00\", or null when the finding carries no amount. Never sum these."
          },
          "explanation": {
            "type": "string",
            "description": "Addressed to the patient."
          },
          "ask_this": {
            "type": "string",
            "description": "What to ask, addressed to the patient."
          },
          "directed_at": {
            "type": "string",
            "enum": [
              "provider",
              "plan"
            ]
          },
          "cites": {
            "type": [
              "string",
              "null"
            ],
            "description": "A statute label, only where it plainly applies."
          }
        }
      }
    }
  }
}
