{
  "openapi": "3.1.0",
  "info": {
    "title": "Stockfoil",
    "version": "0.1.0",
    "description": "UK, Dutch and French medical device field safety notices, linked across countries by a fixed rule."
  },
  "servers": [
    {
      "url": "https://stockfoil.bulkhead.solutions"
    }
  ],
  "security": [
    {
      "bearer": []
    },
    {}
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "paths": {
    "/v1/tools/notices_since": {
      "post": {
        "operationId": "notices_since",
        "summary": "Notices published or updated since a date",
        "description": "Lists medical device field safety notices that MHRA (UK), IGJ (NL) and ANSM (FR) published, updated or first listed on or after a date, oldest change first, one record shape for all three. Each result says why it is there: change is published (publishedDate on or after since), updated (an older notice the authority updated since, such as an ANSM item MIS À JOUR or a republished MHRA page) or listed_late (an older notice Stockfoil first saw since), with changeDate. Call it on a schedule with the date you last checked, then page with nextOffset; pass changes to narrow it. Each record has the title as published, manufacturer, device, models, the authority's references, noticeDate (the date on the notice, sometimes only a month) and publishedDate (when the authority listed it) kept apart, because MHRA sometimes republishes old weekly pages late. It also gives the authority page (url) and the manufacturer's letter (letterUrl, a link only; letters lists every letter when MHRA prints several). For one maker or device call search_notices; for the same notice in another country call linked_notices. Coverage starts at coverage.publishedSince. A notice missing here may still exist: read warnings.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "since"
                ],
                "additionalProperties": false,
                "properties": {
                  "since": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "YYYY-MM-DD, usually the day you last checked. Notices published, updated or first listed on or after this day."
                  },
                  "countries": {
                    "type": [
                      "array",
                      "string"
                    ],
                    "items": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 2
                    },
                    "maxItems": 4,
                    "maxLength": 20,
                    "description": "Country codes: UK (MHRA), NL (IGJ), FR (ANSM), as a list or one string (\"FR\" or \"UK,NL\"). Defaults to all three. DE alone returns source_not_served; DE with covered countries answers those, with a warning."
                  },
                  "kinds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "field_safety_notice",
                        "device_safety_information"
                      ]
                    },
                    "description": "Default both; an empty list means both. device_safety_information is MHRA's own DSI alert, UK only."
                  },
                  "changes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "published",
                        "updated",
                        "listed_late"
                      ]
                    },
                    "description": "Default all three. Pass [\"published\"] for new notices only."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "Default 25."
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "nextOffset from the previous page."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "dataVersion",
                    "coverage",
                    "sources",
                    "attribution",
                    "warnings"
                  ],
                  "properties": {
                    "dataVersion": {
                      "type": "string"
                    },
                    "coverage": {
                      "type": "object"
                    },
                    "sources": {
                      "type": "array"
                    },
                    "attribution": {
                      "type": "array"
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/search_notices": {
      "post": {
        "operationId": "search_notices",
        "summary": "Search notices by manufacturer or device",
        "description": "Finds field safety notices by manufacturer, device name or model, across MHRA (UK), IGJ (NL) and ANSM (FR), newest first. Call it to check an installed device or a competitor's actions. Manufacturer matching ignores legal forms and places (Philips Medical Systems Nederland B.V. matches Philips) but knows no parent companies, so search Getinge and Datascope separately. Device matching needs every word you give (articles such as the, de or van aside), ignores case, accents and trade mark signs, and searches the title, device name, device term and models as each authority prints them, in English, French or Dutch, so try the brand or model rather than a generic term. Words of three letters or more also match a longer printed word they begin (Azurion, Azurions) or a printed abbreviation at least half their length (Ket for ketone); shorter words and numbers must match whole. Returns records with their authority page and letter link. A search with no hits does not prove no notice exists: see coverage and warnings. For a reference number, call notice_by_reference.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "manufacturer": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 120,
                    "description": "For example Beckman Coulter or Fresenius Medical Care."
                  },
                  "device": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 120,
                    "description": "Device or model words, for example Access HIV, 6008 CAREsystem or StatStrip."
                  },
                  "countries": {
                    "type": [
                      "array",
                      "string"
                    ],
                    "items": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 2
                    },
                    "maxItems": 4,
                    "maxLength": 20,
                    "description": "Country codes: UK (MHRA), NL (IGJ), FR (ANSM), as a list or one string (\"FR\" or \"UK,NL\"). Defaults to all three. DE alone returns source_not_served; DE with covered countries answers those, with a warning."
                  },
                  "from": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "publishedDate on or after."
                  },
                  "to": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "publishedDate on or before."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "Default 25."
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "nextOffset from the previous page."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "dataVersion",
                    "coverage",
                    "sources",
                    "attribution",
                    "warnings"
                  ],
                  "properties": {
                    "dataVersion": {
                      "type": "string"
                    },
                    "coverage": {
                      "type": "object"
                    },
                    "sources": {
                      "type": "array"
                    },
                    "attribution": {
                      "type": "array"
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/notice_by_reference": {
      "post": {
        "operationId": "notice_by_reference",
        "summary": "Look up a notice by its authority reference",
        "description": "Returns the notice that carries an authority's reference, given alone or in a line copied from a letter (MHRA reference: 41295467, Rappel n° R2631739): an MHRA reference (41295467), an MHRA case reference (2026/010/009/601/195), an MHRA Device Safety Information reference (DSI/2026/013), an ANSM number (R2631739), an IGJ file number (fame-2611-00064) or page URL, or a Stockfoil id (uk:41295467). Call it when a letter, a ticket or a colleague quotes a number. found false means no notice published since coverage.publishedSince carries it, not that it does not exist. Spacing and dashes are forgiven (DSI 2026/013, FSN HME 2026 02 EN). A manufacturer's own FSN number (FSN-HME-2026-02-EN) is found only where MHRA prints it on its weekly page; otherwise it sits inside the letter, which Stockfoil does not read. BfArM references (48860/26) return source_not_served. Each result says how many notices in other countries it links to (call linked_notices for them) and, in relatedInCountry, which notices in its own country share a published reference with it: an MHRA original and its update, one IGJ file under two page dates.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "reference"
                ],
                "additionalProperties": false,
                "properties": {
                  "reference": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300,
                    "description": "The reference as printed by the authority, or a Stockfoil id."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "dataVersion",
                    "coverage",
                    "sources",
                    "attribution",
                    "warnings"
                  ],
                  "properties": {
                    "dataVersion": {
                      "type": "string"
                    },
                    "coverage": {
                      "type": "object"
                    },
                    "sources": {
                      "type": "array"
                    },
                    "attribution": {
                      "type": "array"
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/linked_notices": {
      "post": {
        "operationId": "linked_notices",
        "summary": "The same notice in other countries",
        "description": "For one notice, says per other country whether a notice about the same device line was published there. No authority shares an identifier, so Stockfoil applies one fixed rule, returned in rules: same manufacturer, at most 120 days apart, distinctive device words in common, at least two and at least half of the shorter name (or the whole of one name), and no conflict in the kind of device (strips never link to a meter). Status same_device comes with the evidence (shared words, days apart, how the maker matched); it means the same maker's same device line was in a notice there, and sameAction stays unknown because only the letters carry the manufacturer's FSCA number. Status unknown means the rule did not fire: it lists up to ten same-maker notices that fell short, closest first, with the reason, the shared words and the days apart, and never claims they match or that the notice was not sent. sameCountry lists notices in the notice's own country that share a published reference with it. Call it after notices_since, search_notices or notice_by_reference with the id they return. It cannot see Germany, the manufacturer's letters or unpublished notices.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "reference"
                ],
                "additionalProperties": false,
                "properties": {
                  "reference": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300,
                    "description": "A Stockfoil id such as uk:41298418, or any reference notice_by_reference accepts."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "dataVersion",
                    "coverage",
                    "sources",
                    "attribution",
                    "warnings"
                  ],
                  "properties": {
                    "dataVersion": {
                      "type": "string"
                    },
                    "coverage": {
                      "type": "object"
                    },
                    "sources": {
                      "type": "array"
                    },
                    "attribution": {
                      "type": "array"
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/source_status": {
      "post": {
        "operationId": "source_status",
        "summary": "Health and coverage of each authority source",
        "description": "Reports, per authority (mhra, igj, ansm), the refresh state (ok, error, drift, robots_blocked or never_fetched), last attempt and last success, record count, earliest and latest publication date held, how many records have a manufacturer and a notice date, how many link to another country, and the licence and attribution to use. Also returns the link rules in force and the countries not covered, with the reason. Call it before relying on a result that carries a warning, or to tell a user what Stockfoil can and cannot see. It reports on the data, not on device safety.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "source": {
                    "type": "string",
                    "maxLength": 8,
                    "description": "mhra, igj or ansm, or a country code UK, NL, FR. Defaults to all."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "dataVersion",
                    "sources"
                  ],
                  "properties": {
                    "dataVersion": {
                      "type": "string"
                    },
                    "sources": {
                      "type": "array"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    }
  }
}
