{
  "openapi": "3.1.0",
  "info": {
    "title": "IMEI Safe API",
    "description": "Professional IMEI verification API. Check blacklist status, model authenticity, warranty, carrier lock, Find My iPhone status, and more.",
    "version": "1.0.0",
    "contact": {
      "name": "TR Vertriebs GmbH",
      "url": "https://imei-safe.de",
      "email": "info@tr-vertriebs.de"
    }
  },
  "servers": [
    {
      "url": "https://uaxfkcpqwlfzeheltvca.supabase.co/functions/v1",
      "description": "Production"
    }
  ],
  "paths": {
    "/api-check": {
      "post": {
        "summary": "IMEI API",
        "description": "Single endpoint for all operations: list services, check IMEI, check balance.",
        "security": [{ "ApiKeyAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": { "type": "string", "enum": ["services"] }
                    },
                    "required": ["action"]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": { "type": "string", "enum": ["check"] },
                      "imei": { "type": "string", "pattern": "^[0-9]{15}$", "example": "350000000000003" },
                      "service_id": { "type": "string", "example": "92" }
                    },
                    "required": ["action", "imei", "service_id"]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": { "type": "string", "enum": ["balance"] }
                    },
                    "required": ["action"]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": { "description": "Bad request – missing or invalid parameters" },
          "401": { "description": "Unauthorized – invalid or missing API key" },
          "404": { "description": "IMEI not found in any database" },
          "429": { "description": "Rate limit exceeded" },
          "500": { "description": "Internal server error" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  }
}
