{
  "openapi": "3.0.3",
  "info": {
    "title": "CardBinCheck BIN Lookup API",
    "description": "Free BIN/IIN lookup. Returns card scheme, funding type, issuer and country for the first 6-8 digits of a card number. Keyless use is limited per IP per day; a free IPNOVA API key raises the limit and works across all IPNOVA APIs.",
    "version": "1.0.0",
    "contact": { "url": "https://cardbincheck.com/bin-lookup-api" }
  },
  "servers": [{ "url": "https://cardbincheck.com" }],
  "paths": {
    "/api/bin/{bin}": {
      "get": {
        "summary": "Look up a BIN",
        "operationId": "binLookup",
        "parameters": [
          {
            "name": "bin",
            "in": "path",
            "required": true,
            "description": "First 6-8 digits of the card number",
            "schema": { "type": "string", "pattern": "^[0-9]{6,8}$", "example": "45717360" }
          }
        ],
        "security": [{}, { "apiKey": [] }],
        "responses": {
          "200": {
            "description": "BIN found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean", "example": true },
                    "data": {
                      "type": "object",
                      "properties": {
                        "bin": { "type": "string", "example": "45717360" },
                        "scheme": { "type": "string", "example": "Visa" },
                        "funding": { "type": "string", "example": "Debit" },
                        "segment": { "type": "string" },
                        "issuer": { "type": "string", "example": "Jyske Bank" },
                        "country_code": { "type": "string", "example": "DK" },
                        "country_name": { "type": "string", "example": "Denmark" }
                      }
                    },
                    "page": { "type": "string" },
                    "attribution": { "type": "string" },
                    "docs": { "type": "string" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/Error" },
          "404": { "$ref": "#/components/responses/Error" },
          "429": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/api/bin-batch": {
      "post": {
        "summary": "Look up up to 100 BINs in one call",
        "operationId": "binBatch",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["bins"],
                "properties": {
                  "bins": {
                    "type": "array",
                    "items": { "type": "string", "example": "424242" },
                    "minItems": 1,
                    "maxItems": 100
                  }
                }
              }
            }
          }
        },
        "security": [{}, { "apiKey": [] }],
        "responses": {
          "200": {
            "description": "Per-BIN results; each batch counts as one request per ten BINs toward the daily cap",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "count": { "type": "integer" },
                    "found": { "type": "integer" },
                    "results": { "type": "array", "items": { "type": "object" } }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/Error" },
          "429": { "$ref": "#/components/responses/Error" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Free IPNOVA API key from https://api.ipnova.com; one key works on every IPNOVA API"
      }
    },
    "responses": {
      "Error": {
        "description": "Error with a machine-readable reason (invalid_input, not_found, rate_limit, daily_limit)",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": { "type": "boolean", "example": false },
                "error": { "type": "boolean", "example": true },
                "reason": { "type": "string", "example": "not_found" },
                "message": { "type": "string" },
                "docs": { "type": "string" }
              }
            }
          }
        }
      }
    }
  }
}
