openapi: 3.0.0
info:
  title: ICA Conference API
  description: |
    Search and retrieve information about academic conferences worldwide.
    This API is designed for integration with ChatGPT custom actions.
  version: 1.0.0
  contact:
    name: ICA
    url: https://academicworldresearch.org
    email: api@academicworldresearch.org

servers:
  - url: https://academicworldresearch.org/api/gpt
    description: Production server

paths:
  /conferences:
    get:
      operationId: searchConferences
      summary: Search for academic conferences
      description: |
        Search conferences with various filters including topic, location, date, and free-text search.
        Supports continent-based filtering which automatically includes all countries in that continent.
      parameters:
        - name: q
          in: query
          description: Free-text search query. Searches event name, topic, and sub-topic.
          schema:
            type: string
          example: "machine learning"
        - name: topic
          in: query
          description: Filter by main topic category
          schema:
            type: string
            enum:
              - Engineering
              - Business And Economics
              - Health and Medicine
              - Sports Science
              - Business
              - Education
              - Interdisciplinary
              - Social Science
              - IT
              - Law
              - Science
              - Arts and Humanities
              - Agriculture and Forestry
          example: "Engineering"
        - name: subtopic
          in: query
          description: Filter by sub-topic (e.g., Aerospace, Marketing, Cardiology)
          schema:
            type: string
          example: "Artificial Intelligence"
        - name: country
          in: query
          description: Filter by single country name
          schema:
            type: string
          example: "India"
        - name: countries
          in: query
          description: Filter by multiple countries (comma-separated)
          schema:
            type: string
          example: "USA,Canada,Mexico"
        - name: continent
          in: query
          description: Filter by continent. Includes all countries in that continent.
          schema:
            type: string
            enum:
              - Asia
              - Europe
              - North America
              - South America
              - Africa
              - Oceania
          example: "Asia"
        - name: city
          in: query
          description: Filter by city name
          schema:
            type: string
          example: "Singapore"
        - name: type
          in: query
          description: Filter by event type
          schema:
            type: string
            enum:
              - conference
              - seminar
              - workshop
              - webinar
          example: "conference"
        - name: from
          in: query
          description: Events starting from this date (YYYY-MM-DD)
          schema:
            type: string
            format: date
          example: "2026-03-01"
        - name: to
          in: query
          description: Events ending before this date (YYYY-MM-DD)
          schema:
            type: string
            format: date
          example: "2026-03-31"
        - name: month
          in: query
          description: Filter by specific month (YYYY-MM format)
          schema:
            type: string
            pattern: "^\d{4}-\d{2}$"
          example: "2026-03"
        - name: year
          in: query
          description: Filter by year
          schema:
            type: integer
            minimum: 2024
            maximum: 2030
          example: 2026
        - name: limit
          in: query
          description: Maximum number of results (1-50)
          schema:
            type: integer
            minimum: 1
            maximum: 50
            default: 10
        - name: offset
          in: query
          description: Pagination offset
          schema:
            type: integer
            minimum: 0
            default: 0
      responses:
        '200':
          description: Successful response with conferences
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConferenceSearchResponse'
        '400':
          description: Bad request - invalid parameters
        '401':
          description: Unauthorized - invalid API key
        '429':
          description: Rate limit exceeded

  /conferences/{id}:
    get:
      operationId: getConferenceDetails
      summary: Get details of a specific conference
      parameters:
        - name: id
          in: path
          required: true
          description: Conference ID
          schema:
            type: integer
      responses:
        '200':
          description: Conference details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConferenceDetailResponse'
        '404':
          description: Conference not found

  /topics:
    get:
      operationId: listTopics
      summary: List all available conference topics
      description: Returns all main topic categories with conference counts
      responses:
        '200':
          description: List of topics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopicsResponse'

  /countries:
    get:
      operationId: listCountries
      summary: List countries with conferences
      parameters:
        - name: continent
          in: query
          description: Filter countries by continent
          schema:
            type: string
            enum:
              - Asia
              - Europe
              - North America
              - South America
              - Africa
              - Oceania
      responses:
        '200':
          description: List of countries
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CountriesResponse'

  /stats:
    get:
      operationId: getStatistics
      summary: Get overall conference statistics
      description: Returns aggregate statistics about the conference database
      responses:
        '200':
          description: Statistics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatsResponse'

components:
  schemas:
    Conference:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        type:
          type: string
        topic:
          type: string
        sub_topic:
          type: string
        dates:
          type: object
          properties:
            start:
              type: string
              format: date
            end:
              type: string
              format: date
            formatted:
              type: string
        location:
          type: object
          properties:
            city:
              type: string
            country:
              type: string
            venue:
              type: string
        organizer:
          type: string
        website:
          type: string
          format: uri

    ConferenceSearchResponse:
      type: object
      properties:
        success:
          type: boolean
        query:
          type: object
        filters_applied:
          type: object
        total:
          type: integer
        showing:
          type: integer
        conferences:
          type: array
          items:
            $ref: '#/components/schemas/Conference'
        pagination:
          type: object
          properties:
            limit:
              type: integer
            offset:
              type: integer
            has_more:
              type: boolean

    ConferenceDetailResponse:
      type: object
      properties:
        success:
          type: boolean
        conference:
          $ref: '#/components/schemas/Conference'

    TopicsResponse:
      type: object
      properties:
        success:
          type: boolean
        total:
          type: integer
        topics:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              count:
                type: integer

    CountriesResponse:
      type: object
      properties:
        success:
          type: boolean
        total:
          type: integer
        continent:
          type: string
        countries:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              count:
                type: integer

    StatsResponse:
      type: object
      properties:
        success:
          type: boolean
        statistics:
          type: object
          properties:
            total_conferences:
              type: integer
            total_countries:
              type: integer
            total_topics:
              type: integer
        continents:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              count:
                type: integer

  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

security:
  - ApiKeyAuth: []
