{
  "openapi": "3.1.0",
  "info": {
    "title": "Omniarch Legal Data API",
    "version": "1.0.0",
    "description": "REST API providing structured access to U.S. case law knowledge graphs, semantic triples, citation networks, judicial speech acts, and entity data.\n\nCoverage: U.S. federal circuits (1951 to present), California appellate (2000 to present).\n\nAuthentication: Bearer token. Request access at https://omniarch.inc/request-access.html\n\nData is extracted using a 14-layer NLP pipeline. All assertions are source-traced to named court documents with paragraph-level provenance.",
    "contact": {
      "name": "Omniarch",
      "url": "https://omniarch.inc/request-access.html",
      "email": "hello@omniarch.inc"
    },
    "termsOfService": "https://omniarch.inc/terms.html",
    "license": {
      "name": "Commercial API License",
      "url": "https://omniarch.inc/terms.html"
    }
  },
  "servers": [
    {
      "url": "https://api.omniarch.inc/v1",
      "description": "Production"
    }
  ],
  "paths": {
    "/triples": {
      "get": {
        "summary": "Query semantic triples",
        "description": "Returns subject-action-object triples extracted from U.S. case law, with modality, polarity, judicial speech act classification, and full source provenance.",
        "operationId": "queryTriples",
        "parameters": [
          {
            "name": "subject",
            "in": "query",
            "description": "Subject entity (party name, entity type, or concept)",
            "schema": { "type": "string" }
          },
          {
            "name": "action",
            "in": "query",
            "description": "Predicate or verb of the assertion",
            "schema": { "type": "string" }
          },
          {
            "name": "object",
            "in": "query",
            "description": "Object entity of the assertion",
            "schema": { "type": "string" }
          },
          {
            "name": "jurisdiction",
            "in": "query",
            "description": "Jurisdiction filter",
            "schema": {
              "type": "string",
              "enum": ["federal", "california", "all"]
            }
          },
          {
            "name": "speech_act",
            "in": "query",
            "description": "Judicial speech act type filter",
            "schema": {
              "type": "string",
              "enum": ["holding", "reasoning", "dicta", "order", "procedural"]
            }
          },
          {
            "name": "year_min",
            "in": "query",
            "description": "Earliest year (inclusive). Federal coverage starts 1951.",
            "schema": { "type": "integer", "minimum": 1951 }
          },
          {
            "name": "year_max",
            "in": "query",
            "description": "Latest year (inclusive)",
            "schema": { "type": "integer" }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of results to return",
            "schema": { "type": "integer", "default": 20, "maximum": 1000 }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Pagination offset",
            "schema": { "type": "integer", "default": 0 }
          }
        ],
        "responses": {
          "200": {
            "description": "Array of semantic triples with provenance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "triples": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Triple" }
                    },
                    "total": { "type": "integer" },
                    "offset": { "type": "integer" },
                    "limit": { "type": "integer" }
                  }
                }
              }
            }
          },
          "401": { "description": "Unauthorized — Bearer token required" },
          "429": { "description": "Rate limit exceeded" }
        },
        "security": [{ "bearerAuth": [] }]
      }
    },
    "/citations/{citation_id}": {
      "get": {
        "summary": "Get citation treatment history",
        "description": "Returns how a specific case has been cited, distinguished, followed, or overruled by subsequent opinions.",
        "operationId": "getCitationTreatment",
        "parameters": [
          {
            "name": "citation_id",
            "in": "path",
            "required": true,
            "description": "URN:LEX identifier or normalized citation string (e.g. '347 U.S. 483')",
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Citation treatment history",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CitationTreatment" }
              }
            }
          },
          "404": { "description": "Citation not found in corpus" }
        },
        "security": [{ "bearerAuth": [] }]
      }
    },
    "/cases": {
      "get": {
        "summary": "Search case opinions",
        "description": "Search and filter case opinions in the corpus by jurisdiction, court, date range, or keyword.",
        "operationId": "searchCases",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Full-text search query",
            "schema": { "type": "string" }
          },
          {
            "name": "court",
            "in": "query",
            "description": "Court identifier (e.g. 'scotus', '9th_circuit', 'ca_supreme')",
            "schema": { "type": "string" }
          },
          {
            "name": "year_min",
            "in": "query",
            "schema": { "type": "integer" }
          },
          {
            "name": "year_max",
            "in": "query",
            "schema": { "type": "integer" }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "default": 20, "maximum": 100 }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching case opinions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cases": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Case" }
                    },
                    "total": { "type": "integer" }
                  }
                }
              }
            }
          }
        },
        "security": [{ "bearerAuth": [] }]
      }
    }
  },
  "components": {
    "schemas": {
      "Triple": {
        "type": "object",
        "properties": {
          "assertion_id": {
            "type": "string",
            "description": "Unique assertion identifier (e.g. 'fed.scotus.2024.0451.h01')"
          },
          "type": {
            "type": "string",
            "enum": ["HOLDING", "REASONING", "DICTA", "ORDER", "PROCEDURAL"],
            "description": "Judicial speech act classification"
          },
          "subject": { "type": "string", "description": "Subject entity of the assertion" },
          "action": { "type": "string", "description": "Predicate/verb of the assertion" },
          "object": { "type": "string", "description": "Object entity of the assertion" },
          "polarity": {
            "type": "string",
            "enum": ["POSITIVE", "NEGATIVE", "NEUTRAL"],
            "description": "Assertion polarity"
          },
          "modality": {
            "type": "string",
            "enum": ["DEONTIC", "EPISTEMIC", "NONE"],
            "description": "Modal classification of the assertion"
          },
          "provenance": {
            "type": "object",
            "properties": {
              "case": { "type": "string", "description": "Case name" },
              "citation": { "type": "string", "description": "Standard legal citation" },
              "docket": { "type": "string" },
              "decided": { "type": "string", "format": "date" },
              "court": { "type": "string" },
              "paragraph": { "type": "integer" },
              "section": { "type": "string" }
            }
          },
          "jurisdiction": {
            "type": "object",
            "properties": {
              "court": { "type": "string" },
              "binding_scope": {
                "type": "string",
                "description": "Geographic or circuit scope of binding authority"
              }
            }
          },
          "speaker": {
            "type": "string",
            "enum": ["majority", "concurrence", "dissent", "plurality", "unknown"],
            "description": "Judicial opinion author type"
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Extraction confidence score"
          }
        }
      },
      "CitationTreatment": {
        "type": "object",
        "properties": {
          "citation_id": { "type": "string" },
          "case_name": { "type": "string" },
          "status": {
            "type": "string",
            "enum": ["GOOD_LAW", "OVERRULED", "DISTINGUISHED", "LIMITED", "QUESTIONED", "UNCERTAIN"]
          },
          "treatment_history": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "treatment": {
                  "type": "string",
                  "enum": ["FOLLOWED", "DISTINGUISHED", "OVERRULED", "CITED", "CRITICIZED", "LIMITED", "EXPLAINED"]
                },
                "citing_case": { "type": "string" },
                "citing_citation": { "type": "string" },
                "date": { "type": "string", "format": "date" },
                "court": { "type": "string" }
              }
            }
          },
          "cited_by_count": { "type": "integer" },
          "overruled_by": { "type": "string", "nullable": true }
        }
      },
      "Case": {
        "type": "object",
        "properties": {
          "case_id": { "type": "string" },
          "name": { "type": "string" },
          "citation": { "type": "string" },
          "docket": { "type": "string" },
          "court": { "type": "string" },
          "decided": { "type": "string", "format": "date" },
          "jurisdiction": { "type": "string" },
          "triple_count": { "type": "integer", "description": "Number of extracted semantic triples" }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key — request at https://omniarch.inc/request-access.html"
      }
    }
  }
}
