{
  "openapi": "3.0.3",
  "info": {
    "title": "ClearCheck Card Number Validator API",
    "version": "1.0.0",
    "description": "Vérifie un numéro de carte par l’algorithme de Luhn et détecte le réseau (Visa, Mastercard, American Express, Discover, JCB, Diners Club, UnionPay, Maestro, Mir, RuPay, Verve). POST uniquement ; le numéro n’est ni stocké ni journalisé. Ne vérifie pas que la carte existe ni qu’elle est approvisionnée.\n\nErreurs : JSON {\"error\":{\"code\",\"message\"}}. CORS ouvert. Corps limité à 8 Ko."
  },
  "servers": [
    {
      "url": "https://clearcheck-api.pages.dev"
    }
  ],
  "paths": {
    "/v1/card/validate": {
      "post": {
        "operationId": "card_validate_post",
        "summary": "Valider un numéro (Luhn + réseau + longueur)",
        "tags": [
          "ClearCheck Card Number Validator API"
        ],
        "responses": {
          "200": {
            "description": "Succès (JSON)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Requête invalide",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Endpoint inconnu",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Méthode non autorisée",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Corps trop grand (8 Ko max)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type non JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Valeur invalide",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "number"
                ],
                "properties": {
                  "number": {
                    "type": "string",
                    "description": "Numéro de carte (chiffres, espaces ou tirets)"
                  }
                }
              },
              "example": {
                "number": "4111 1111 1111 1111"
              }
            }
          }
        }
      }
    },
    "/v1/card/network": {
      "post": {
        "operationId": "card_network_post",
        "summary": "Détecter le réseau à partir des premiers chiffres",
        "tags": [
          "ClearCheck Card Number Validator API"
        ],
        "responses": {
          "200": {
            "description": "Succès (JSON)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Requête invalide",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Endpoint inconnu",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Méthode non autorisée",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Corps trop grand (8 Ko max)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type non JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Valeur invalide",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "number"
                ],
                "properties": {
                  "number": {
                    "type": "string",
                    "description": "6 premiers chiffres ou plus"
                  }
                }
              },
              "example": {
                "number": "411111"
              }
            }
          }
        }
      }
    },
    "/v1/card/luhn_check_digit": {
      "post": {
        "operationId": "card_luhn_check_digit_post",
        "summary": "Calculer le dernier chiffre de Luhn",
        "tags": [
          "ClearCheck Card Number Validator API"
        ],
        "responses": {
          "200": {
            "description": "Succès (JSON)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Requête invalide",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Endpoint inconnu",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Méthode non autorisée",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Corps trop grand (8 Ko max)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type non JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Valeur invalide",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "partial_number"
                ],
                "properties": {
                  "partial_number": {
                    "type": "string",
                    "description": "Numéro sans son dernier chiffre"
                  }
                }
              },
              "example": {
                "partial_number": "411111111111111"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}