{
  "openapi": "3.1.0",
  "info": {
    "title": "Sunsetry",
    "version": "0.1.0",
    "description": "EU anti-dumping and countervailing duties per producer: rate, TARIC additional code, act, and the measure's expiry and review status on any date."
  },
  "servers": [],
  "security": [
    {
      "bearer": []
    },
    {}
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "paths": {
    "/v1/tools/producer_duty": {
      "post": {
        "operationId": "producer_duty",
        "summary": "Duty and additional code for a named producer",
        "description": "Finds a producer by name (or a TARIC additional code such as C900) in the producer tables of EU anti-dumping and countervailing measures, and returns its duty rate, TARIC additional code, the measure, the act with its EUR-Lex link and table position, and whether that measure is in force on the date. Names are matched on their distinctive words, so Hitit Seramik finds Hitit Seramik Sanayi ve Ticaret A.S.; each match carries a score. Pass origin and cn_code or product to narrow it. If the company is not named, the answer says so and gives the rate and residual code for all other companies of the matching measures. Call it when you have a producer name from an invoice or a supplier list. Do not call it to list a whole table (use producer_table). It cannot verify that goods were made by that company, and a company renamed after the latest consolidated text may appear under its old name.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "company"
                ],
                "properties": {
                  "company": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 200,
                    "description": "Producer name as on the invoice, for example Hitit Seramik or Zhejiang Jiuli, or a TARIC additional code such as C900."
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 60,
                    "description": "Country of origin as a 2-letter code (CN, IN, TR, RU, VN) or a name (China, Türkiye, Viet Nam)."
                  },
                  "cn_code": {
                    "type": [
                      "string",
                      "integer"
                    ],
                    "maxLength": 20,
                    "description": "CN or TARIC code, 2 to 10 digits, spaces and dots allowed, for example 4412 33 10 or 6907."
                  },
                  "product": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Optional words from the product name, for example ceramic tiles, to narrow the match."
                  },
                  "date": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Date to answer for, YYYY-MM-DD, for example the date the goods are declared. Defaults to today."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 25,
                    "description": "Maximum matches, default 10."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/measures_for_goods": {
      "post": {
        "operationId": "measures_for_goods",
        "summary": "Measures covering a CN code or product from an origin",
        "description": "Lists the EU anti-dumping and countervailing measures that cover a CN or TARIC code (or product words) from an origin on a date, with each measure's state (in force, pending expiry review, expired, superseded), expiry date, the number of named producers and the duty and residual additional code for all other companies, plus open investigations on that product that have no duty yet. By default only measures in force on the date are listed; include=all adds expired and replaced ones. Paged: pass next_offset while has_more is true. Call it when you know the goods and origin but not the measure or the producer. It cannot judge classification or origin, and ex codes cover only part of a CN code, as the act describes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "cn_code": {
                    "type": [
                      "string",
                      "integer"
                    ],
                    "maxLength": 20,
                    "description": "CN or TARIC code, 2 to 10 digits, spaces and dots allowed, for example 4412 33 10 or 6907."
                  },
                  "product": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Words from the product name, for example birch plywood or ceramic tiles. Used when there is no cn_code, or together with it."
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 60,
                    "description": "Country of origin as a 2-letter code (CN, IN, TR, RU, VN) or a name (China, Türkiye, Viet Nam)."
                  },
                  "date": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Date to answer for, YYYY-MM-DD, for example the date the goods are declared. Defaults to today."
                  },
                  "include": {
                    "type": "string",
                    "enum": [
                      "in_force",
                      "all"
                    ],
                    "description": "in_force (default) or all, which adds expired, repealed and replaced measures."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 25,
                    "description": "Page size, default 10."
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 5000,
                    "description": "Offset from next_offset of the previous page."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/measure_status": {
      "post": {
        "operationId": "measure_status",
        "summary": "Lifecycle and status of one measure on a date",
        "description": "Whether one EU anti-dumping or countervailing measure is in force on a date and why: entry into force, expiry date (from the notice of impending expiry, or computed as five years and labelled so), the deadline for a review request, any expiry review that keeps it in force past expiry with its normal and latest end dates, extensions to other countries, renewals and the act that replaced it, amendments and repeals, each with its EUR-Lex link. Give measure as a regulation number, or product or cn_code with origin to find it. Call it before relying on a duty around an expiry date, as with birch plywood from Russia, due to expire on 10 Nov 2026 and kept in force by a review opened on 6 Nov 2026. It cannot know reviews or repeals published after its data date, and it does not read court judgments.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "measure": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "The regulation that imposed or extended the duty, as 2021/1930, (EU) 2021/1930 or CELEX 32021R1930."
                  },
                  "product": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Words from the product name, used with origin when measure is not known."
                  },
                  "cn_code": {
                    "type": [
                      "string",
                      "integer"
                    ],
                    "maxLength": 20,
                    "description": "CN or TARIC code, 2 to 10 digits, spaces and dots allowed, for example 4412 33 10 or 6907."
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 60,
                    "description": "Country of origin as a 2-letter code (CN, IN, TR, RU, VN) or a name (China, Türkiye, Viet Nam)."
                  },
                  "date": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Date to answer for, YYYY-MM-DD, for example the date the goods are declared. Defaults to today."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/producer_table": {
      "post": {
        "operationId": "producer_table",
        "summary": "Producer table of one measure",
        "description": "The producer table of one EU anti-dumping or countervailing measure: every named company with its country, duty and TARIC additional code, and the all other companies rows, from the latest consolidated text where there is one, with its version date and any amending act published after it. Filter by origin or company words; paged with next_offset. Call it to show or check a whole table, or to find a company's exact name. Do not call it to look up one known producer (use producer_duty). Rows for companies listed only in an annex carry the rate the Article 1 table gives for them.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "measure"
                ],
                "properties": {
                  "measure": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "The regulation that imposed or extended the duty, as 2021/1930, (EU) 2021/1930 or CELEX 32021R1930."
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 60,
                    "description": "Country of origin as a 2-letter code (CN, IN, TR, RU, VN) or a name (China, Türkiye, Viet Nam)."
                  },
                  "company": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Optional words of a company name to filter rows."
                  },
                  "date": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Date to answer for, YYYY-MM-DD, for example the date the goods are declared. Defaults to today."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "Page size, default 25."
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 5000,
                    "description": "Offset from next_offset of the previous page."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    },
    "/v1/tools/review_calendar": {
      "post": {
        "operationId": "review_calendar",
        "summary": "Expiry and review deadlines in a window",
        "description": "Dated deadlines for EU anti-dumping and countervailing measures in a window: expiry dates (from the notice of impending expiry, or computed and labelled so), the last day for Union producers to request an expiry review (three months before expiry), the normal and latest end of expiry reviews already opened, and the six-month end of provisional duties. Defaults to the next six months from the data date. Filter by origin and kinds (expiry, request_deadline, review_normal_end, review_latest_end, provisional_end); paged with next_offset. Call it to plan sourcing or pricing around measures that may lapse or be renewed. It cannot predict whether a review will be requested or how it ends.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "from": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Start of the window, YYYY-MM-DD. Defaults to the data date."
                  },
                  "to": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "End of the window, YYYY-MM-DD. Defaults to six months after from."
                  },
                  "months": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 36,
                    "description": "Window length in months when to is not given, default 6."
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 60,
                    "description": "Country of origin as a 2-letter code (CN, IN, TR, RU, VN) or a name (China, Türkiye, Viet Nam)."
                  },
                  "kinds": {
                    "type": [
                      "array",
                      "string"
                    ],
                    "maxItems": 10,
                    "maxLength": 200,
                    "items": {
                      "type": "string",
                      "enum": [
                        "expiry",
                        "request_deadline",
                        "review_normal_end",
                        "review_latest_end",
                        "provisional_end"
                      ]
                    },
                    "description": "Only these kinds, as a list or comma-separated: expiry, request_deadline, review_normal_end, review_latest_end, provisional_end."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "Page size, default 25."
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 5000,
                    "description": "Offset from next_offset of the previous page."
                  }
                }
              }
            }
          }
        },
        "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": "New trade defence acts and notices since a cursor",
        "description": "Lists EU trade defence acts and notices published after a date or cursor, oldest first: new duties, renewals, extensions, amendments, repeals, notices of impending expiry, initiations of investigations and reviews, name changes, court judgments, each with its kind, EUR-Lex link and the measures it affects. Pass next_cursor from the previous call, or a date (YYYY-MM-DD) to get everything dated after it; with neither you get the last seven days. Filter by kinds and origin. Call it once a day to see what moved on the measures you watch, instead of a webhook. It lists what the Publications Office has indexed, usually within days of publication.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "cursor": {
                    "type": "string",
                    "maxLength": 80,
                    "description": "next_cursor from the previous call, or a date YYYY-MM-DD meaning everything dated after that day."
                  },
                  "kinds": {
                    "type": [
                      "array",
                      "string"
                    ],
                    "maxItems": 30,
                    "maxLength": 600,
                    "items": {
                      "type": "string",
                      "enum": [
                        "definitive",
                        "provisional",
                        "extension",
                        "amending",
                        "correcting",
                        "corrigendum",
                        "repeal",
                        "termination",
                        "registration",
                        "initiation",
                        "undertaking",
                        "exemption",
                        "impending_expiry",
                        "expired",
                        "init_expiry_review",
                        "init_interim_review",
                        "init_proceeding",
                        "reopening",
                        "name_change",
                        "court",
                        "consolidated",
                        "other",
                        "notice_other",
                        "notice_amendment",
                        "init_other",
                        "notice_in_force",
                        "new_exporter"
                      ]
                    },
                    "description": "Only these kinds, as a list or comma-separated, for example definitive, impending_expiry, init_expiry_review."
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 60,
                    "description": "Country of origin as a 2-letter code (CN, IN, TR, RU, VN) or a name (China, Türkiye, Viet Nam)."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "Maximum changes to return, default 25."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Limit reached"
          }
        }
      }
    }
  }
}
