info:
  description: |
    API for finding the closest color to a given Hex color and return the name of it.

    **Authentication Options**:
    - Recommended: Bearer token via `Authorization` header.
    - Fallback (GET): `token` query parameter.
    - Fallback (POST): `apiKey` in JSON body.
  title: Closest Color API
  version: 1.0.0
openapi: 3.0.0
paths:
  /api/v1/closest-color:
    post:
      requestBody:
        content:
          application/json:
            schema:
              properties:
                apiKey:
                  type: string
                hex:
                  type: string
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  output:
                    type: object
                    properties:
                      hex:
                        type: string
                      name:
                        type: string
                      distance:
                        type: number
                      inputColor:
                        type: string
                type: object
          description: Successful response
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too many requests
      summary: Find the closest color to a given Hex color and return the name of it.
    get:
      parameters:
      - in: query
        name: hex
        schema:
          type: string
        required: true
      - in: query
        name: token
        schema:
          type: string
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  output:
                    type: object
                    properties:
                      hex:
                        type: string
                      name:
                        type: string
                      distance:
                        type: number
                      inputColor:
                        type: string
                type: object
          description: Successful response
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too many requests
      summary: Find the closest color to a given Hex color and return the name of it.

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

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