{
  "openapi": "3.1.0",
  "info": {
    "title": "Psilocybin Research public read-only API",
    "version": "1.0.0",
    "description": "Existing anonymous GET endpoints for source-labeled bibliographic and trial metadata. No subscription, messaging, curation or private-source operations.",
    "termsOfService": "https://psilocybin-research.com/editorial-policy.php"
  },
  "servers": [
    {
      "url": "https://psilocybin-research.com"
    }
  ],
  "paths": {
    "/api/v1/papers": {
      "get": {
        "operationId": "searchPublications",
        "summary": "Search public bibliographic metadata",
        "description": "Search titles, authors, identifiers and indexed metadata. Retain source/status labels and verify original sources. Returns papers and pagination data.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Title, author, DOI, PMID, or topic text.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page number.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "description": "Bounded page size; start with 20.",
            "schema": {
              "type": "integer",
              "minimum": 5,
              "maximum": 200,
              "default": 20
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Publication order.",
            "schema": {
              "type": "string",
              "enum": [
                "newly_added",
                "newest",
                "oldest"
              ],
              "default": "newly_added"
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "Publication year.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "compound",
            "in": "query",
            "description": "Filter the indexed substance.",
            "schema": {
              "type": "string",
              "enum": [
                "psilocybin",
                "psilocin"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public source-labeled metadata. Shape follows the existing endpoint; source abstracts/full texts are not included.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Request limit reached; retry later and respect Retry-After if provided."
          },
          "400": {
            "description": "Invalid query parameters."
          }
        }
      }
    },
    "/api/v1/trials": {
      "get": {
        "operationId": "findIndexedTrials",
        "summary": "Filter indexed registry records",
        "description": "Registry status and milestone dates are descriptive, not evidence of efficacy or guaranteed result dates. Returns trials and facet/summary metadata.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Trial title, condition, or registry identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country",
            "in": "query",
            "description": "Registry location country, for example Germany.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sponsor",
            "in": "query",
            "description": "Sponsor name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "phase",
            "in": "query",
            "description": "Registry phase token, for example PHASE2.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Registry status token, for example RECRUITING.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "condition",
            "in": "query",
            "description": "Registry condition text.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public source-labeled metadata. Shape follows the existing endpoint; source abstracts/full texts are not included.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Request limit reached; retry later and respect Retry-After if provided."
          },
          "400": {
            "description": "Invalid query parameters."
          }
        }
      }
    },
    "/api.php": {
      "get": {
        "operationId": "readRecordOrCitation",
        "summary": "Read one public record or its citation",
        "parameters": [
          {
            "name": "resource",
            "in": "query",
            "description": "Choose a public record or citation.",
            "schema": {
              "type": "string",
              "enum": [
                "paper",
                "citation"
              ]
            },
            "required": true
          },
          {
            "name": "id",
            "in": "query",
            "description": "Positive catalogue record identifier.",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Public source-labeled metadata. Shape follows the existing endpoint; source abstracts/full texts are not included.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Request limit reached; retry later and respect Retry-After if provided."
          },
          "400": {
            "description": "Invalid query parameters."
          }
        }
      }
    }
  }
}
