info:
  description: |
    API for converting units.

    **Authentication Options**:
    - Recommended: Bearer token via `Authorization` header.
    - Fallback (GET): `token` query parameter.
    - Fallback (POST): `apiKey` in JSON body.
  title: Unit Converter API
  version: 1.0.0
openapi: 3.0.0
paths:
  /api/v1/unit-converter:
    post:
      requestBody:
        content:
          application/json:
            schema:
              properties:
                apiKey:
                  type: string
                from:
                  type: string
                to:
                  type: string
                value:
                  type: number
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  result:
                    type: number
                type: object
          description: Successful response
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too many requests
      summary: Convert a unit.
    get:
      parameters:
        - in: query
          name: from
          schema:
            type: string
          required: true
          description: The unit to convert from (e.g. "meters", "foot").
        - in: query
          name: to
          schema:
            type: string
          required: true
          description: The unit to convert to (e.g. "meters", "foot").
        - in: query
          name: value
          schema:
            type: number
          required: true
          description: The value to convert.
        - in: query
          name: token
          schema:
            type: string
          required: false
          description: Fallback authentication token.
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  result:
                    type: number
                type: object
          description: Successful response
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too many requests
      summary: Convert a unit.

components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

security:
  - bearerAuth: []  # Global security, but overridden per-path
servers:
- url: https://infinitode.netlify.app
