{
  "openapi": "3.1.0",
  "info": {
    "title": "Evidence8 Public Visual Search",
    "version": "0.1.0",
    "description": "Retrieve visual candidates from the public index with source and rights context. Lexical retrieval does not verify claims. No API key is required for public evaluation. Private workspace and local-ingestion records are excluded."
  },
  "servers": [
    {
      "url": "https://evidence8.com"
    }
  ],
  "paths": {
    "/v1/search": {
      "post": {
        "operationId": "searchVisualEvidence",
        "summary": "Find source-grounded visual candidates",
        "description": "Up to 60 requests per minute per IP. Inspect the source, reporting period, and rights before use. No-match returns an empty results array.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "query"
                ],
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "corpus": {
                    "type": "string",
                    "maxLength": 100,
                    "default": "all"
                  },
                  "candidateLimit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10,
                    "default": 5
                  }
                }
              },
              "example": {
                "query": "Ember electricity demand United States",
                "candidateLimit": 3
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Public retrieval response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or invalid options"
          },
          "405": {
            "description": "Unsupported method"
          },
          "413": {
            "description": "Body exceeds 16 KiB"
          },
          "415": {
            "description": "Use application/json"
          },
          "422": {
            "description": "Invalid query"
          },
          "429": {
            "description": "Rate limit reached"
          },
          "503": {
            "description": "Public index unavailable"
          }
        }
      }
    },
    "/v1/assets/{id}": {
      "get": {
        "operationId": "getVisualEvidence",
        "summary": "Read a public visual's metadata",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_-]{1,250}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public retrieval response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Visual"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Public record not found"
          },
          "429": {
            "description": "Rate limit reached"
          },
          "503": {
            "description": "Public index unavailable"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Visual": {
        "type": "object",
        "required": [
          "id",
          "title",
          "sourceUrl"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "publisher": {
            "type": [
              "string",
              "null"
            ]
          },
          "sourceUrl": {
            "type": "string",
            "format": "uri"
          },
          "assetUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "recordUrl": {
            "type": "string",
            "format": "uri"
          },
          "rights": {
            "type": [
              "string",
              "null"
            ],
            "description": "Recorded rights context; check source terms independently."
          },
          "metadata": {
            "type": "object"
          }
        },
        "additionalProperties": true
      },
      "SearchResponse": {
        "type": "object",
        "required": [
          "status",
          "results",
          "requestId"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "no_match"
            ]
          },
          "requestId": {
            "type": "string"
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "selected": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Visual"
              },
              {
                "type": "null"
              }
            ]
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Visual"
            }
          },
          "retrieval": {
            "type": "object"
          }
        },
        "additionalProperties": true
      }
    }
  }
}
