{
  "openapi": "3.1.0",
  "info": {
    "title": "Shorewrit",
    "version": "0.1.0",
    "description": "EU directive transposition ledger: national measures merged with the Commission's infringement stage, with dated history."
  },
  "servers": [],
  "security": [
    {
      "bearer": []
    },
    {}
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "paths": {
    "/v1/tools/transposition_status": {
      "post": {
        "operationId": "transposition_status",
        "summary": "Transposition status of a directive in one Member State",
        "description": "For one EU directive and one Member State: the national measures notified to EUR-Lex (count, newest notification date, the measures themselves with official journal reference, publication date and link, 10 per page), the Commission's non-communication infringement case if any (INFR number, every decision with its date, current stage: formal notice, reasoned opinion, referral to the Court, closure), the deadline, and one merged position: not_yet_due, measures_notified, overdue_nothing_notified, infringement_open or infringement_closed, with a one-sentence summary to quote. Pass as_of for the position on a past date. Call it for questions such as has Spain transposed NIS 2, by which act and since when. Do not call it for all 27 countries at once (use directive_overview) or to find a directive by subject (use find_directive). It cannot say whether national law is complete or correct, which no official source states; titles are in the national language; national act texts are linked, not served.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "directive",
                  "country"
                ],
                "properties": {
                  "directive": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "The directive: a CELEX number (32022L2555), its number (2022/2555 or Directive (EU) 2022/2555), or its official short name where the title has one (NIS 2). Use find_directive when you only know the subject."
                  },
                  "country": {
                    "type": "string",
                    "maxLength": 40,
                    "description": "EU Member State: two-letter code (ES, DE, EL or GR for Greece), three-letter code, or English name (Spain)."
                  },
                  "as_of": {
                    "type": "string",
                    "maxLength": 10,
                    "description": "Optional past date, YYYY-MM-DD: the position on that day, rebuilt from notification and decision dates. Defaults to the data date."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 50,
                    "description": "Measures to list, default 10."
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Skip this many measures; use next_offset from the previous answer."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/directive_overview": {
      "post": {
        "operationId": "directive_overview",
        "summary": "All 27 Member States for one directive",
        "description": "One row per EU Member State for one directive: merged position, number of measures notified, newest notification date and the current non-communication case stage, plus counts per position and the list of states that have notified nothing after the deadline. Call it for which countries have not transposed X, how many states have notified the Pay Transparency Directive, or before choosing where to look closer. Do not call it for the measures themselves or the case decisions (use transposition_status for one country). It cannot rank countries by quality of transposition; a measure count is not a status.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "directive"
                ],
                "properties": {
                  "directive": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "The directive: a CELEX number (32022L2555), its number (2022/2555 or Directive (EU) 2022/2555), or its official short name where the title has one (NIS 2). Use find_directive when you only know the subject."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/country_overview": {
      "post": {
        "operationId": "country_overview",
        "summary": "One Member State across directives",
        "description": "One Member State's merged position on every directive in scope (176 with deadlines from 2022 to 2027), newest deadline first, 25 per page, with counts per position. Filter with position (for example infringement_open or overdue_nothing_notified) and a deadline range. Call it for what is Spain behind on, which open infringement cases does Poland have for late transposition, or to build a country watch list. Do not call it for one directive (use transposition_status). It covers non-communication only, not cases about wrong application of EU law.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "country"
                ],
                "properties": {
                  "country": {
                    "type": "string",
                    "maxLength": 40,
                    "description": "EU Member State: two-letter code (ES, DE, EL or GR for Greece), three-letter code, or English name (Spain)."
                  },
                  "position": {
                    "type": [
                      "array",
                      "string"
                    ],
                    "maxItems": 5,
                    "maxLength": 200,
                    "items": {
                      "type": "string",
                      "enum": [
                        "not_yet_due",
                        "measures_notified",
                        "overdue_nothing_notified",
                        "infringement_open",
                        "infringement_closed"
                      ]
                    },
                    "description": "Only these positions, a list or comma-separated: not_yet_due, measures_notified, overdue_nothing_notified, infringement_open, infringement_closed."
                  },
                  "deadline_from": {
                    "type": "string",
                    "maxLength": 10,
                    "description": "Only directives whose deadline is on or after this date, YYYY-MM-DD."
                  },
                  "deadline_to": {
                    "type": "string",
                    "maxLength": 10,
                    "description": "Only directives whose deadline is on or before this date, YYYY-MM-DD."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "Rows per page, default 25."
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Skip this many rows; use next_offset."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/transposition_history": {
      "post": {
        "operationId": "transposition_history",
        "summary": "Dated history of one directive in one Member State",
        "description": "The dated timeline for one directive in one Member State: deadlines, every measure notification (with publication date and, where Shorewrit saw it later than the source date, the day it first appeared), every infringement decision, and measures that disappeared from EUR-Lex after Shorewrit had seen them. Pass as_of to get the position on that day as well, rebuilt from source dates and checked against Shorewrit's own snapshot. Call it for since when, what happened first, or what the position was on a past date, for example at a contract or audit date. Do not call it for the current position alone (use transposition_status). Before Shorewrit's first snapshot (9 Nov 2026) it cannot see measures that were notified and later withdrawn.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "directive",
                  "country"
                ],
                "properties": {
                  "directive": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "The directive: a CELEX number (32022L2555), its number (2022/2555 or Directive (EU) 2022/2555), or its official short name where the title has one (NIS 2). Use find_directive when you only know the subject."
                  },
                  "country": {
                    "type": "string",
                    "maxLength": 40,
                    "description": "EU Member State: two-letter code (ES, DE, EL or GR for Greece), three-letter code, or English name (Spain)."
                  },
                  "as_of": {
                    "type": "string",
                    "maxLength": 10,
                    "description": "Optional date, YYYY-MM-DD, to also return the position on that day."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Events per page, default 50."
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Skip this many events; use next_offset."
                  }
                }
              }
            }
          }
        },
        "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": "Changes since a date or cursor",
        "description": "What changed across the ledger since your last call: new national measures notified, infringement decisions (formal notice, reasoned opinion, referral, closure) and measures withdrawn from EUR-Lex, oldest first, 50 per page. Pass since as a date (YYYY-MM-DD, everything after that day) or the next_cursor from your previous call; with neither you get the last 7 days. Filter with directives, countries and kinds (measure_notified, infringement_decision, measure_withdrawn). Call it on a schedule to watch a portfolio of directives, instead of polling each one. Each change is dated when it became visible, so late notifications are not missed. It cannot tell you about national laws that were never notified to EUR-Lex.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "since": {
                    "type": "string",
                    "maxLength": 300,
                    "description": "A date YYYY-MM-DD (changes after that day) or next_cursor from the previous call."
                  },
                  "directives": {
                    "type": [
                      "array",
                      "string"
                    ],
                    "maxItems": 100,
                    "maxLength": 3000,
                    "items": {
                      "type": "string",
                      "maxLength": 120
                    },
                    "description": "Only these directives (CELEX, number or short name), a list or comma-separated."
                  },
                  "countries": {
                    "type": [
                      "array",
                      "string"
                    ],
                    "maxItems": 27,
                    "maxLength": 400,
                    "items": {
                      "type": "string",
                      "maxLength": 40
                    },
                    "description": "Only these Member States, a list or comma-separated."
                  },
                  "kinds": {
                    "type": [
                      "array",
                      "string"
                    ],
                    "maxItems": 3,
                    "maxLength": 100,
                    "items": {
                      "type": "string",
                      "enum": [
                        "measure_notified",
                        "infringement_decision",
                        "measure_withdrawn"
                      ]
                    },
                    "description": "Only these kinds: measure_notified, infringement_decision, measure_withdrawn."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Changes per page, 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/find_directive": {
      "post": {
        "operationId": "find_directive",
        "summary": "Find a directive by subject, number or name",
        "description": "Searches the 176 directives in scope (adopted from 2019, first transposition deadline from 2022 to 2027) by words in the official English title, number or short name, optionally within a deadline range, and returns each one's CELEX number, deadline, how many Member States have notified measures and how many non-communication cases are open. Call it first when the user names a subject (pay transparency, critical entities, accessibility) rather than a number, or to list directives falling due in a period. Do not call it when you already have the CELEX number. Directives outside the scope are not listed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "query": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Words from the title (pay transparency), a number (2023/970) or a short name (NIS 2)."
                  },
                  "deadline_from": {
                    "type": "string",
                    "maxLength": 10,
                    "description": "Only directives with a deadline on or after this date, YYYY-MM-DD."
                  },
                  "deadline_to": {
                    "type": "string",
                    "maxLength": 10,
                    "description": "Only directives with a deadline on or before this date, YYYY-MM-DD."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50,
                    "description": "Results, default 10."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    }
  }
}
