openapi: 3.1.0
info:
  title: myProxyChecker API
  version: "1.0.0"
  description: IP lookup, JSON bulk proxy checks, usage endpoints and key management.
servers:
  - url: https://myproxychecker.com
components:
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    BearerAuth:
      type: http
      scheme: bearer
  schemas:
    Error:
      type: object
      properties:
        ok:
          type: boolean
          const: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
    UsageBucket:
      type: object
      properties:
        usedToday:
          type: integer
        dailyLimit:
          type: integer
        remaining:
          type: integer
        resetAt:
          type: integer
        lastResetDate:
          type: string
        unit:
          type: string
    ProxyCheckResult:
      type: object
      properties:
        raw:
          type: string
        status:
          type: string
          enum: [working, failed]
        protocol:
          type: [string, "null"]
        host:
          type: string
        port:
          type: integer
        auth:
          type: string
          enum: [none, provided]
        connectIp:
          type: string
        checkedAt:
          type: string
        error:
          type: [object, "null"]
paths:
  /v1/ip/{ip}:
    get:
      summary: Look up one public IP.
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      parameters:
        - in: path
          name: ip
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Lookup response.
        "401":
          description: API key missing or invalid.
        "429":
          description: Lookup quota exceeded.
  /v1/check:
    post:
      summary: Run a JSON bulk proxy check.
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                proxies:
                  oneOf:
                    - type: array
                      items:
                        type: string
                    - type: string
                protocol:
                  type: string
                  enum: [auto, http, https, socks5]
      responses:
        "200":
          description: Bulk JSON response.
        "400":
          description: Invalid JSON, unsupported fields or too many proxies.
        "401":
          description: API key missing or invalid.
        "429":
          description: Bulk quota exceeded.
  /v1/me:
    get:
      summary: Return key metadata plus split lookup and bulk usage.
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      responses:
        "200":
          description: Key details.
  /api/v1/usage:
    get:
      summary: Return split lookup and bulk usage only.
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      responses:
        "200":
          description: Usage response.
  /api/v1/keys:
    post:
      summary: Create a developer API key.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [email]
              properties:
                email:
                  type: string
                label:
                  type: string
      responses:
        "201":
          description: Key created and shown once.
  /api/v1/keys/rotate:
    post:
      summary: Rotate the active API key.
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      responses:
        "200":
          description: New key returned once.
  /api/v1/keys/current:
    delete:
      summary: Revoke the active API key.
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      responses:
        "200":
          description: Key revoked.
