openapi: 3.0.3
info:
  title: Everflow Network API - Report Schedules
  description: >
    Endpoints for managing scheduled reports in the Everflow network.
    For scheduling options, see the [Scheduled Reports guide](https://helpdesk.everflow.io/customer/saved-scheduled-requested-reports).
  version: 1.0.0
servers:
  - description: Production Server
    url: https://api.eflow.team/v1
tags:
  - name: Report Schedules
    description: Endpoints for managing report schedules.
paths:
  /networks/reports/schedules/{scheduleId}:
    get:
      summary: Get Report Schedule
      tags:
        - Report Schedules
      parameters:
        - in: path
          name: scheduleId
          required: true
          schema:
            type: integer
          description: The report schedule ID.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
                description: Report schedule configuration.
      security:
        - API Key: []
    put:
      summary: Update Report Schedule
      tags:
        - Report Schedules
      parameters:
        - in: path
          name: scheduleId
          required: true
          schema:
            type: integer
          description: The report schedule ID.
      requestBody:
        required: true
        content:
          application/json:
            example:
              name: "Weekly Offer Performance"
              frequency: "weekly"
              schedule_status: "active"
              time_interval: "last_7_days"
              time_hour: 9
              week_day: 1
              format: "csv"
              additional_recipients:
                - "reports@example.com"
              report:
                report_type: "offer"
                timezone_id: 90
                currency_id: "USD"
                from: "2025-01-01"
                to: "2025-01-07"
            schema:
              type: object
              description: The full report schedule configuration to set.
              properties:
                name:
                  type: string
                  description: Name of the report schedule.
                frequency:
                  type: string
                  enum:
                    - daily
                    - weekly
                    - monthly
                    - quarterly
                  description: How often the report is delivered.
                schedule_status:
                  type: string
                  enum:
                    - active
                    - inactive
                  description: Whether the schedule is active or inactive.
                time_interval:
                  type: string
                  enum:
                    - today
                    - yesterday
                    - mtd
                    - last_month
                    - ytd
                    - this_week
                    - last_week
                    - last_7_days
                    - last_3_months
                  description: The relative time interval for the report data.
                time_hour:
                  type: integer
                  description: Hour of the day (0-23) when the report should be sent.
                day:
                  type: integer
                  description: Day of the month for monthly schedules.
                week_day:
                  type: integer
                  description: Day of the week for weekly schedules (0=Sunday, 1=Monday, etc.).
                month:
                  type: integer
                  description: Month for quarterly schedules.
                network_employee_ids:
                  type: array
                  items:
                    type: integer
                  description: List of employee IDs to receive the report.
                additional_recipients:
                  type: array
                  items:
                    type: string
                  description: Additional email addresses to receive the report.
                format:
                  type: string
                  enum:
                    - json
                    - csv
                    - pdf
                    - quickbooks
                    - netsuite
                    - zip
                  description: Export format for the report.
                metrics:
                  type: array
                  items:
                    type: string
                  description: List of metric types to include in the report.
                custom_metric_ids:
                  type: array
                  items:
                    type: integer
                  description: List of custom metric IDs to include in the report.
                report:
                  type: object
                  description: >
                    The report configuration object. Contains the report type,
                    date range, timezone, currency, and report-specific settings.
                  properties:
                    report_type:
                      type: string
                      enum:
                        - cohort
                        - flex
                        - dynamic_nested
                        - hourly
                        - date
                        - offer
                        - affiliate
                        - advertiser
                        - campaign
                        - advertiser_postback
                        - mtti
                        - pixel
                        - click
                        - conversion
                        - post_conversion
                        - offer_pacing
                        - offer_group_pacing
                        - custom_setting_pacing
                        - redirect
                        - referral
                        - impression
                        - funnel
                        - variance
                      description: The type of report.
                    from:
                      type: string
                      description: "Start date in YYYY-MM-DD or YYYY-MM-DD HH:mm:SS format."
                    to:
                      type: string
                      description: "End date in YYYY-MM-DD or YYYY-MM-DD HH:mm:SS format."
                    timezone_id:
                      type: integer
                      description: "Timezone ID. See /meta/timezones for supported values."
                    currency_id:
                      type: string
                      description: "Currency code. USD is the only value supported at the moment."
                    report_settings:
                      type: object
                      description: >
                        Report-specific settings. The structure varies based on the
                        report_type. For entity reports (offer, affiliate, advertiser,
                        etc.), this contains query filters and columns.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
                description: Updated report schedule configuration.
      security:
        - API Key: []

components:
  securitySchemes:
    API Key:
      description: The Everflow API key generated from the Control Center > Security.
      in: header
      name: X-Eflow-Api-Key
      type: apiKey
