{
  "openapi": "3.1.0",
  "info": {
    "title": "eobs.claims: the Explanation of Benefits as typed data",
    "version": "1.0.0",
    "description": "The Explanation of Benefits is the statement a health plan sends after it processes a claim: billed, allowed, plan paid, patient responsibility and remark codes. A free typed schema, remark-code decoding and an MCP server for agents. The schema, example, validation and MCP tools are keyless; parsing documents needs an access key (request one at https://eobs.claims/#access)."
  },
  "servers": [
    {
      "url": "https://eobs.claims"
    }
  ],
  "paths": {
    "/schema.json": {
      "get": {
        "operationId": "getEobSchema",
        "summary": "The Eob JSON Schema (2020-12)",
        "responses": {
          "200": {
            "description": "The JSON Schema.",
            "content": {
              "application/schema+json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/example.json": {
      "get": {
        "operationId": "getEobExample",
        "summary": "A complete, valid Eob with fictional values",
        "responses": {
          "200": {
            "description": "An example Eob.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eob"
                }
              }
            }
          }
        }
      }
    },
    "/validate": {
      "post": {
        "operationId": "validateEob",
        "summary": "Check a Eob against the schema and the document's own checks",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Eob"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The result. Nothing is stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationResult"
                }
              }
            }
          },
          "400": {
            "description": "The body is not JSON."
          }
        }
      }
    },
    "/parse": {
      "post": {
        "operationId": "parseEob",
        "summary": "Parse a document into a Eob",
        "security": [
          {
            "accessKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "document"
                ],
                "properties": {
                  "document": {
                    "type": "string",
                    "format": "binary",
                    "description": "The document: PDF, image or a native data file."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The typed Eob.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eob"
                }
              }
            }
          },
          "401": {
            "description": "An access key is required. Request one at the request_access URL in the body."
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "MCP server (Streamable HTTP, JSON-RPC 2.0). Keyless, read-only tools.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response."
          },
          "202": {
            "description": "Notification accepted."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Eob": {
        "type": "object",
        "description": "An Explanation of Benefits: the statement a health plan sends a member after it processes a claim. Not a bill; any bill comes from the provider.",
        "required": [
          "payer",
          "member_id",
          "claim_number",
          "provider",
          "date_processed",
          "lines",
          "totals"
        ],
        "properties": {
          "payer": {
            "type": "string",
            "description": "The health plan that processed the claim."
          },
          "member_id": {
            "type": "string"
          },
          "claim_number": {
            "type": "string",
            "description": "The plan's claim identifier. Appeals reference it."
          },
          "provider": {
            "type": "string",
            "description": "Who rendered and billed the services."
          },
          "date_processed": {
            "type": "string",
            "format": "date",
            "description": "When the plan finished processing the claim."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EobServiceLine"
            }
          },
          "totals": {
            "$ref": "#/components/schemas/EobTotals"
          },
          "appeal_window": {
            "$ref": "#/components/schemas/EobAppealWindow"
          }
        }
      },
      "EobServiceLine": {
        "type": "object",
        "required": [
          "date_of_service",
          "procedure_code",
          "billed",
          "allowed",
          "plan_paid",
          "patient_responsibility"
        ],
        "properties": {
          "date_of_service": {
            "type": "string",
            "format": "date"
          },
          "procedure_code": {
            "type": "string",
            "description": "CPT or HCPCS code for the service line."
          },
          "description": {
            "type": "string",
            "description": "Plain-language service description."
          },
          "billed": {
            "type": "number",
            "minimum": 0,
            "description": "USD the provider charged."
          },
          "allowed": {
            "type": "number",
            "minimum": 0,
            "description": "The plan's negotiated rate: the contract number, not the sticker number."
          },
          "plan_paid": {
            "type": "number",
            "minimum": 0,
            "description": "USD the plan paid the provider on this line."
          },
          "patient_responsibility": {
            "type": "number",
            "minimum": 0,
            "description": "Copay, coinsurance or deductible: what the member may owe the provider. The EOB itself is not a bill."
          },
          "remark_codes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "CARC/RARC codes explaining any reduction or non-payment, e.g. CO-45, CO-97, PR-1."
          }
        }
      },
      "EobTotals": {
        "type": "object",
        "required": [
          "billed",
          "allowed",
          "plan_paid",
          "patient_responsibility"
        ],
        "properties": {
          "billed": {
            "type": "number"
          },
          "allowed": {
            "type": "number"
          },
          "plan_paid": {
            "type": "number"
          },
          "patient_responsibility": {
            "type": "number"
          }
        }
      },
      "EobAppealWindow": {
        "type": "object",
        "description": "The plan's appeal deadline and address, when stated on the document.",
        "properties": {
          "deadline": {
            "type": "string",
            "format": "date"
          },
          "days": {
            "type": "integer",
            "description": "Days allowed for an internal appeal, counted from the notice of the decision; at least 180 for most plans."
          },
          "address": {
            "type": "string"
          }
        }
      },
      "Issue": {
        "type": "object",
        "required": [
          "path",
          "message"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "ValidationResult": {
        "type": "object",
        "required": [
          "valid",
          "consistent",
          "errors",
          "warnings"
        ],
        "properties": {
          "valid": {
            "type": "boolean",
            "description": "The record matches the schema."
          },
          "consistent": {
            "type": "boolean",
            "description": "It also passes every check: sums, dates, codes."
          },
          "schema": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "accessKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An access key issued on request at https://eobs.claims/#access."
      }
    }
  }
}