openapi: 3.1.0
info:
  title: Domain Lookup API
  version: 1.0.0
  description: |
    API for checking whether domains appear to be registered using RDAP lookups.
servers:
  - url: https://baxtmann.me
paths:
  /domains/api/whois:
    get:
      operationId: lookupSingleDomain
      summary: Check one domain
      description: Returns lookup details for a single domain.
      parameters:
        - name: domain
          in: query
          required: true
          description: Domain name to check (e.g. example.com)
          schema:
            type: string
      responses:
        '200':
          description: Domain lookup result
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    $ref: '#/components/schemas/DomainLookupResult'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /domains/api/whois/bulk:
    get:
      operationId: lookupBulkDomains
      summary: Check multiple domains
      description: Returns lookup details for a comma-separated list of domains.
      parameters:
        - name: domains
          in: query
          required: true
          description: Comma-separated domains (e.g. example.com,example.org)
          schema:
            type: string
      responses:
        '200':
          description: Bulk domain lookup results
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: integer
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/DomainLookupResult'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    DomainLookupResult:
      type: object
      properties:
        domain:
          type: string
        purchased:
          type:
            - boolean
            - 'null'
        available:
          type:
            - boolean
            - 'null'
        status:
          type: string
          enum:
            - registered
            - registered_dns
            - available
            - invalid
            - unsupported_tld
            - lookup_failed
        registeredAt:
          type: string
          format: date-time
          nullable: true
        rdapStatus:
          type: array
          items:
            type: string
        lookupMethod:
          type: string
          enum:
            - rdap
            - dns
          nullable: true
        note:
          type: string
          nullable: true
        error:
          type: string
          nullable: true
      required:
        - domain
        - purchased
        - available
        - status
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
      required:
        - error
