openapi: 3.0.3
info:
  title: Everflow Network API - Actions
  description: >
    Endpoints for managing scheduled actions in Everflow. Scheduled actions let you
    automate future changes to offers such as activating or pausing offers, adjusting
    caps, modifying revenue and payout settings, and more. For a full overview, see the
    [Scheduled Actions guide](https://helpdesk.everflow.io/customer/scheduled-actions).
  version: 1.0.0
servers:
  - description: Production Server
    url: https://api.eflow.team/v1
tags:
  - name: Actions
    description: >
      Manage scheduled actions that automate future changes to offers, such as
      status updates, cap adjustments, and payout modifications.
paths:
  /networks/actionstable:
    post:
      summary: Find Actions (Advanced)
      tags:
        - Actions
      parameters:
        - in: query
          name: page
          schema:
            type: integer
            default: 1
          description: Page number (1-based).
        - in: query
          name: page_size
          schema:
            type: integer
            default: 50
          description: Number of results per page.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                search_terms:
                  type: array
                  items:
                    type: object
                  description: Text search filters.
                filters:
                  type: object
                  description: Structured filters to narrow results.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
                properties:
                  actions:
                    type: array
                    items:
                      $ref: "#/components/schemas/Action"
                  paging:
                    type: object
                    properties:
                      page:
                        type: integer
                      page_size:
                        type: integer
                      total_count:
                        type: integer
      security:
        - API Key: []

  /networks/actions:
    post:
      summary: Create Action
      tags:
        - Actions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - action_date_time
                - timezone_id
                - action_type
                - action
              properties:
                action_date_time:
                  type: string
                  format: date-time
                  description: The date and time when the action should be executed. Must be a future date.
                timezone_id:
                  type: integer
                  description: Timezone ID for the action schedule.
                action_type:
                  type: string
                  description: >
                    The type of scheduled action. Determines which fields are
                    available in the `action` payload.
                  enum:
                    - active_status
                    - affiliate_active_status
                    - affiliate_cap
                    - affiliate_event_payout
                    - affiliate_paused_status
                    - affiliate_payout
                    - cap
                    - creative_active_status
                    - creative_paused_status
                    - event_revenue_payout
                    - forwarding_rules
                    - group_cap
                    - paused_status
                    - revenue_payout
                action:
                  type: object
                  description: >
                    The action-specific payload. Fields depend on the `action_type`.
                    For example, a `cap` action includes `network_offer_id` and
                    cap values like `daily_conversion_cap`.
            example:
              action_date_time: "2027-06-15T12:00:00Z"
              timezone_id: 90
              action_type: "cap"
              action:
                network_offer_id: 1
                daily_conversion_cap: 100
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Action"
      security:
        - API Key: []

  /networks/actions/{actionId}:
    delete:
      summary: Delete Action
      tags:
        - Actions
      parameters:
        - in: path
          name: actionId
          required: true
          schema:
            type: integer
          description: The action ID.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: boolean
                    description: Whether the deletion was successful.
      security:
        - API Key: []

components:
  schemas:
    Action:
      type: object
      properties:
        network_action_id:
          type: integer
          description: Unique action ID.
        network_id:
          type: integer
          description: Network ID.
        action_date_time:
          type: string
          format: date-time
          description: The date and time when the action will be executed.
        timezone_id:
          type: integer
          description: Timezone ID for the action schedule.
        action_type:
          type: string
          description: The type of scheduled action.
          enum:
            - cap
            - status
            - payout
            - revenue
        action:
          type: object
          description: The action-specific payload.
        time_created:
          type: integer
          example: 1734455015
          description: Unix timestamp of creation.
        time_saved:
          type: integer
          example: 1734455015
          description: Unix timestamp of last update.
  securitySchemes:
    API Key:
      description: The Everflow API key generated from the Control Center > Security.
      in: header
      name: X-Eflow-Api-Key
      type: apiKey
