{
  "openapi": "3.1.0",
  "info": {
    "title": "Exogram \u2014 Truth Ledger for AI",
    "description": "Exogram is the admissibility layer for autonomous AI. Store, verify, and recall user-owned facts so models reference verified truth instead of committing perjury or making unwarranted inferences.",
    "version": "2.2.0"
  },
  "servers": [
    {
      "url": "https://api.exogram.ai"
    }
  ],
  "paths": {
    "/v2/vault/store": {
      "post": {
        "operationId": "storeRecord",
        "summary": "Store a new verified ledger record",
        "description": "Commits a new fact to the user's truth vault. The fact is embedded, encrypted, and indexed for semantic recall. Conflict detection runs automatically.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StoreRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Record stored successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoreResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/vault/search": {
      "post": {
        "operationId": "searchLedger",
        "summary": "Semantic search across the truth vault",
        "description": "Search the user's truth vault using natural language. Returns the most relevant facts ranked by semantic similarity and confidence score.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Matching records ranked by relevance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/vault/check": {
      "post": {
        "operationId": "checkClaim",
        "summary": "Check a claim against stored records",
        "description": "Checks if a new claim conflicts with existing verified records. Returns conflict status and related facts.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Conflict check results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckResponse"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "healthCheck",
        "summary": "API health check",
        "description": "Check if Exogram API is available",
        "security": [],
        "responses": {
          "200": {
            "description": "API is healthy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "StoreRequest": {
        "type": "object",
        "required": [
          "content"
        ],
        "properties": {
          "content": {
            "type": "string",
            "description": "The fact or claim to store (e.g. 'My dog is named Max and he is a golden retriever')"
          },
          "source": {
            "type": "string",
            "default": "chatgpt",
            "description": "Source of the information"
          },
          "source_llm": {
            "type": "string",
            "default": "openai",
            "description": "Which LLM originated this"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional tags for categorization"
          }
        }
      },
      "StoreResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "memory_id": {
            "type": "string"
          },
          "vector_id": {
            "type": "string"
          },
          "confidence": {
            "type": "number"
          },
          "conflicts_detected": {
            "type": "integer"
          },
          "conflicts": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "SearchRequest": {
        "type": "object",
        "required": [
          "query"
        ],
        "properties": {
          "query": {
            "type": "string",
            "description": "Natural language query (e.g. 'What is my dog's name?')"
          },
          "top_k": {
            "type": "integer",
            "default": 15,
            "description": "Number of results to return (1-50)"
          },
          "min_confidence": {
            "type": "number",
            "default": 0.0,
            "description": "Minimum confidence threshold (0.0-1.0)"
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "total": {
            "type": "integer"
          }
        }
      },
      "CheckRequest": {
        "type": "object",
        "required": [
          "claim"
        ],
        "properties": {
          "claim": {
            "type": "string",
            "description": "The claim to verify against stored records"
          }
        }
      },
      "CheckResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "has_conflict": {
            "type": "boolean"
          },
          "related_records": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "HealthResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "version": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "oauth": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://api.exogram.ai/oauth/authorize",
            "tokenUrl": "https://api.exogram.ai/oauth/token",
            "scopes": {
              "offline_access": "Full access to your Exogram truth vault"
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth": [
        "offline_access"
      ]
    }
  ]
}