{
  "openapi": "3.1.0",
  "info": {
    "title": "Hatchmark",
    "version": "0.1.0",
    "description": "Can poultry, hatching eggs or poultry meat from a US, UK or Canadian zone enter the EU on a date?"
  },
  "servers": [],
  "security": [
    {
      "bearer": []
    },
    {}
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "paths": {
    "/v1/tools/entry_status": {
      "post": {
        "operationId": "entry_status",
        "summary": "Is a zone open for EU entry on a date",
        "description": "Says whether a consignment from one third-country zone may enter the EU on a given day under Annex V (live poultry, hatching eggs, day-old chicks: BPP, BPR, DOC, DOR, HEP, HER, SPF, SP, SR, POU-LT20, HE-LT20) or Annex XIV (fresh meat of poultry, ratites and game birds: POU, RAT, GBM) of Implementing Regulation (EU) 2021/404, and returns status (open, suspended, partly_suspended, not_listed, or zone_not_yet_listed when as_known_on predates the act that created the zone), each row's closing and opening dates, the act that set the closing date and the act that reopened it with Official Journal links, the specific conditions (P1: HPAI suspension), the 90-day rule for meat slaughtered before the closing date, the zone's description with its published centre and radius, and whether EUR-Lex's consolidated text shows it yet. Call it for any question like \"can we ship hatching eggs from US-2.1420 on 1 October\" or \"is GB-2.472 closed for poultry meat\". Pass as_known_on to replay what the law said on an earlier day, for example when a closing was published after the consignment left; changedAfterAsKnownOn then lists what later acts changed. not_listed means the zone has no row for that commodity. A zone code ending .N is part of the region -2; a place outside every such zone falls under the -1 row. It does not know where a farm is (use zones_at_point or list_zones), other annexes, or the certificate's other conditions.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "zone"
                ],
                "additionalProperties": false,
                "properties": {
                  "zone": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 20,
                    "description": "Zone code as the annex prints it, for example US-2.1420, GB-2.472, CA-2.344, US-1, AU-0."
                  },
                  "commodity": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 60,
                    "description": "Optional. A category code from Annex V (BPP, BPR, DOC, DOR, HEP, HER, SPF, SP, SR, POU-LT20, HE-LT20) or Annex XIV (POU, RAT, GBM), or words such as hatching eggs, day-old chicks, breeding poultry, poultry meat, game bird meat. Omit for every category the zone lists."
                  },
                  "date": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "The day the consignment is certified or enters the EU, YYYY-MM-DD. Defaults to today in Brussels."
                  },
                  "as_known_on": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Optional. Replay the law as published on this day (YYYY-MM-DD, from 2025-12-10): only acts that had taken effect by then count. Omit to use every act held, which is the current law."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "dataVersion",
                    "retrieved",
                    "sources",
                    "attribution",
                    "warnings",
                    "complete"
                  ],
                  "properties": {
                    "dataVersion": {
                      "type": "string"
                    },
                    "retrieved": {
                      "type": "string"
                    },
                    "sources": {
                      "type": "array"
                    },
                    "attribution": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "complete": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/zones_at_point": {
      "post": {
        "operationId": "zones_at_point",
        "summary": "Which listed zones contain a position",
        "description": "Tests a latitude and longitude against every zone of a country whose description prints coordinates, and returns the zones that contain it or lie near it, with status on the date, the distance from the published point, and a verdict (inside_a_suspended_zone, possibly_inside_a_suspended_zone, inside_listed_zones_none_suspended, no_published_circle_contains_the_point). Call it when you have a farm's or a supplier's position rather than a zone code. United Kingdom zones are circles with a stated centre; United States zones are circles described as starting at a 'North point', so both readings (the point as centre, and as the north end of the circle) are tested and a disagreement is reported as ambiguous; Canadian zones are municipality lists drawn around a point, reported as near_inside at most. Coordinates are rounded as the act prints them; a point within that rounding of the edge is reported as edge. Zones described only in words, or with misprinted coordinates, cannot be tested and are named in warnings. It never names a holding or calls a point a farm.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "lat",
                  "lon"
                ],
                "additionalProperties": false,
                "properties": {
                  "lat": {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90,
                    "description": "Latitude in decimal degrees, WGS84, north positive."
                  },
                  "lon": {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180,
                    "description": "Longitude in decimal degrees, WGS84, east positive (the United States and Canada are negative)."
                  },
                  "country": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 40,
                    "description": "Optional. US, GB, CA or CL. Inferred from the position when it is unambiguous."
                  },
                  "commodity": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 60,
                    "description": "Optional. A category code from Annex V (BPP, BPR, DOC, DOR, HEP, HER, SPF, SP, SR, POU-LT20, HE-LT20) or Annex XIV (POU, RAT, GBM), or words such as hatching eggs, day-old chicks, breeding poultry, poultry meat, game bird meat. Omit for every category the zone lists."
                  },
                  "date": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "The day the consignment is certified or enters the EU, YYYY-MM-DD. Defaults to today in Brussels."
                  },
                  "as_known_on": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Optional. Replay the law as published on this day (YYYY-MM-DD, from 2025-12-10): only acts that had taken effect by then count. Omit to use every act held, which is the current law."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "Most zones to return, nearest first. Default 25."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "dataVersion",
                    "retrieved",
                    "sources",
                    "attribution",
                    "warnings",
                    "complete"
                  ],
                  "properties": {
                    "dataVersion": {
                      "type": "string"
                    },
                    "retrieved": {
                      "type": "string"
                    },
                    "sources": {
                      "type": "array"
                    },
                    "attribution": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "complete": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/list_zones": {
      "post": {
        "operationId": "list_zones",
        "summary": "A country's zones by status, date or place",
        "description": "Lists one country's zones in Annex V and XIV with their status on a day: by default the suspended ones, newest closing first, with counts of zones suspended and suspended with no reopening date. Call it to see what is closed now in a country, to find the zone codes whose description names a county, state, province or town (place: Stearns, Northumberland, Manitoba), or before a call to entry_status when you only have a place name. status: suspended (default), open or all. Paginated with limit and nextCursor; the United States lists about 1,400 zones. Descriptions are cut to their first lines; entry_status gives the full text.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "country"
                ],
                "additionalProperties": false,
                "properties": {
                  "country": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 40,
                    "description": "Third country: ISO code (US, GB or UK, CA, CL, BR) or English name."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "suspended",
                      "open",
                      "all"
                    ],
                    "description": "Which zones to list. Default suspended."
                  },
                  "place": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 80,
                    "description": "Optional. Words the zone description must contain, for example Stearns, Kandiyohi County, Northumberland, Manitoba."
                  },
                  "commodity": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 60,
                    "description": "Optional. A category code from Annex V (BPP, BPR, DOC, DOR, HEP, HER, SPF, SP, SR, POU-LT20, HE-LT20) or Annex XIV (POU, RAT, GBM), or words such as hatching eggs, day-old chicks, breeding poultry, poultry meat, game bird meat. Omit for every category the zone lists."
                  },
                  "date": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "The day the consignment is certified or enters the EU, YYYY-MM-DD. Defaults to today in Brussels."
                  },
                  "as_known_on": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Optional. Replay the law as published on this day (YYYY-MM-DD, from 2025-12-10): only acts that had taken effect by then count. Omit to use every act held, which is the current law."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Default 50."
                  },
                  "cursor": {
                    "type": "string",
                    "maxLength": 12,
                    "description": "nextCursor from the previous page, as given."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "dataVersion",
                    "retrieved",
                    "sources",
                    "attribution",
                    "warnings",
                    "complete"
                  ],
                  "properties": {
                    "dataVersion": {
                      "type": "string"
                    },
                    "retrieved": {
                      "type": "string"
                    },
                    "sources": {
                      "type": "array"
                    },
                    "attribution": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "complete": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/zone_history": {
      "post": {
        "operationId": "zone_history",
        "summary": "Every act that touched a zone",
        "description": "Returns, in the order they took effect, every version of one zone's rows in Annex V and Annex XIV and of its description: the act, the day it took effect, the closing and opening dates it printed, and any misprint Hatchmark read through or consolidation it corrected. Call it to explain how a zone came to be open or closed, to cite the act that changed a date, or when entry_status warns that the annexes or the consolidated text disagree. Acts from 10 December 2025 are held one by one; earlier rows show only the last act EUR-Lex's consolidation names for them.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "zone"
                ],
                "additionalProperties": false,
                "properties": {
                  "zone": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 20,
                    "description": "Zone code as the annex prints it, for example US-2.1420, GB-2.472, CA-2.344, US-1, AU-0."
                  },
                  "annex": {
                    "type": "string",
                    "enum": [
                      "V",
                      "XIV"
                    ],
                    "description": "Optional. Annex V (live poultry and germinal products) or XIV (meat). Omit for both."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "dataVersion",
                    "retrieved",
                    "sources",
                    "attribution",
                    "warnings",
                    "complete"
                  ],
                  "properties": {
                    "dataVersion": {
                      "type": "string"
                    },
                    "retrieved": {
                      "type": "string"
                    },
                    "sources": {
                      "type": "array"
                    },
                    "attribution": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "complete": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/changes_since": {
      "post": {
        "operationId": "changes_since",
        "summary": "What new acts closed or reopened",
        "description": "Lists the acts amending Annex V or XIV that took effect or were published on or after a date, newest first, each with the zones it closed, reopened, corrected, added or removed, and whether EUR-Lex has consolidated it yet. Call it on a schedule to keep a watch list current, or to answer \"what changed for Canada since 1 October\". country narrows the zones. Paginated with limit and nextCursor. For one zone's full story, call zone_history.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "since": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "YYYY-MM-DD, from 2025-12-10. Defaults to 30 days ago."
                  },
                  "country": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 40,
                    "description": "Optional. Only zones of this country."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50,
                    "description": "Acts per page. Default 10."
                  },
                  "cursor": {
                    "type": "string",
                    "maxLength": 12,
                    "description": "nextCursor from the previous page, as given."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "dataVersion",
                    "retrieved",
                    "sources",
                    "attribution",
                    "warnings",
                    "complete"
                  ],
                  "properties": {
                    "dataVersion": {
                      "type": "string"
                    },
                    "retrieved": {
                      "type": "string"
                    },
                    "sources": {
                      "type": "array"
                    },
                    "attribution": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "complete": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    }
  }
}
