{
  "openapi": "3.1.0",
  "info": {
    "title": "CheckDigit",
    "version": "0.2.3",
    "description": "Offline format and check-digit validation for IBAN, BIC, EU VAT, GTIN/EAN/UPC and ISBN. Format check, not a compliance check. Codes are not stored or logged. Anonymous ~20/min per IP; API key ~300/min.",
    "contact": {
      "email": "digitalpromohub.support@gmail.com"
    }
  },
  "servers": [
    {
      "url": "https://checkdigit.mike-tusa.workers.dev"
    }
  ],
  "security": [
    {},
    {
      "bearerAuth": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "cd_live_... API key"
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Result": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "input": {
            "type": "string"
          },
          "normalized": {
            "type": "string"
          },
          "valid": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "country_name": {
            "type": "string"
          },
          "formatted": {
            "type": "string"
          },
          "check_digits": {
            "type": "string"
          },
          "check_digit": {
            "type": "string"
          },
          "expected_check_digit": {
            "type": "string"
          },
          "format": {
            "type": "string"
          },
          "bban": {
            "type": "string"
          },
          "bank_code": {
            "type": "string"
          },
          "sepa": {
            "type": "boolean"
          },
          "number": {
            "type": "string"
          },
          "checksum": {
            "type": "string"
          },
          "vies_checked": {
            "type": "boolean"
          },
          "ean13": {
            "type": "string"
          },
          "isbn10": {
            "type": "string"
          },
          "isbn13": {
            "type": "string"
          },
          "detected_as": {
            "type": "string"
          },
          "candidates": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "input",
          "valid"
        ]
      }
    }
  },
  "paths": {
    "/v1/iban": {
      "post": {
        "operationId": "ibanPost",
        "summary": "Validate one IBAN (code in the JSON body; recommended)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "maxLength": 64
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long, invalid_json or code_in_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/iban/{code}": {
      "get": {
        "operationId": "ibanGet",
        "summary": "Same check with the code in the path (prefer POST for IBAN/VAT)",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long or bad_encoding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "method_not_allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bic": {
      "post": {
        "operationId": "bicPost",
        "summary": "Validate one BIC (code in the JSON body; recommended)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "maxLength": 64
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long, invalid_json or code_in_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bic/{code}": {
      "get": {
        "operationId": "bicGet",
        "summary": "Same check with the code in the path (prefer POST for IBAN/VAT)",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long or bad_encoding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "method_not_allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/vat": {
      "post": {
        "operationId": "vatPost",
        "summary": "Validate one VAT (code in the JSON body; recommended)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "maxLength": 64
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long, invalid_json or code_in_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/vat/{code}": {
      "get": {
        "operationId": "vatGet",
        "summary": "Same check with the code in the path (prefer POST for IBAN/VAT)",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long or bad_encoding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "method_not_allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gtin": {
      "post": {
        "operationId": "gtinPost",
        "summary": "Validate one GTIN (code in the JSON body; recommended)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "maxLength": 64
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long, invalid_json or code_in_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gtin/{code}": {
      "get": {
        "operationId": "gtinGet",
        "summary": "Same check with the code in the path (prefer POST for IBAN/VAT)",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long or bad_encoding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "method_not_allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/isbn": {
      "post": {
        "operationId": "isbnPost",
        "summary": "Validate one ISBN (code in the JSON body; recommended)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "maxLength": 64
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long, invalid_json or code_in_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/isbn/{code}": {
      "get": {
        "operationId": "isbnGet",
        "summary": "Same check with the code in the path (prefer POST for IBAN/VAT)",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long or bad_encoding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "method_not_allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/detect": {
      "post": {
        "operationId": "detectPost",
        "summary": "Auto-detect and validate one code (code in the JSON body)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "maxLength": 64
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long, invalid_json or code_in_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/detect/{code}": {
      "get": {
        "operationId": "detectGet",
        "summary": "Same check with the code in the path (prefer POST for IBAN/VAT)",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "missing_code, input_too_long or bad_encoding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "method_not_allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/batch": {
      "post": {
        "operationId": "batch",
        "summary": "Validate up to 500 codes (Pro keys only; each code counts one call)",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "codes": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 500,
                    "items": {
                      "oneOf": [
                        {
                          "type": "string",
                          "maxLength": 64
                        },
                        {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "maxLength": 64
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "iban",
                                "bic",
                                "vat",
                                "gtin",
                                "isbn"
                              ]
                            }
                          },
                          "required": [
                            "code"
                          ]
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "codes"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "integer"
                    },
                    "valid_count": {
                      "type": "integer"
                    },
                    "invalid_count": {
                      "type": "integer"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Result"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_json, invalid_batch, empty_batch or batch_too_large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "api_key_required or invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "paid_plan_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "method_not_allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "storage_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/meta": {
      "get": {
        "operationId": "meta",
        "summary": "Version, supported countries and formats, limits",
        "responses": {
          "200": {
            "description": "Meta",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "method_not_allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, daily_capacity_reached or monthly_quota_exceeded",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Per-minute limit (rate_limited only)",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "MCP JSON-RPC 2.0 (Streamable HTTP, stateless). Protocol versions 2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05. Max body 65536 bytes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response (tool errors are results with isError)",
            "headers": {
              "x-checkdigit-plan": {
                "description": "free or pro, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-limit": {
                "description": "Monthly quota, keyed calls only",
                "schema": {
                  "type": "string"
                }
              },
              "x-quota-remaining": {
                "description": "Calls left this month, keyed calls only",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "202": {
            "description": "Notification or client response accepted"
          },
          "400": {
            "description": "Parse error, invalid request, header mismatch or unsupported version"
          },
          "401": {
            "description": "invalid_api_key (no WWW-Authenticate)"
          },
          "403": {
            "description": "Origin not allowed"
          },
          "404": {
            "description": "Unknown method (2026-07-28)"
          },
          "413": {
            "description": "Body too large"
          },
          "429": {
            "description": "Too many MCP requests or key checks",
            "headers": {
              "retry-after": {
                "description": "Seconds",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "Internal error"
          },
          "503": {
            "description": "storage_unavailable"
          }
        }
      },
      "get": {
        "operationId": "mcpGet",
        "summary": "Not supported (stateless, no SSE)",
        "responses": {
          "405": {
            "description": "Method not allowed",
            "headers": {
              "allow": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "POST, OPTIONS"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "mcpDelete",
        "summary": "Not supported (no sessions)",
        "responses": {
          "405": {
            "description": "Method not allowed",
            "headers": {
              "allow": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "POST, OPTIONS"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}