{
  "openapi": "3.1.0",
  "info": {
    "title": "BioTender Agent API",
    "version": "1.0.0",
    "description": "Read-only static API for BioTender's public AI-for-Biology catalog and article text."
  },
  "servers": [
    {
      "url": "https://www.biotender.online"
    }
  ],
  "externalDocs": {
    "description": "Agent usage guide",
    "url": "https://www.biotender.online/llms.txt"
  },
  "paths": {
    "/api/v1/site.json": {
      "get": {
        "operationId": "getBioTenderSite",
        "summary": "Get site identity, capabilities, and endpoint links",
        "responses": {
          "200": {
            "description": "Site manifest",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteManifest"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/topics.json": {
      "get": {
        "operationId": "listBioTenderTopics",
        "summary": "List catalog topics and entry counts",
        "responses": {
          "200": {
            "description": "Topic catalog",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/entries.json": {
      "get": {
        "operationId": "listBioTenderEntries",
        "summary": "List all indexed articles, tools, reports, and resources",
        "responses": {
          "200": {
            "description": "Entry catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntryCatalog"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/search": {
      "get": {
        "operationId": "searchBioTenderEntries",
        "summary": "Server-side search (reserved, not yet implemented). Use client-side filtering on /api/v1/entries.json until this endpoint returns 200.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "topic",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10,
              "maximum": 30
            }
          }
        ],
        "responses": {
          "501": {
            "description": "Not yet implemented. Fall back to client-side search over /api/v1/entries.json."
          }
        }
      }
    },
    "/api/v1/entries/{entry_id}.json": {
      "get": {
        "operationId": "getBioTenderEntry",
        "summary": "Get one entry with headings and extracted full text",
        "parameters": [
          {
            "name": "entry_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Entry detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntryDetail"
                }
              }
            }
          },
          "404": {
            "description": "Unknown entry id"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SiteManifest": {
        "type": "object",
        "required": [
          "name",
          "url",
          "endpoints",
          "capabilities"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          },
          "endpoints": {
            "type": "object"
          },
          "capabilities": {
            "type": "object"
          }
        }
      },
      "EntrySummary": {
        "type": "object",
        "required": [
          "id",
          "title",
          "summary",
          "topic",
          "url",
          "api_url"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "page_title": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "entry_type": {
            "type": "string"
          },
          "topic": {
            "type": "string"
          },
          "topic_title": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "api_url": {
            "type": "string",
            "format": "uri"
          },
          "content_status": {
            "type": "string",
            "enum": [
              "full-text",
              "metadata-only"
            ]
          },
          "content_length": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "EntryCatalog": {
        "type": "object",
        "required": [
          "catalog_version",
          "total",
          "entries"
        ],
        "properties": {
          "catalog_version": {
            "type": "string"
          },
          "total": {
            "type": "integer"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EntrySummary"
            }
          }
        }
      },
      "EntryDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EntrySummary"
          },
          {
            "type": "object",
            "required": [
              "headings",
              "content_text"
            ],
            "properties": {
              "published": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "modified": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "headings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "content_text": {
                "type": "string"
              },
              "citation": {
                "type": "string",
                "description": "Ready-to-use citation string for this entry."
              }
            }
          }
        ]
      }
    }
  }
}
