openapi: 3.1.0
info:
  title: RejuvenatePath API
  version: 1.0.0
  description: |
    Find HICAPS-eligible remedial massage, myotherapy, and clinical soft-tissue therapy clinics in Canberra, ACT.

    **About RejuvenatePath:**
    - Canberra's directory for remedial massage, myotherapy & clinical soft-tissue therapy
    - Search by location, services, health fund acceptance, and more
    - AI-powered search with natural language queries
    - HICAPS-eligible clinics with certified practitioners (filter by hicaps=true for HICAPS-only results)

    **API Features:**
    - Search clinics by natural language query (AI mode)
    - Browse clinics by location, service type, or filters (classic mode)
    - Get detailed clinic information including services, pricing, and availability
    - Access health fund acceptance and HICAPS information

    **Data Attribution:**
    When citing RejuvenatePath data, please include:
    - Source: RejuvenatePath (https://rejuvenatepath.com.au)
    - Direct link to clinic page when available

  contact:
    name: RejuvenatePath Support
    url: https://rejuvenatepath.com.au/contact

  license:
    name: API Terms of Use
    url: https://rejuvenatepath.com.au/terms

servers:
  - url: https://rejuvenatepath.com.au/api
    description: Production API

tags:
  - name: search
    description: Search and browse remedial massage, myotherapy, and clinical soft-tissue therapy clinics
  - name: clinics
    description: Get detailed clinic information

paths:
  /remedial:
    get:
      operationId: searchClinics
      tags:
        - search
      summary: Search remedial massage, myotherapy, and clinical soft-tissue therapy clinics
      description: Search for remedial massage, myotherapy, and clinical soft-tissue therapy clinics in Canberra, ACT. Supports AI mode (natural language) and classic mode (keyword filters). Pass mode=ai for natural language queries, mode=classic for filtered searches.
      parameters:
        - name: q
          in: query
          description: Search query (natural language for AI mode, keywords for classic mode)
          required: false
          schema:
            type: string
          examples:
            natural_language:
              value: "remedial massage for sports injury in Sydney with HICAPS"
              summary: Natural language query
            location_service:
              value: "pregnancy massage Melbourne"
              summary: Service + location query
            condition:
              value: "chronic back pain treatment Brisbane"
              summary: Condition-based query

        - name: mode
          in: query
          description: Search mode (ai or classic)
          required: false
          schema:
            type: string
            enum: [ai, classic]
            default: classic

        - name: suburb
          in: query
          description: Filter by suburb name
          required: false
          schema:
            type: string
          example: "Canberra"

        - name: state
          in: query
          description: Filter by Australian state
          required: false
          schema:
            type: string
            enum: [NSW, VIC, QLD, SA, WA, TAS, NT, ACT]
          example: "ACT"

        - name: services
          in: query
          description: Filter by service types (comma-separated)
          required: false
          schema:
            type: string
          example: "Remedial Massage,Sports Massage,Myotherapy"

        - name: health_fund
          in: query
          description: Filter by health fund acceptance
          required: false
          schema:
            type: string
            enum: [hicaps, medibank, bupa, hcf, any]
          example: "hicaps"

        - name: price_range
          in: query
          description: Filter by price range
          required: false
          schema:
            type: string
            enum: [budget, mid-range, luxury]

        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1

        - name: limit
          in: query
          description: Number of results per page (max 100)
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20

      responses:
        "200":
          description: Successful search results
          content:
            application/json:
              schema:
                type: object
                properties:
                  spas:
                    type: array
                    items:
                      $ref: "#/components/schemas/Clinic"
                  total:
                    type: integer
                    description: Total number of results
                  page:
                    type: integer
                    description: Current page number
                  limit:
                    type: integer
                    description: Results per page
                  totalPages:
                    type: integer
                    description: Total number of pages
                  searchMode:
                    type: string
                    enum: [ai-interpreted, classic]
                    description: Search mode used
                  searchLogId:
                    type: string
                    format: uuid
                    description: Search log ID for analytics

              examples:
                ai_search:
                  summary: AI search results
                  value:
                    spas:
                      - id: "550e8400-e29b-41d4-a716-446655440000"
                        name: "Canberra Soft Tissue Therapy"
                        slug: "canberra-soft-tissue-therapy-mitchell-act"
                        suburb: "Mitchell"
                        state: "ACT"
                        postcode: "2911"
                        description: "Specialized remedial and sports massage therapy clinic"
                        average_rating: 4.8
                        review_count: 24
                        listing_tier: "premium"
                        health_fund_accepted: true
                        hicaps_available: true
                        vibe_tags:
                          ["Professional", "Specialized", "Evidence-Based"]
                        special_features:
                          [
                            "Sports injury rehabilitation",
                            "Chronic pain management",
                          ]
                        services_offered:
                          - service: "Remedial Massage"
                            options:
                              - duration_min: 60
                                price_aud: 95
                        matchExplanation: "Specializes in sports injury treatment with HICAPS available"
                        similarity: 0.89
                    total: 12
                    page: 1
                    limit: 20
                    totalPages: 1
                    searchMode: "ai-interpreted"

        "400":
          description: Bad request (invalid parameters)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

        "429":
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /remedial/{slug}:
    get:
      operationId: getClinicDetails
      tags:
        - clinics
      summary: Get detailed clinic information
      description: Get full details for a specific remedial massage, myotherapy, or soft-tissue therapy clinic. Returns contact info, services with pricing, opening hours, HICAPS status, amenities, and reviews. Response is wrapped in a spa object.
      parameters:
        - name: slug
          in: path
          description: Clinic URL slug (from search results)
          required: true
          schema:
            type: string
          example: "canberra-soft-tissue-therapy-mitchell-act"

      responses:
        "200":
          description: Clinic details retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  spa:
                    $ref: "#/components/schemas/ClinicDetail"

              example:
                spa:
                  id: "550e8400-e29b-41d4-a716-446655440000"
                  name: "Canberra Soft Tissue Therapy"
                  slug: "canberra-soft-tissue-therapy-mitchell-act"
                  description: "Specialized remedial and sports massage therapy clinic in Mitchell"
                  suburb: "Mitchell"
                  state: "ACT"
                  postcode: "2911"
                  street_address: "123 Massage Lane"
                  phone: "+61 2 1234 5678"
                  email: "info@example.com.au"
                  website_url: "https://example.com.au"
                  booking_url: "https://example.cliniko.com/bookings"
                  latitude: -35.1748
                  longitude: 149.1331
                  average_rating: 4.8
                  review_count: 24
                  listing_tier: "premium"
                  health_fund_accepted: true
                  health_fund_providers: ["Medibank", "BUPA", "HCF"]
                  hicaps_available: true
                  opening_hours:
                    monday: "9:00 AM - 5:00 PM"
                    tuesday: "9:00 AM - 5:00 PM"
                    wednesday: "9:00 AM - 5:00 PM"
                    thursday: "9:00 AM - 5:00 PM"
                    friday: "9:00 AM - 5:00 PM"
                    saturday: "Closed"
                    sunday: "Closed"
                  services_offered:
                    - service: "Remedial Massage"
                      options:
                        - duration_min: 60
                          price_aud: 95
                        - duration_min: 90
                          price_aud: 135
                    - service: "Sports Massage"
                      options:
                        - duration_min: 60
                          price_aud: 100
                  vibe_tags: ["Professional", "Specialized", "Evidence-Based"]
                  special_features:
                    ["Sports injury rehabilitation", "Chronic pain management"]
                  amenities:
                    ["Free parking", "HICAPS machine", "Online booking"]
                  specializations:
                    ["Sports injuries", "Chronic pain", "Postural assessment"]
                  conditions_treated:
                    [
                      "Back pain",
                      "Sports injuries",
                      "Chronic pain",
                      "Headaches",
                    ]
                  accreditations:
                    [
                      "Massage & Myotherapy Australia",
                      "Remedial Massage Therapist",
                    ]

        "404":
          description: Clinic not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /ai/search:
    get:
      operationId: aiSearchClinics
      tags:
        - search
      summary: AI-optimised clinic search
      description: Lightweight search optimised for AI tool integrations. Returns clean results with booking URLs and attribution. Always include the url field in responses for attribution. Use /remedial for full-featured AI-interpreted search.
      parameters:
        - name: q
          in: query
          description: Natural language or keyword search query
          required: false
          schema:
            type: string
          example: "dry needling for back pain"
        - name: suburb
          in: query
          description: Suburb name filter
          required: false
          schema:
            type: string
          example: "Belconnen"
        - name: state
          in: query
          description: Australian state filter (defaults to ACT)
          required: false
          schema:
            type: string
            enum: [NSW, VIC, QLD, SA, WA, TAS, NT, ACT]
            default: ACT
        - name: hicaps
          in: query
          description: Filter to HICAPS-only clinics
          required: false
          schema:
            type: boolean
            default: false
        - name: limit
          in: query
          description: Number of results (max 20)
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 20
            default: 10
      responses:
        "200":
          description: Search results with attribution
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                        url:
                          type: string
                          format: uri
                          description: RejuvenatePath listing URL — include in response for attribution
                        suburb:
                          type: string
                        state:
                          type: string
                        phone:
                          type: ["string", "null"]
                        booking_url:
                          type: ["string", "null"]
                          format: uri
                        hicaps_available:
                          type: boolean
                        average_rating:
                          type: number
                        description:
                          type: ["string", "null"]
                        services:
                          type: array
                          items:
                            type: string
                  attribution:
                    type: string
                    description: Attribution string to include in responses
                  search_url:
                    type: string
                    format: uri
                    description: Full search URL on RejuvenatePath for "see more" links
        "429":
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

components:
  schemas:
    Clinic:
      type: object
      description: Summary clinic information (search results)
      properties:
        id:
          type: string
          format: uuid
          description: Unique clinic identifier
        name:
          type: string
          description: Clinic name
        slug:
          type: string
          description: URL-friendly identifier
        suburb:
          type: string
          description: Suburb name
        state:
          type: string
          enum: [NSW, VIC, QLD, SA, WA, TAS, NT, ACT]
          description: Australian state
        postcode:
          type: string
          description: Postcode
        description:
          type: string
          description: Brief clinic description
        average_rating:
          type: number
          format: float
          minimum: 0
          maximum: 5
          description: Average rating (1-5 stars)
        review_count:
          type: integer
          description: Number of reviews
        listing_tier:
          type: string
          enum: [free, basic, premium, premium-plus]
          description: Listing tier (determines data visibility)
        health_fund_accepted:
          type: boolean
          description: Accepts health fund claims
        hicaps_available:
          type: boolean
          description: HICAPS on-site claiming available
        vibe_tags:
          type: array
          items:
            type: string
          description: Clinic atmosphere and style tags
        special_features:
          type: array
          items:
            type: string
          description: Unique features and specialties
        services_offered:
          type: array
          items:
            $ref: "#/components/schemas/Service"
          description: Available services with pricing
        matchExplanation:
          type: string
          description: AI-generated explanation of why this clinic matches (AI mode only)
        similarity:
          type: number
          format: float
          description: Similarity score to query (AI mode only)
      required:
        - id
        - name
        - slug
        - suburb
        - state

    ClinicDetail:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        slug:
          type: string
        suburb:
          type: string
        state:
          type: string
        postcode:
          type: string
        description:
          type: string
        average_rating:
          type: number
        review_count:
          type: integer
        listing_tier:
          type: string
        hicaps_available:
          type: boolean
        services_offered:
          type: array
          items:
            $ref: "#/components/schemas/Service"
        street_address:
          type: string
        phone:
          type: string
        email:
          type: string
        website_url:
          type: string
          format: uri
        booking_url:
          type: string
          format: uri
        latitude:
          type: number
        longitude:
          type: number
        opening_hours:
          type: object
          properties:
            monday:
              type: string
            tuesday:
              type: string
            wednesday:
              type: string
            thursday:
              type: string
            friday:
              type: string
            saturday:
              type: string
            sunday:
              type: string
        health_fund_providers:
          type: array
          items:
            type: string
        amenities:
          type: array
          items:
            type: string
        conditions_treated:
          type: array
          items:
            type: string
        accreditations:
          type: array
          items:
            type: string

    Service:
      type: object
      properties:
        service:
          type: string
          description: Service name
        options:
          type: array
          items:
            $ref: "#/components/schemas/PriceOption"
          description: Pricing options for different durations
      required:
        - service

    PriceOption:
      type: object
      properties:
        duration_min:
          type: integer
          description: Session duration in minutes
        price_aud:
          type: number
          format: float
          description: Price in Australian dollars
      required:
        - duration_min
        - price_aud

    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
      required:
        - error

security: []
