{
  "openapi": "3.1.0",
  "info": {
    "title": "Mutatis",
    "version": "0.1.0",
    "description": "What changed in EU medicine product information: section-level SmPC change records with procedure, decision date and official links."
  },
  "servers": [
    {
      "url": "https://mutatis.bulkhead.solutions"
    }
  ],
  "security": [
    {
      "bearer": []
    },
    {}
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "paths": {
    "/v1/tools/list_changes": {
      "post": {
        "operationId": "list_changes",
        "summary": "List EU product information changes",
        "description": "Lists change records for EU medicine product information (SmPC) in a date range, newest first, optionally only those touching one section (such as 4.8 undesirable effects), one product or one procedure. Call it to answer \"which medicines changed section 4.4 since June\", \"what changed for Keytruda this year\" or \"which labels did PSUSA/00010403/202409 change\". Without since it covers the last 90 days of decisions, or every tracked record when product or procedure is given. Each record names the medicine, Commission decision date, procedures, changed sections and the official PDF; call get_change for one record's section facts. Dates are Commission decision dates from the Union Register, except for provisional records: EMA's published PDF, newer than the register's latest annex, with decision null and the decision date EMA reports (each record's date_source says which). A section filter matches records where that section's text changed or it was added (section_match shows which); ids such as 4.8#2 are section 4.8 of the second SmPC in a multi-strength annex. Wording is not served: it answers which sections changed and when, not what the new text says. Pages of at most 100; follow next_offset. It knows only tracked medicines and versions, stated in coverage; it never says why a change was made, and therapeutic areas such as oncology are not a filter.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "since": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Earliest decision date, YYYY-MM-DD. Default: 90 days before the newest decision in the data; with product or procedure, every tracked record."
                  },
                  "until": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Latest decision date, YYYY-MM-DD. Default: no limit."
                  },
                  "section": {
                    "type": "string",
                    "pattern": "^(0|[1-9]|1[0-2])(\\.[1-9])?$|^(annex_ii|labelling|package_leaflet)$",
                    "description": "One QRD section: an SmPC number such as 4.8 (undesirable effects), 4.4 (warnings) or 6.3 (shelf life), matching that section in every SmPC of the annex; or annex_ii, labelling, package_leaflet. A bare 4, 5 or 6 is only that heading's own text, not its subsections. 0 is the text before section 1."
                  },
                  "product": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "description": "EMA product number (EMEA/H/C/003820, or just 3820), EU number (EU/1/15/1024) or medicine name (Keytruda)."
                  },
                  "procedure": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 80,
                    "description": "Only records that implemented this procedure, in any spelling (PSUSA/00010403/202409, EMA/VR/0000336194, II/0154). A PSUSA or worksharing procedure can change several medicines at once."
                  },
                  "wording_only": {
                    "type": "boolean",
                    "description": "true leaves out sections whose only differences are punctuation, case or hyphenation. Default false."
                  },
                  "include_removed": {
                    "type": "boolean",
                    "description": "With section: also match records where that section disappeared because a whole SmPC (one strength or form) was withdrawn from the annex. Default false: only sections whose text changed, or that were added."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "At most this many records. Default 25."
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000,
                    "description": "Skip this many records, for paging. Default 0."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/get_change": {
      "post": {
        "operationId": "get_change",
        "summary": "Get one product information change",
        "description": "Returns one change record for a medicine as section facts, not wording (the text itself is withheld pending rights clearance): which SmPC sections changed between the official version and the one before it, with kind (text, editorial), word and edit counts, the Commission decision, the procedures it implemented and links to both official documents. Excerpts are served only where the operator sets MUTATIS_EXCERPTS=1 (emails and phone numbers masked); otherwise read the wording in the linked PDFs. Give a procedure number (II/0154, EMEA/H/C/003820/II/0154, VR/0000336194, PSUSA/00010403/202409) or leave it out for the latest change. Sections are compared after removing page numbers, repeated table headers and line breaks, so only real text edits count; edits that only change punctuation are marked kind editorial. Pass section to narrow a large record. It never explains the clinical meaning.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "product"
                ],
                "properties": {
                  "product": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "description": "EMA product number (EMEA/H/C/003820, or just 3820), EU number (EU/1/15/1024) or medicine name (Keytruda)."
                  },
                  "procedure": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 80,
                    "description": "Procedure number as EMA or the Union Register writes it. Default: the latest change."
                  },
                  "section": {
                    "type": "string",
                    "pattern": "^(0|[1-9]|1[0-2])(\\.[1-9])?$|^(annex_ii|labelling|package_leaflet)$",
                    "description": "One QRD section: an SmPC number such as 4.8 (undesirable effects), 4.4 (warnings) or 6.3 (shelf life), matching that section in every SmPC of the annex; or annex_ii, labelling, package_leaflet. A bare 4, 5 or 6 is only that heading's own text, not its subsections. 0 is the text before section 1."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/diff_versions": {
      "post": {
        "operationId": "diff_versions",
        "summary": "Compare two versions of a medicine's product information",
        "description": "Compares any two tracked versions of one medicine's EU product information and returns which sections differ, plus every change record in between. Use it when the versions are not neighbours, such as \"what changed in the Ozempic SmPC since 2024\" (from 2024-01-01: the version in force on that date). A version is an annex id, a date (YYYY-MM-DD: the version in force that day), a procedure, \"latest\" or \"previous\". SmPCs of a multi-strength annex are aligned by product name. When the versions are neighbours the one change record is included in full; otherwise each record in between is listed. Untracked versions return not_tracked with the coverage, never a guess.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "product",
                  "from"
                ],
                "properties": {
                  "product": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "description": "EMA product number (EMEA/H/C/003820, or just 3820), EU number (EU/1/15/1024) or medicine name (Keytruda)."
                  },
                  "from": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "description": "Older version: annex id, date (the version in force that day), procedure, \"previous\" or \"latest\"."
                  },
                  "to": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "description": "Newer version, same forms. Default \"latest\"."
                  },
                  "section": {
                    "type": "string",
                    "pattern": "^(0|[1-9]|1[0-2])(\\.[1-9])?$|^(annex_ii|labelling|package_leaflet)$",
                    "description": "One QRD section: an SmPC number such as 4.8 (undesirable effects), 4.4 (warnings) or 6.3 (shelf life), matching that section in every SmPC of the annex; or annex_ii, labelling, package_leaflet. A bare 4, 5 or 6 is only that heading's own text, not its subsections. 0 is the text before section 1."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/product_history": {
      "post": {
        "operationId": "product_history",
        "summary": "Product information version history of a medicine",
        "description": "Returns the timeline of official EU product information versions for one medicine from the Union Register: each Commission decision with a new annex, its date, the procedures it implemented, whether Mutatis tracks it, and which sections changed. Includes EMA's newer published version when the register has not caught up (marked provisional), and whether EMA's live PDF is byte-identical to the latest official annex. Use it before get_change or diff_versions to pick versions, or to answer \"when was this SmPC last updated\". It lists versions, not wording.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "product"
                ],
                "properties": {
                  "product": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "description": "EMA product number (EMEA/H/C/003820, or just 3820), EU number (EU/1/15/1024) or medicine name (Keytruda)."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Newest this many versions. Default 50."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/changes_since": {
      "post": {
        "operationId": "changes_since",
        "summary": "Poll for new change records",
        "description": "Returns change records added or revised since a cursor, oldest first, so an agent can poll on a schedule instead of using webhooks. To receive only records added from now on, call with cursor \"latest\" (an empty page and a cursor for now); to read every record from the beginning, leave cursor out. Store next_cursor and pass it back next time. Records are ordered by when Mutatis ingested them, not by decision date, so backfilled older decisions also arrive. Section and product filters apply to the page only; the cursor still advances, so keep calling while has_more is true even when a page is empty. A provisional record (EMA's PDF) is replaced by a new record with its own id once the register publishes the annex. Pages of at most 200.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "cursor": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 400,
                    "description": "next_cursor from the previous call, or \"latest\"."
                  },
                  "section": {
                    "type": "string",
                    "pattern": "^(0|[1-9]|1[0-2])(\\.[1-9])?$|^(annex_ii|labelling|package_leaflet)$",
                    "description": "One QRD section: an SmPC number such as 4.8 (undesirable effects), 4.4 (warnings) or 6.3 (shelf life), matching that section in every SmPC of the annex; or annex_ii, labelling, package_leaflet. A bare 4, 5 or 6 is only that heading's own text, not its subsections. 0 is the text before section 1."
                  },
                  "product": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "description": "EMA product number (EMEA/H/C/003820, or just 3820), EU number (EU/1/15/1024) or medicine name (Keytruda)."
                  },
                  "include_removed": {
                    "type": "boolean",
                    "description": "With section: also match a section removed with a withdrawn SmPC. Default false."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "At most this many records scanned. Default 50."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    }
  }
}
