openapi: "3.0.1"
info:
  title: "FORMALITY World Time API"
  version: "20251015"
  description: 'A simple API to get the current time based on a request with a timezone.

    '
servers:
- url: https://worldtime.formality.de/api
paths:
  /timezone:
    get:
      summary: List all timezones
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
  /timezone/{area}:
    get:
      summary: List timezones by area
      parameters:
      - name: area
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
  /timezone/{area}/{location}:
    get:
      summary: Current time for timezone
      parameters:
      - name: area
        in: path
        required: true
        schema:
          type: string
      - name: location
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeResponse'
  /ip:
    get:
      summary: Time based on requester IP (server guess)
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeResponse'
  /timezone.txt:
    get:
      summary: List all timezones
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
  /timezone/{area}.txt:
    get:
      summary: List timezones by area
      parameters:
      - name: area
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
  /timezone/{area}/{location}.txt:
    get:
      summary: Current time for timezone
      parameters:
      - name: area
        in: path
        required: true
        schema:
          type: string
      - name: location
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeResponse'
  /timezone/{area}/{location}/{region}:
    get:
      summary: Current time for timezone
      parameters:
      - name: area
        in: path
        required: true
        schema:
          type: string
      - name: location
        in: path
        required: true
        schema:
          type: string
      - name: region
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeResponse'
  /timezone/{area}/{location}/{region}.txt:
    get:
      summary: Current time for timezone
      parameters:
      - name: area
        in: path
        required: true
        schema:
          type: string
      - name: location
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeResponse'
  /ip.txt:
    get:
      summary: Time based on requester IP (server guess)
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeResponse'
components:
  schemas:
    TimeResponse:
      type: object
      properties:
        abbreviation:
          type: string
        client_ip:
          type: string
        datetime:
          type: string
        day_of_week:
          type: integer
        day_of_year:
          type: integer
        week_number:
          type: integer
        iso_week_date:
          type: string
        quarter:
          type: integer
        epoch_ms:
          type: integer
        is_dst:
          type: boolean
        dst_offset:
          type: integer
        raw_offset:
          type: integer
        timezone:
          type: string
        unixtime:
          type: integer
        utc_datetime:
          type: string
        utc_offset:
          type: string
        display_utc_offset:
          type: string
        rfc3339:
          type: string
        rfc2822:
          type: string
        is_leap_year:
          type: boolean
        next_leap_year:
          type: integer
        next_leap_year_including_this_year:
          type: integer
        days_of_year:
          type: integer