openapi: 3.0.3
info:
  title: Everflow Network API - Miscellaneous Reporting
  description: >
    Currency rate and referral reporting endpoints for the Everflow partner
    marketing platform.
  version: 1.0.0
servers:
  - description: Production Server
    url: https://api.eflow.team/v1
tags:
  - name: Reporting
    description: Currency rate and referral reporting endpoints.
paths:
  /networks/reporting/currency/rates:
    post:
      summary: Get Currency Rates
      tags:
        - Reporting
      requestBody:
        required: true
        content:
          application/json:
            example:
              source_currency_id: "USD"
              destination_currency_id: "EUR"
              timezone_id: 90
              from: "2026-01-01 00:00:00"
              to: "2026-03-11 00:00:00"
            schema:
              type: object
              required:
                - source_currency_id
                - destination_currency_id
                - timezone_id
                - from
                - to
              properties:
                source_currency_id:
                  type: string
                  description: Source currency code (e.g. "USD").
                destination_currency_id:
                  type: string
                  description: Destination currency code (e.g. "EUR").
                timezone_id:
                  type: integer
                  description: Timezone ID for the report.
                from:
                  type: string
                  description: Start date for the rate lookup. Format `YYYY-MM-DD HH:MM:SS`.
                to:
                  type: string
                  description: End date for the rate lookup. Format `YYYY-MM-DD HH:MM:SS`.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
                properties:
                  rates:
                    type: array
                    items:
                      type: object
                      properties:
                        valid_from:
                          type: integer
                          example: 1734455015
                        valid_to:
                          type: integer
                          example: 1734455015
                        source_currency_id:
                          type: string
                        destination_currency_id:
                          type: string
                        rate:
                          type: number
      security:
        - API Key: []

  /networks/reporting/referrals:
    post:
      summary: Get Referral Report
      tags:
        - Reporting
      parameters:
        - in: query
          name: page
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
          description: The page of results to retrieve.
        - in: query
          name: page_size
          required: false
          schema:
            type: integer
            minimum: 1
            default: 50
          description: The number of results to return per page.
      requestBody:
        required: true
        content:
          application/json:
            example:
              from: "2026-03-01"
              to: "2026-03-08"
              timezone_id: 90
              currency_id: "USD"
            schema:
              type: object
              required:
                - from
                - to
                - timezone_id
                - currency_id
              properties:
                from:
                  type: string
                  description: "Start date (format: YYYY-MM-DD)."
                to:
                  type: string
                  description: "End date (format: YYYY-MM-DD)."
                timezone_id:
                  type: integer
                  description: Timezone ID for the report.
                currency_id:
                  type: string
                  description: Currency code for reporting metrics.
                query:
                  type: object
                  description: Optional filters including referring_affiliate_ids.
                  properties:
                    filters:
                      type: object
                      properties:
                        referring_affiliate_ids:
                          type: array
                          items:
                            type: integer
                          description: Filter by referring affiliate IDs.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
                properties:
                  referrals:
                    type: array
                    items:
                      type: object
                      properties:
                        network_affiliate_referral_history_id:
                          type: integer
                        referred_affiliate_id:
                          type: integer
                        referrer_affiliate_id:
                          type: integer
                        method:
                          type: string
                        value:
                          type: number
                        currency_id:
                          type: string
                        end_time:
                          type: string
                        timezone_id:
                          type: integer
                        commission_basis:
                          type: string
                        minimum_threshold:
                          type: number
                        billed:
                          type: number
                        balance:
                          type: number
                        has_failed_threshold:
                          type: boolean
                        time_created:
                          type: integer
                          example: 1734455015
                        time_saved:
                          type: integer
                          example: 1734455015
                        time_deleted:
                          type: integer
                          example: 1734455015
                        relationship:
                          type: object
                          properties:
                            referred_affiliate:
                              type: object
                              properties:
                                network_affiliate_id:
                                  type: integer
                                network_id:
                                  type: integer
                                name:
                                  type: string
                                account_status:
                                  type: string
                            referrer_affiliate:
                              type: object
                              properties:
                                network_affiliate_id:
                                  type: integer
                                network_id:
                                  type: integer
                                name:
                                  type: string
                                account_status:
                                  type: string
                  paging:
                    type: object
                    properties:
                      page:
                        type: integer
                      page_size:
                        type: integer
                      total_count:
                        type: integer
      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
