{
  "openapi": "3.1.0",
  "info": {
    "title": "Japan Re-entry Deadline Check API",
    "version": "1.0.0",
    "description": "Leaving Japan on a deemed re-entry permit (みなし再入国)? Find the exact date you must be back: 1 year from departure, or your residence card expiry if sooner, or 2 months after expiry if your renewal is still pending. Miss it and your visa status ends.\n\nFree, no API key, CORS open. Fair use: about 120 requests per minute per IP. Also available as MCP tools at https://free-agent-tools.vercel.app/mcp"
  },
  "servers": [
    {
      "url": "https://japan-reentry-check.vercel.app"
    }
  ],
  "paths": {
    "/api/check": {
      "get": {
        "operationId": "japanReentryDeadlineCheck",
        "summary": "By what date must a foreign resident who leaves Japan be back, so their status of residence doesn't lapse?",
        "description": "Applies Japan's Immigration Control Act art. 26-2 (deemed re-entry permit, みなし再入国許可), art. 26 (regular re-entry permit) and art. 20(6) (special period while an extension or change of status is pending), with Civil Code date counting, to the dates you give. Returns returnBy (last day to be back in Japan) with the legal basis, days allowed, margin vs a planned returnDate, verdict (in_time | too_late | deadline_only | no_deemed_reentry | already_expired), special-period end and the date the pending decision must be received by, whether the permit can be extended abroad, steps (ED card tick box, documents) and warnings, plus sources and a disclaimer. Deemed re-entry: 1 year from departure or the period-of-stay expiry if earlier; special permanent residents 2 years; not extendable abroad; not available to temporary visitors, 3-months-or-less statuses or refugee-applicant Designated Activities.\n\nExample: https://japan-reentry-check.vercel.app/api/check?status=mid_long&departureDate=2026-12-20&periodExpiry=2027-01-15&pending=renewal&returnDate=2027-02-10",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": true,
            "description": "mid_long (residence card: work, student, spouse, dependent, long-term resident…), permanent, spr (special permanent resident), short_term (tourist), three_months_or_less, refugee_applicant.",
            "schema": {
              "type": "string",
              "description": "mid_long (residence card: work, student, spouse, dependent, long-term resident…), permanent, spr (special permanent resident), short_term (tourist), three_months_or_less, refugee_applicant.",
              "enum": [
                "mid_long",
                "permanent",
                "spr",
                "short_term",
                "three_months_or_less",
                "refugee_applicant"
              ]
            }
          },
          {
            "name": "departureDate",
            "in": "query",
            "required": true,
            "description": "YYYY-MM-DD you leave Japan.",
            "schema": {
              "type": "string",
              "description": "YYYY-MM-DD you leave Japan."
            }
          },
          {
            "name": "periodExpiry",
            "in": "query",
            "required": false,
            "description": "YYYY-MM-DD period-of-stay expiry on the residence card (在留期限). Required for mid_long; not for permanent/spr.",
            "schema": {
              "type": "string",
              "description": "YYYY-MM-DD period-of-stay expiry on the residence card (在留期限). Required for mid_long; not for permanent/spr."
            }
          },
          {
            "name": "pending",
            "in": "query",
            "required": false,
            "description": "Extension (renewal) or change-of-status application filed before expiry and not yet decided: none | renewal | change.",
            "schema": {
              "type": "string",
              "description": "Extension (renewal) or change-of-status application filed before expiry and not yet decided: none | renewal | change.",
              "enum": [
                "none",
                "renewal",
                "change"
              ],
              "default": "none"
            }
          },
          {
            "name": "permit",
            "in": "query",
            "required": false,
            "description": "deemed (みなし再入国, tick box at departure) or a regular re-entry permit in your passport: single | multiple.",
            "schema": {
              "type": "string",
              "description": "deemed (みなし再入国, tick box at departure) or a regular re-entry permit in your passport: single | multiple.",
              "enum": [
                "deemed",
                "single",
                "multiple"
              ],
              "default": "deemed"
            }
          },
          {
            "name": "permitExpiry",
            "in": "query",
            "required": false,
            "description": "YYYY-MM-DD expiry of a regular re-entry permit (required if permit is single or multiple).",
            "schema": {
              "type": "string",
              "description": "YYYY-MM-DD expiry of a regular re-entry permit (required if permit is single or multiple)."
            }
          },
          {
            "name": "returnDate",
            "in": "query",
            "required": false,
            "description": "YYYY-MM-DD planned return, to check in_time vs too_late and the margin.",
            "schema": {
              "type": "string",
              "description": "YYYY-MM-DD planned return, to check in_time vs too_late and the margin."
            }
          },
          {
            "name": "today",
            "in": "query",
            "required": false,
            "description": "Override today's date (default: today in Japan).",
            "schema": {
              "type": "string",
              "description": "Override today's date (default: today in Japan)."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result as JSON. Always includes a `disclaimer` field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid input. The body explains what to send and gives an example."
          },
          "429": {
            "description": "Too many requests from one IP. Retry after the Retry-After seconds."
          }
        }
      },
      "post": {
        "operationId": "japanReentryDeadlineCheckPost",
        "summary": "By what date must a foreign resident who leaves Japan be back, so their status of residence doesn't lapse? (JSON body)",
        "description": "Applies Japan's Immigration Control Act art. 26-2 (deemed re-entry permit, みなし再入国許可), art. 26 (regular re-entry permit) and art. 20(6) (special period while an extension or change of status is pending), with Civil Code date counting, to the dates you give. Returns returnBy (last day to be back in Japan) with the legal basis, days allowed, margin vs a planned returnDate, verdict (in_time | too_late | deadline_only | no_deemed_reentry | already_expired), special-period end and the date the pending decision must be received by, whether the permit can be extended abroad, steps (ED card tick box, documents) and warnings, plus sources and a disclaimer. Deemed re-entry: 1 year from departure or the period-of-stay expiry if earlier; special permanent residents 2 years; not extendable abroad; not available to temporary visitors, 3-months-or-less statuses or refugee-applicant Designated Activities.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status",
                  "departureDate"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "description": "mid_long (residence card: work, student, spouse, dependent, long-term resident…), permanent, spr (special permanent resident), short_term (tourist), three_months_or_less, refugee_applicant.",
                    "enum": [
                      "mid_long",
                      "permanent",
                      "spr",
                      "short_term",
                      "three_months_or_less",
                      "refugee_applicant"
                    ]
                  },
                  "departureDate": {
                    "type": "string",
                    "description": "YYYY-MM-DD you leave Japan."
                  },
                  "periodExpiry": {
                    "type": "string",
                    "description": "YYYY-MM-DD period-of-stay expiry on the residence card (在留期限). Required for mid_long; not for permanent/spr."
                  },
                  "pending": {
                    "type": "string",
                    "description": "Extension (renewal) or change-of-status application filed before expiry and not yet decided: none | renewal | change.",
                    "enum": [
                      "none",
                      "renewal",
                      "change"
                    ],
                    "default": "none"
                  },
                  "permit": {
                    "type": "string",
                    "description": "deemed (みなし再入国, tick box at departure) or a regular re-entry permit in your passport: single | multiple.",
                    "enum": [
                      "deemed",
                      "single",
                      "multiple"
                    ],
                    "default": "deemed"
                  },
                  "permitExpiry": {
                    "type": "string",
                    "description": "YYYY-MM-DD expiry of a regular re-entry permit (required if permit is single or multiple)."
                  },
                  "returnDate": {
                    "type": "string",
                    "description": "YYYY-MM-DD planned return, to check in_time vs too_late and the margin."
                  },
                  "today": {
                    "type": "string",
                    "description": "Override today's date (default: today in Japan)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result as JSON. Always includes a `disclaimer` field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid input. The body explains what to send and gives an example."
          },
          "429": {
            "description": "Too many requests from one IP. Retry after the Retry-After seconds."
          }
        }
      }
    },
    "/api/rules": {
      "get": {
        "operationId": "japanReentryRules",
        "summary": "Japan re-entry rules: deemed re-entry, regular re-entry permit, special period, date counting, fees, sources",
        "description": "Returns the rules the checker applies, with law articles, ISA sources and disclaimer. No inputs.",
        "responses": {
          "200": {
            "description": "Rules JSON with rulesAsOf and sources.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    }
  }
}