openapi: 3.0.3
info:
  title: Everflow Network API - Affiliates
  description: >
    Affiliate management endpoints for the Everflow partner marketing platform.
    Search, retrieve, create, and update affiliate accounts.
    To learn more about partners, see the [Partner overview](https://helpdesk.everflow.io/customer/who-is-a-partner-in-everflow).
  version: 1.0.0
servers:
  - description: Production Server
    url: https://api.eflow.team/v1
tags:
  - name: Affiliates
    description: Endpoints for searching and managing affiliates.
paths:
  /networks/affiliatestable:
    post:
      summary: Find Affiliates (Advanced)
      tags:
        - Affiliates
      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
            maximum: 2000
          description: Number of results per page.
        - in: query
          name: relationship
          schema:
            type: string
            enum:
              - signup
              - users
          description: Include related data.
      requestBody:
        content:
          application/json:
            examples:
              active_affiliates:
                summary: "Fetch active affiliates"
                value:
                  search_terms:
                    - search_type: "name"
                      value: ""
                  filters:
                    account_status: "active"
              by_manager_and_name:
                summary: "Fetch affiliates by manager with name filter"
                value:
                  search_terms:
                    - search_type: "name"
                      value: "media"
                  filters:
                    account_status: "active"
                    account_manager_id: 3
              with_recent_traffic:
                summary: "Fetch active affiliates with recent traffic"
                value:
                  search_terms:
                    - search_type: "name"
                      value: ""
                  filters:
                    account_status: "active"
                    has_recent_traffic: true
            schema:
              type: object
              properties:
                search_terms:
                  type: array
                  description: Text search filters.
                  items:
                    type: object
                    description: "A search term."
                    required:
                      - search_type
                      - value
                    properties:
                      search_type:
                        type: string
                        enum:
                          - name
                        description: The field to search on.
                      value:
                        type: string
                        description: The search term.
                filters:
                  type: object
                  description: Structured filters to narrow results.
                  properties:
                    account_status:
                      type: string
                      enum:
                        - active
                        - inactive
                        - pending
                        - suspended
                      description: Filter by account status.
                    account_manager_ids:
                      type: array
                      items:
                        type: integer
                        description: "An account manager ID."
                      description: Filter by account manager IDs.
                    network_account_executives_ids:
                      type: array
                      items:
                        type: integer
                        description: "An account executive ID."
                      description: Filter by account executive IDs.
                    billing_frequency:
                      type: string
                      enum:
                        - weekly
                        - bimonthly
                        - monthly
                        - two_months
                        - quarterly
                        - manual
                        - other
                      description: Filter by billing frequency.
                    payment_type:
                      type: string
                      enum:
                        - none
                        - pay
                        - paypal
                        - check
                        - wire
                        - direct_deposit
                        - tipalti
                        - paxum
                        - veem
                        - payoneer
                        - bitcoin
                        - webmoney
                        - capitalist
                        - transferwise
                        - gift_card
                        - masspay
                        - skrill
                      description: Filter by payment type.
                    labels:
                      type: array
                      items:
                        type: string
                        description: "A label name."
                      description: Filter by label names.
                    ran_traffic_in_last_hours:
                      type: integer
                      description: Only return affiliates that had traffic within the last N hours.
                    network_tracking_domain_ids:
                      type: array
                      items:
                        type: integer
                        description: "A tracking domain ID."
                      description: Filter by tracking domain IDs.
                    country_codes:
                      type: array
                      items:
                        type: string
                        description: "A country code."
                      description: Filter by country codes (e.g. US, CA).
                    business_unit_ids:
                      type: array
                      items:
                        type: integer
                        description: "A business unit ID."
                      description: Filter affiliates based on the specified business units.
                    region_codes:
                      type: array
                      items:
                        type: string
                        description: "A region code."
                      description: >
                        Filter by region codes. Note that region codes are not always
                        globally unique so this filter is best used along with the
                        country_codes filter.
      responses:
        "200":
          description: ""
          content:
            application/json:
              example:
                affiliates:
                  - network_affiliate_id: 7
                    network_id: 1
                    name: "Some Agency Inc."
                    account_status: "active"
                    account_manager_id: 1
                    account_manager_name: "John Doe"
                    account_executive_id: 0
                    account_executive_name: ""
                    today_revenue: "$7.32"
                    time_created: 1664825245
                    time_saved: 1664825245
                    labels: ["media_buyer"]
                    balance: 0
                    last_login: 1664985191
                    global_tracking_domain_url: "www.testtracking.com"
                    relationship: {}
                    network_country_code: "US"
                    is_payable: false
                    payment_type: "none"
                    payment_terms: 0
                    network_traffic_source_id: 0
                paging:
                  page: 1
                  page_size: 50
                  total_count: 1
              schema:
                type: object
                properties:
                  affiliates:
                    type: array
                    description: List of affiliates matching the search criteria.
                    items:
                      type: object
                      description: "An affiliate table row."
                      properties:
                        network_affiliate_id:
                          type: integer
                          description: Unique affiliate ID.
                        network_id:
                          type: integer
                          description: Network ID.
                        name:
                          type: string
                          description: Affiliate name.
                        account_status:
                          type: string
                          description: Current account status.
                          enum:
                            - active
                            - inactive
                            - pending
                            - suspended
                        account_manager_id:
                          type: integer
                          description: Account manager ID.
                        account_manager_name:
                          type: string
                          description: Account manager name.
                        account_executive_id:
                          type: integer
                          description: Account executive ID.
                        account_executive_name:
                          type: string
                          description: Account executive name.
                        today_revenue:
                          type: string
                          description: Today's revenue (formatted string).
                        time_created:
                          type: integer
                          example: 1734455015
                          description: Unix timestamp of when the affiliate was created.
                        time_saved:
                          type: integer
                          example: 1734455015
                          description: Unix timestamp of when the affiliate was last saved.
                        labels:
                          type: array
                          nullable: true
                          description: Labels associated with this affiliate.
                          items:
                            type: string
                            description: "A label string."
                        balance:
                          type: integer
                          description: Current affiliate balance.
                        last_login:
                          type: integer
                          description: Unix timestamp of last login.
                        global_tracking_domain_url:
                          type: string
                          description: Global tracking domain URL.
                        relationship:
                          type: object
                          description: Related data (only present when requested via the `relationship` query parameter).
                        network_country_code:
                          type: string
                          description: Affiliate's country code.
                        is_payable:
                          type: boolean
                          description: Whether the affiliate is payable.
                        payment_type:
                          type: string
                          description: Payment method type.
                        payment_terms:
                          type: integer
                          description: Payment terms in days.
                        network_traffic_source_id:
                          type: integer
                          description: Associated traffic source ID.
                  paging:
                    type: object
                    description: Pagination information.
                    properties:
                      page:
                        type: integer
                        description: Current page number.
                      page_size:
                        type: integer
                        description: Number of results per page.
                      total_count:
                        type: integer
                        description: Total number of results across all pages.
      security:
        - API Key: []
  /networks/affiliates:
    get:
      summary: List Affiliates
      description: Affiliates
      tags:
        - Returns every affiliate on the network, paginated. Use this for a straight listing; for filtered or sorted searches use the Affiliates Table endpoint instead.
      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.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
                properties:
                  affiliates:
                    type: array
                    items:
                      $ref: "#/components/schemas/Affiliate"
                  paging:
                    type: object
                    description: Pagination information.
                    properties:
                      page:
                        type: integer
                        description: Current page number.
                      page_size:
                        type: integer
                        description: Number of results per page.
                      total_count:
                        type: integer
                        description: Total number of results across all pages.
      security:
        - API Key: []
    post:
      summary: Create Affiliate
      tags:
        - Affiliates
      parameters:
        - in: query
          name: notification
          schema:
            type: boolean
            default: true
          description: Whether to send a welcome notification email to the affiliate. Defaults to `true` when omitted.
      requestBody:
        required: true
        content:
          application/json:
            examples:
              minimal:
                summary: Minimal required fields
                value:
                  name: "DocTest Affiliate"
                  account_status: "active"
                  network_employee_id: 2
                  default_currency_id: "USD"
                  billing:
                    billing_frequency: "monthly"
                    payment_type: "none"
                    details:
                      day_of_month: 1
                    billing: {}
              full:
                summary: Full example with user, address, and labels
                value:
                  name: "Premium Media Agency"
                  account_status: "active"
                  network_employee_id: 2
                  internal_notes: "Top performing partner"
                  default_currency_id: "USD"
                  enable_media_cost_tracking_links: true
                  is_contact_address_enabled: true
                  network_affiliate_tier_id: 1
                  contact_address:
                    address_1: "123 Main St"
                    address_2: "Suite 100"
                    city: "New York"
                    region_code: "NY"
                    country_code: "US"
                    zip_postal_code: "10001"
                  labels: ["media-buyer", "premium"]
                  users:
                    - first_name: "Jane"
                      last_name: "Doe"
                      email: "jane.doe@example.com"
                      account_status: "active"
                      language_id: 1
                      timezone_id: 90
                      currency_id: "USD"
                      work_phone: "5551234567"
                  billing:
                    billing_frequency: "monthly"
                    payment_type: "paypal"
                    tax_id: "123-45-6789"
                    is_invoice_creation_auto: false
                    default_invoice_is_hidden: false
                    default_payment_terms: 30
                    details:
                      day_of_month: 1
                    billing:
                      paypal_reception_method: "email"
                      reception_identifier: "payments@example.com"
            schema:
              type: object
              required:
                - name
                - account_status
                - network_employee_id
                - default_currency_id
                - billing
              properties:
                name:
                  type: string
                  description: The name of the affiliate.
                account_status:
                  type: string
                  enum:
                    - active
                    - inactive
                  description: The affiliate's account status.
                network_employee_id:
                  type: integer
                  description: The employee ID of the affiliate's account manager.
                internal_notes:
                  type: string
                  description: Internal notes for network usage.
                default_currency_id:
                  type: string
                  description: >
                    The affiliate's default currency. Can be found using the
                    [metadata API](/api-reference/get-metacurrencies).
                enable_media_cost_tracking_links:
                  type: boolean
                  description: Whether or not you want to allow the affiliate to pass and override cost in their tracking links. Defaults to `false`.
                referrer_id:
                  type: integer
                  description: The ID of the affiliate that referred the new affiliate. Defaults to `0` (none).
                is_contact_address_enabled:
                  type: boolean
                  description: Whether or not you want to include a contact address for this affiliate. Defaults to `false`.
                network_affiliate_tier_id:
                  type: integer
                  description: The ID of the Affiliate Tier.
                contact_address:
                  type: object
                  description: >
                    The affiliate's contact address information. Only required if
                    `is_contact_address_enabled` is set to `true`.
                  properties:
                    address_1:
                      type: string
                      description: Street address line 1.
                    address_2:
                      type: string
                      description: Apartment / suite.
                    city:
                      type: string
                      description: City name.
                    region_code:
                      type: string
                      description: State or region code (e.g. "CA").
                    country_code:
                      type: string
                      description: Two-letter country code (e.g. "US").
                    zip_postal_code:
                      type: string
                      description: ZIP or postal code.
                labels:
                  type: array
                  items:
                    type: string
                    description: "A label string."
                  description: Used to associate labels to the affiliate.
                users:
                  type: array
                  description: >
                    One or more user accounts to create for this affiliate.
                    Uses the same fields as the Create Affiliate User endpoint.
                  items:
                    type: object
                    description: "An initial affiliate user to create."
                    required:
                      - first_name
                      - last_name
                      - email
                      - language_id
                      - timezone_id
                      - currency_id
                      - account_status
                    properties:
                      first_name:
                        type: string
                        description: The affiliate user's first name.
                      last_name:
                        type: string
                        description: The affiliate user's last name.
                      email:
                        type: string
                        description: The affiliate user's email. Must be unique among all affiliate users. Is used to log in the platform.
                      language_id:
                        type: integer
                        description: The affiliate user's language ID. This is limited to the value `1` (English).
                      timezone_id:
                        type: integer
                        description: >
                          The affiliate user's timezone ID. Can be found using the
                          [metadata API](/api-reference/get-metatimezones).
                      title:
                        type: string
                        description: The affiliate user's title.
                      work_phone:
                        type: string
                        description: The affiliate user's work phone number.
                      cell_phone:
                        type: string
                        description: The affiliate user's cell phone number.
                      instant_messaging_id:
                        type: integer
                        description: >
                          The ID of an instant messaging platform. Allows you to save their
                          identifier for further reference. `0` = None, `1` = Skype,
                          `2` = Yahoo Messenger, `3` = Telegram, `4` = WhatsApp, `5` = Other.
                      instant_messaging_identifier:
                        type: string
                        description: The affiliate user's instant messaging identifier, if `instant_messaging_id` was different than `0`.
                      currency_id:
                        type: string
                        description: >
                          The affiliate user's currency ID. Can be found using the
                          [metadata API](/api-reference/get-metacurrencies).
                      account_status:
                        type: string
                        enum:
                          - active
                          - inactive
                        description: The affiliate user's account status. Can be either `active` or `inactive`.
                      initial_password:
                        type: string
                        description: >
                          The affiliate user's login password. If left empty, the affiliate will
                          be sent an email asking to set their password. If supplied, the password
                          must have a length of at least 12 characters.
                billing:
                  type: object
                  description: The affiliate's billing information.
                  required:
                    - billing_frequency
                    - payment_type
                    - details
                    - billing
                  properties:
                    billing_frequency:
                      type: string
                      enum:
                        - weekly
                        - bimonthly
                        - monthly
                        - two_months
                        - quarterly
                        - manual
                        - other
                      description: The affiliate's invoicing frequency.
                    payment_type:
                      type: string
                      enum:
                        - none
                        - pay
                        - paypal
                        - check
                        - wire
                        - direct_deposit
                        - tipalti
                        - paxum
                        - veem
                        - payoneer
                        - bitcoin
                        - webmoney
                        - capitalist
                        - transferwise
                        - gift_card
                        - masspay
                        - skrill
                      description: >
                        The affiliate's payment type. `pay` refers to Everflow Pay.
                    tax_id:
                      type: string
                      description: The affiliate's tax ID.
                    is_invoice_creation_auto:
                      type: boolean
                      description: Configures automatic invoice creation for the affiliate. Defaults to `false`.
                    auto_invoice_start_date:
                      type: string
                      description: >
                        Configures automatic invoice creation start date. Dates are formatted
                        `YYYY-mm-dd`. Required if `is_invoice_creation_auto` is set to `true`.
                    default_invoice_is_hidden:
                      type: boolean
                      description: Configures whether invoices are hidden from the affiliate by default. Defaults to `false`.
                    invoice_generation_days_delay:
                      type: integer
                      description: >
                        Configures how many days to wait for invoice generation after the
                        specified billing period. Defaults to `0`.
                    invoice_amount_threshold:
                      type: number
                      format: double
                      description: >
                        Configures the minimal amount required for an invoice to be generated.
                        Sums below the threshold are rolled over to the next billing period.
                        Defaults to `0`, which is none.
                    default_payment_terms:
                      type: integer
                      description: >
                        Configures the number of days that will be used as the payment term
                        on generated invoices. Defaults to `0`.
                    details:
                      type: object
                      description: >
                        The affiliate's billing frequency details. Required when `billing_frequency`
                        is set to anything other than `manual` or `other`, or when `payment_type`
                        is not `none` (an empty object is required).
                      properties:
                        day_of_week:
                          type: integer
                          description: >
                            Specifies the day of the week, starting on Sunday (0=Sunday .. 6=Saturday).
                            Required when `billing_frequency` is set to `weekly`.
                        day_of_month_one:
                          type: integer
                          description: Specifies first day of the month. Required when `billing_frequency` is set to `bimonthly`.
                        day_of_month_two:
                          type: integer
                          description: Specifies second day of the month. Required when `billing_frequency` is set to `bimonthly`.
                        day_of_month:
                          type: integer
                          description: >
                            Specifies day of the month. Required when `billing_frequency` is set to
                            `monthly`, `two_months` or `quarterly`.
                        starting_month:
                          type: integer
                          description: >
                            Specifies the month from which the cycle is set to begin. Required when
                            `billing_frequency` is set to `two_months` or `quarterly`.
                    billing:
                      type: object
                      description: >
                        The affiliate's payment method details. When `payment_type` is set to
                        `none`, an empty object (`{}`) should be applied.
                      properties:
                        paxum_id:
                          type: string
                          description: The affiliate's Paxum ID. Required when `payment_type` is `paxum`.
                        paypal_reception_method:
                          type: string
                          enum:
                            - email
                            - phone
                            - paypal_account
                          description: The reception method used with PayPal. Required when `payment_type` is `paypal`.
                        reception_identifier:
                          type: string
                          description: The affiliate's PayPal reception identifier. Required when `payment_type` is `paypal`.
                        email:
                          type: string
                          description: The affiliate's email. Required when `payment_type` is `payoneer` or `veem`.
                        is_existing_payee:
                          type: boolean
                          description: Whether to assign an existing payee ID. Required when `payment_type` is `tipalti`.
                        idap:
                          type: string
                          description: The payee's IDAP (Payee ID). Required when `payment_type` is `tipalti` and `is_existing_payee` is `true`.
                        first_name:
                          type: string
                          description: The affiliate's first name. Required when `payment_type` is `veem`.
                        last_name:
                          type: string
                          description: The affiliate's last name. Required when `payment_type` is `veem`.
                        phone:
                          type: string
                          description: The affiliate's phone number (international format). Required when `payment_type` is `veem`.
                        country_iso:
                          type: string
                          description: The affiliate's country ISO code. Required when `payment_type` is `veem`.
                        bank_name:
                          type: string
                          description: The affiliate's bank name. Required when `payment_type` is `wire` or `direct_deposit`.
                        bank_address:
                          type: string
                          description: The affiliate's bank address. Required when `payment_type` is `wire` or `direct_deposit`.
                        account_name:
                          type: string
                          description: The affiliate's bank account name. Required when `payment_type` is `wire` or `direct_deposit`.
                        account_number:
                          type: string
                          description: The affiliate's bank account number. Required when `payment_type` is `wire` or `direct_deposit`.
                        routing_number:
                          type: string
                          description: The affiliate's bank routing number. Required when `payment_type` is `wire` or `direct_deposit`.
                        swift_code:
                          type: string
                          description: The affiliate's SWIFT code. Required when `payment_type` is `wire` or `direct_deposit`.
      responses:
        "200":
          description: Affiliate created successfully.
          content:
            application/json:
              example:
                network_affiliate_id: 36
                network_id: 1
                name: "DocTest Affiliate"
                account_status: "active"
                network_employee_id: 2
                internal_notes: ""
                has_notifications: true
                network_traffic_source_id: 0
                account_executive_id: 0
                adress_id: 0
                default_currency_id: "USD"
                is_contact_address_enabled: false
                enable_media_cost_tracking_links: false
                time_created: 1774701138
                time_saved: 1774701138
                relationship:
                  labels:
                    total: 0
                    entries: []
                  users:
                    total: 0
                    entries: []
                  account_manager:
                    first_name: "John"
                    last_name: "Doe"
                    email: "john.doe@example.com"
                    work_phone: "9781243585"
                    cell_phone: ""
                    instant_messaging_id: 0
                    instant_messaging_identifier: ""
                  encoded_value: "2LQC3F"
                  network_affiliate_tier_id: 1
                  ios_app_sources:
                    total: 0
                    entries: []
                referrer_id: 0
              schema:
                $ref: "#/components/schemas/Affiliate"
      security:
        - API Key: []
    patch:
      summary: Apply Affiliate Bulk Edit
      tags:
        - Affiliates
      requestBody:
        required: true
        content:
          application/json:
            examples:
              deactivate:
                summary: "Deactivate an affiliate"
                value:
                  network_affiliate_ids: [7]
                  patches:
                    - field_name: "account_status"
                      field_value: "inactive"
              assign_manager:
                summary: "Assign account manager"
                value:
                  network_affiliate_ids: [7]
                  patches:
                    - field_name: "network_employee_id"
                      field_value: "5"
            schema:
              type: object
              required:
                - network_affiliate_ids
                - patches
              properties:
                network_affiliate_ids:
                  type: array
                  items:
                    type: integer
                    description: "An affiliate ID to patch."
                  description: Array of affiliate IDs to update.
                patches:
                  type: array
                  description: Array of patch operations to apply.
                  items:
                    type: object
                    description: "A field patch operation."
                    required:
                      - field_name
                      - field_value
                    properties:
                      field_name:
                        type: string
                        enum:
                          - account_status
                          - network_employee_id
                          - labels
                          - network_affiliate_tier_id
                        description: The field to update.
                      field_value:
                        type: string
                        description: The new value for the field.
      responses:
        "200":
          description: Affiliates updated successfully.
      security:
        - API Key: []
  /networks/affiliates/{affiliateId}:
    get:
      summary: Get Affiliate by ID
      tags:
        - Affiliates
      parameters:
        - in: path
          name: affiliateId
          required: true
          schema:
            type: integer
          description: The unique affiliate ID.
        - in: query
          name: relationship
          schema:
            type: string
            enum:
              - reporting
              - billing
              - coupon_codes
              - users
              - audits
              - visibility
              - signup
              - api
              - traffic_source
              - referral_link
              - referrer
              - referral
              - supply_partner
          description: Include related data. Repeat for multiple relationships.
      responses:
        "200":
          description: ""
          content:
            application/json:
              example:
                network_affiliate_id: 7
                network_id: 1
                name: "Some Agency Inc."
                account_status: "active"
                network_employee_id: 2
                internal_notes: ""
                has_notifications: false
                network_traffic_source_id: 0
                account_executive_id: 0
                adress_id: 0
                default_currency_id: "USD"
                is_contact_address_enabled: false
                enable_media_cost_tracking_links: true
                time_created: 1664825245
                time_saved: 1664825245
                referrer_id: 0
                relationship:
                  labels:
                    total: 0
                    entries: []
                  users:
                    total: 1
                    entries:
                      - network_affiliate_user_id: 11
                        network_id: 1
                        network_affiliate_id: 7
                        first_name: "Bob"
                        last_name: "Smith"
                        email: "bob.smith@example.com"
                        title: ""
                        work_phone: "4858555836"
                        cell_phone: ""
                        instant_messaging_id: 0
                        instant_messaging_identifier: ""
                        language_id: 1
                        timezone_id: 75
                        currency_id: "USD"
                        account_status: "active"
                        time_created: 1664825245
                        time_saved: 1664825245
                  account_manager:
                    first_name: "John"
                    last_name: "Doe"
                    email: "john.doe@example.com"
                    work_phone: "9781243585"
                    cell_phone: ""
                    instant_messaging_id: 0
                    instant_messaging_identifier: ""
                  encoded_value: "9W598"
                  billing:
                    network_id: 1
                    network_affiliate_id: 7
                    billing_frequency: "weekly"
                    payment_type: "none"
                    invoice_amount_threshold: 0
                    tax_id: ""
                    is_invoice_creation_auto: false
                    auto_invoice_start_date: "2019-03-01 00:00:00"
                    default_invoice_is_hidden: false
                    invoice_generation_days_delay: 0
                    default_payment_terms: 0
                    is_automated_payment_enabled: false
                    vat_percentage: 0
                    relationship:
                      weekly:
                        day_of_week: 4
                    is_payable: true
                  api_keys:
                    total: 0
                    entries: []
                  api_whitelist_ips:
                    total: 0
                    entries: []
                  ios_app_sources:
                    total: 0
                    entries: []
              schema:
                type: object
                properties:
                  network_affiliate_id:
                    type: integer
                    description: Unique affiliate ID.
                  network_id:
                    type: integer
                    description: Network ID.
                  name:
                    type: string
                    description: Affiliate name.
                  account_status:
                    type: string
                    description: Current account status.
                    enum:
                      - active
                      - inactive
                      - pending
                      - suspended
                  network_employee_id:
                    type: integer
                    description: Account manager employee ID.
                  internal_notes:
                    type: string
                    description: Internal notes about this affiliate (not visible to the affiliate).
                  default_currency_id:
                    type: string
                    description: ISO currency code for the affiliate's default currency.
                  enable_media_cost_tracking_links:
                    type: boolean
                    description: Whether media cost tracking is enabled on this affiliate's links.
                  is_contact_address_enabled:
                    type: boolean
                    description: Whether a contact address is stored for this affiliate.
                  has_notifications:
                    type: boolean
                    description: Whether notifications are enabled.
                  network_traffic_source_id:
                    type: integer
                    description: Associated traffic source ID.
                  account_executive_id:
                    type: integer
                    description: Account executive employee ID.
                  adress_id:
                    type: integer
                    description: Address record ID. Note the field name uses a single 'd' (`adress_id`) in the API response.
                  referrer_id:
                    type: integer
                    description: ID of the referring affiliate, if any.
                  time_created:
                    type: integer
                    example: 1734455015
                    description: Unix timestamp of creation.
                  time_saved:
                    type: integer
                    example: 1734455015
                    description: Unix timestamp of last update.
                  relationship:
                    type: object
                    description: Related data (only present when requested via the `relationship` query parameter).
                    properties:
                      labels:
                        type: object
                        description: Labels associated with this affiliate.
                        properties:
                          total:
                            type: integer
                            description: Total number of labels.
                          entries:
                            type: array
                            description: List of label strings.
                            items:
                              type: string
                              description: "A label string."
                      account_manager:
                        type: object
                        description: Account manager details.
                        properties:
                          first_name:
                            type: string
                            description: Account manager's first name.
                          last_name:
                            type: string
                            description: Account manager's last name.
                          email:
                            type: string
                            description: Account manager's email address.
                          work_phone:
                            type: string
                            description: Account manager's work phone number.
                          cell_phone:
                            type: string
                            description: Account manager's cell phone number.
                          instant_messaging_id:
                            type: integer
                            description: Account manager's instant messaging platform ID.
                          instant_messaging_identifier:
                            type: string
                            description: Account manager's instant messaging identifier.
                      encoded_value:
                        type: string
                        description: Encoded tracking value for this affiliate.
                      network_affiliate_tier_id:
                        type: integer
                        description: The affiliate tier this affiliate belongs to.
                      reporting:
                        type: object
                        description: Reporting metrics for the affiliate (requires `reporting` relationship).
                        properties:
                          imp:
                            type: integer
                            description: Total impressions.
                          total_click:
                            type: integer
                            description: Total clicks.
                          unique_click:
                            type: integer
                            description: Unique clicks.
                          invalid_click:
                            type: integer
                            description: Invalid (flagged) clicks.
                          duplicate_click:
                            type: integer
                            description: Duplicate clicks.
                          gross_click:
                            type: integer
                            description: Gross clicks (total + invalid + duplicate).
                          ctr:
                            type: number
                            description: Click-through rate.
                          cv:
                            type: integer
                            description: Conversions.
                          invalid_cv_scrub:
                            type: integer
                            description: Invalid conversions (scrubbed).
                          view_through_cv:
                            type: integer
                            description: View-through conversions.
                          total_cv:
                            type: integer
                            description: Total conversions.
                          event:
                            type: integer
                            description: Total events.
                          cvr:
                            type: number
                            description: Conversion rate.
                          evr:
                            type: number
                            description: Event rate.
                          cpc:
                            type: number
                            description: Cost per click.
                          cpm:
                            type: number
                            description: Cost per mille (thousand impressions).
                          cpa:
                            type: number
                            description: Cost per acquisition.
                          epc:
                            type: number
                            description: Earnings per click.
                          rpc:
                            type: number
                            description: Revenue per click.
                          rpa:
                            type: number
                            description: Revenue per acquisition.
                          rpm:
                            type: number
                            description: Revenue per mille.
                          payout:
                            type: number
                            description: Total payout amount.
                          revenue:
                            type: number
                            description: Total revenue.
                          event_revenue:
                            type: number
                            description: Revenue from events.
                          gross_sales:
                            type: number
                            description: Gross sales amount.
                          profit:
                            type: number
                            description: Net profit (revenue minus payout).
                          margin:
                            type: number
                            description: Profit margin percentage.
                          roas:
                            type: number
                            description: Return on ad spend.
                          avg_sale_value:
                            type: number
                            description: Average sale value.
                          media_buying_cost:
                            type: number
                            description: Media buying cost.
                          on_hold_potential_revenue:
                            type: number
                            description: Potential revenue from on-hold conversions.
                          on_hold_potential_payout:
                            type: number
                            description: Potential payout from on-hold conversions.
                          on_hold_conversion_count:
                            type: integer
                            description: Number of on-hold conversions.
                          public_events:
                            type: integer
                            description: Number of public events.
                      billing:
                        type: object
                        description: Billing and invoicing information (requires `billing` relationship).
                        properties:
                          network_id:
                            type: integer
                            description: Network ID.
                          network_affiliate_id:
                            type: integer
                            description: Affiliate ID.
                          billing_frequency:
                            type: string
                            description: Invoicing frequency.
                            enum:
                              - weekly
                              - bimonthly
                              - monthly
                              - two_months
                              - quarterly
                              - manual
                              - other
                          payment_type:
                            type: string
                            description: Payment method type.
                          invoice_amount_threshold:
                            type: number
                            description: Minimum amount for invoice generation.
                          tax_id:
                            type: string
                            description: Tax ID.
                          is_invoice_creation_auto:
                            type: boolean
                            description: Whether invoices are generated automatically.
                          auto_invoice_start_date:
                            type: string
                            description: Automatic invoice creation start date.
                          default_invoice_is_hidden:
                            type: boolean
                            description: Whether invoices are hidden from the affiliate by default.
                          invoice_generation_days_delay:
                            type: integer
                            description: Days to wait after billing period for invoice generation.
                          default_payment_terms:
                            type: integer
                            description: Default payment terms in days.
                          is_automated_payment_enabled:
                            type: boolean
                            description: Whether automated payment is enabled.
                          vat_percentage:
                            type: number
                            description: VAT percentage applied to invoices.
                          is_payable:
                            type: boolean
                            description: Whether the affiliate is payable.
                          relationship:
                            type: object
                            description: Billing frequency details (weekly, bimonthly, monthly, etc.).
                      coupon_codes:
                        type: object
                        description: Coupon codes associated with this affiliate (requires `coupon_codes` relationship).
                        properties:
                          total:
                            type: integer
                            description: Total number of coupon codes.
                          entries:
                            type: array
                            description: List of coupon code records.
                            items:
                              type: object
                              description: "A coupon code record."
                      users:
                        type: object
                        description: User accounts associated with this affiliate (requires `users` relationship).
                        properties:
                          total:
                            type: integer
                            description: Total number of users.
                          entries:
                            type: array
                            description: List of user records.
                            items:
                              type: object
                              description: "An affiliate user record."
                      audits:
                        type: object
                        description: Revision history of changes (requires `audits` relationship).
                        properties:
                          total:
                            type: integer
                            description: Total number of audit records.
                          entries:
                            type: array
                            description: List of audit records.
                            items:
                              type: object
                              description: "An audit record."
                      visible_offers:
                        type: object
                        description: Offers visible to this affiliate (requires `visibility` relationship).
                        properties:
                          total:
                            type: integer
                            description: Total number of visible offers.
                          entries:
                            type: array
                            description: List of visible offer records.
                            items:
                              type: object
                              description: "An offer record."
                      hidden_offers:
                        type: object
                        description: Offers hidden from this affiliate (requires `visibility` relationship).
                        properties:
                          total:
                            type: integer
                            description: Total number of hidden offers.
                          entries:
                            type: array
                            description: List of hidden offer records.
                            items:
                              type: object
                              description: "An offer record."
                      rejected_offers:
                        type: object
                        description: Offers rejected for this affiliate (requires `visibility` relationship).
                        properties:
                          total:
                            type: integer
                            description: Total number of rejected offers.
                          entries:
                            type: array
                            description: List of rejected offer records.
                            items:
                              type: object
                              description: "An offer record."
                      api_keys:
                        type: object
                        description: API keys for this affiliate (requires `api` relationship).
                        properties:
                          total:
                            type: integer
                            description: Total number of API keys.
                          entries:
                            type: array
                            description: List of API key records.
                            items:
                              type: object
                              description: "An API key record."
                      api_whitelist_ips:
                        type: object
                        description: Whitelisted IPs for API access (requires `api` relationship).
                        properties:
                          total:
                            type: integer
                            description: Total number of whitelisted IPs.
                          entries:
                            type: array
                            description: List of whitelisted IP records.
                            items:
                              type: object
                              description: "An API whitelist IP record."
                      ios_app_sources:
                        type: object
                        description: iOS app sources associated with this affiliate.
                        properties:
                          total:
                            type: integer
                            description: Total number of iOS app source records.
                          entries:
                            type: array
                            description: List of iOS app source records.
                            items:
                              type: object
                              description: "An iOS app source record."
        "404":
          description: Affiliate not found.
      security:
        - API Key: []
    put:
      summary: Update Affiliate
      tags:
        - Affiliates
      parameters:
        - in: path
          name: affiliateId
          required: true
          schema:
            type: integer
          description: The unique affiliate ID to update.
      requestBody:
        required: true
        content:
          application/json:
            example:
              name: "Updated Affiliate Name"
              account_status: "active"
              network_employee_id: 2
              default_currency_id: "USD"
              internal_notes: "Updated notes"
              enable_media_cost_tracking_links: true
              is_contact_address_enabled: true
              network_affiliate_tier_id: 1
              contact_address:
                address_1: "456 Oak Ave"
                address_2: "Floor 3"
                city: "San Francisco"
                region_code: "CA"
                country_code: "US"
                zip_postal_code: "94102"
              labels: ["premium", "media-buyer"]
              billing:
                billing_frequency: "monthly"
                payment_type: "none"
                details:
                  day_of_month: 1
                billing: {}
            schema:
              type: object
              required:
                - name
                - account_status
                - network_employee_id
                - default_currency_id
                - billing
              properties:
                name:
                  type: string
                  description: The name of the affiliate.
                account_status:
                  type: string
                  enum:
                    - active
                    - inactive
                  description: The affiliate's account status.
                network_employee_id:
                  type: integer
                  description: The employee ID of the affiliate's account manager.
                internal_notes:
                  type: string
                  description: Internal notes for network usage.
                default_currency_id:
                  type: string
                  description: >
                    The affiliate's default currency. Can be found using the
                    [metadata API](/api-reference/get-metacurrencies).
                enable_media_cost_tracking_links:
                  type: boolean
                  description: Whether or not you want to allow the affiliate to pass and override cost in their tracking links. Defaults to `false`.
                referrer_id:
                  type: integer
                  description: The ID of the affiliate that referred this affiliate. Defaults to `0` (none).
                is_contact_address_enabled:
                  type: boolean
                  description: Whether or not you want to include a contact address for this affiliate. Defaults to `false`.
                network_affiliate_tier_id:
                  type: integer
                  description: The ID of the Affiliate Tier.
                contact_address:
                  type: object
                  description: >
                    The affiliate's contact address information. Only required if
                    `is_contact_address_enabled` is set to `true`.
                  properties:
                    address_1:
                      type: string
                      description: Street address line 1.
                    address_2:
                      type: string
                      description: Apartment / suite.
                    city:
                      type: string
                      description: City name.
                    region_code:
                      type: string
                      description: State or region code (e.g. "CA").
                    country_code:
                      type: string
                      description: Two-letter country code (e.g. "US").
                    zip_postal_code:
                      type: string
                      description: ZIP or postal code.
                labels:
                  type: array
                  items:
                    type: string
                    description: "A label string."
                  description: Used to associate labels to the affiliate.
                billing:
                  type: object
                  description: The affiliate's billing information.
                  required:
                    - billing_frequency
                    - payment_type
                    - details
                    - billing
                  properties:
                    billing_frequency:
                      type: string
                      enum:
                        - weekly
                        - bimonthly
                        - monthly
                        - two_months
                        - quarterly
                        - manual
                        - other
                      description: The affiliate's invoicing frequency.
                    payment_type:
                      type: string
                      enum:
                        - none
                        - pay
                        - paypal
                        - check
                        - wire
                        - direct_deposit
                        - tipalti
                        - paxum
                        - veem
                        - payoneer
                        - bitcoin
                        - webmoney
                        - capitalist
                        - transferwise
                        - gift_card
                        - masspay
                        - skrill
                      description: >
                        The affiliate's payment type. `pay` refers to Everflow Pay.
                    tax_id:
                      type: string
                      description: The affiliate's tax ID.
                    is_invoice_creation_auto:
                      type: boolean
                      description: Configures automatic invoice creation for the affiliate. Defaults to `false`.
                    auto_invoice_start_date:
                      type: string
                      description: >
                        Configures automatic invoice creation start date. Dates are formatted
                        `YYYY-mm-dd`. Required if `is_invoice_creation_auto` is set to `true`.
                    default_invoice_is_hidden:
                      type: boolean
                      description: Configures whether invoices are hidden from the affiliate by default. Defaults to `false`.
                    invoice_generation_days_delay:
                      type: integer
                      description: >
                        Configures how many days to wait for invoice generation after the
                        specified billing period. Defaults to `0`.
                    invoice_amount_threshold:
                      type: number
                      format: double
                      description: >
                        Configures the minimal amount required for an invoice to be generated.
                        Sums below the threshold are rolled over to the next billing period.
                        Defaults to `0`, which is none.
                    default_payment_terms:
                      type: integer
                      description: >
                        Configures the number of days that will be used as the payment term
                        on generated invoices. Defaults to `0`.
                    details:
                      type: object
                      description: >
                        The affiliate's billing frequency details. Required when `billing_frequency`
                        is set to anything other than `manual` or `other`, or when `payment_type`
                        is not `none` (an empty object is required).
                      properties:
                        day_of_week:
                          type: integer
                          description: >
                            Specifies the day of the week, starting on Sunday (0=Sunday .. 6=Saturday).
                            Required when `billing_frequency` is set to `weekly`.
                        day_of_month_one:
                          type: integer
                          description: Specifies first day of the month. Required when `billing_frequency` is set to `bimonthly`.
                        day_of_month_two:
                          type: integer
                          description: Specifies second day of the month. Required when `billing_frequency` is set to `bimonthly`.
                        day_of_month:
                          type: integer
                          description: >
                            Specifies day of the month. Required when `billing_frequency` is set to
                            `monthly`, `two_months` or `quarterly`.
                        starting_month:
                          type: integer
                          description: >
                            Specifies the month from which the cycle is set to begin. Required when
                            `billing_frequency` is set to `two_months` or `quarterly`.
                    billing:
                      type: object
                      description: >
                        The affiliate's payment method details. When `payment_type` is set to
                        `none`, an empty object (`{}`) should be applied.
                      properties:
                        paxum_id:
                          type: string
                          description: The affiliate's Paxum ID. Required when `payment_type` is `paxum`.
                        paypal_reception_method:
                          type: string
                          enum:
                            - email
                            - phone
                            - paypal_account
                          description: The reception method used with PayPal. Required when `payment_type` is `paypal`.
                        reception_identifier:
                          type: string
                          description: The affiliate's PayPal reception identifier. Required when `payment_type` is `paypal`.
                        email:
                          type: string
                          description: The affiliate's email. Required when `payment_type` is `payoneer` or `veem`.
                        is_existing_payee:
                          type: boolean
                          description: Whether to assign an existing payee ID. Required when `payment_type` is `tipalti`.
                        idap:
                          type: string
                          description: The payee's IDAP (Payee ID). Required when `payment_type` is `tipalti` and `is_existing_payee` is `true`.
                        first_name:
                          type: string
                          description: The affiliate's first name. Required when `payment_type` is `veem`.
                        last_name:
                          type: string
                          description: The affiliate's last name. Required when `payment_type` is `veem`.
                        phone:
                          type: string
                          description: The affiliate's phone number (international format). Required when `payment_type` is `veem`.
                        country_iso:
                          type: string
                          description: The affiliate's country ISO code. Required when `payment_type` is `veem`.
                        bank_name:
                          type: string
                          description: The affiliate's bank name. Required when `payment_type` is `wire` or `direct_deposit`.
                        bank_address:
                          type: string
                          description: The affiliate's bank address. Required when `payment_type` is `wire` or `direct_deposit`.
                        account_name:
                          type: string
                          description: The affiliate's bank account name. Required when `payment_type` is `wire` or `direct_deposit`.
                        account_number:
                          type: string
                          description: The affiliate's bank account number. Required when `payment_type` is `wire` or `direct_deposit`.
                        routing_number:
                          type: string
                          description: The affiliate's bank routing number. Required when `payment_type` is `wire` or `direct_deposit`.
                        swift_code:
                          type: string
                          description: The affiliate's SWIFT code. Required when `payment_type` is `wire` or `direct_deposit`.
      responses:
        "200":
          description: Affiliate updated successfully.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Affiliate"
        "404":
          description: Affiliate not found.
      security:
        - API Key: []
  /networks/pending/affiliates:
    patch:
      summary: Process Pending Affiliates
      tags:
        - Affiliates
      requestBody:
        required: true
        content:
          application/json:
            example:
              network_affiliate_ids: [7]
              account_status: "active"
              affiliate_manager_id: 1
              internal_notes: "Approved via API"
            schema:
              type: object
              required:
                - network_affiliate_ids
                - account_status
              properties:
                network_affiliate_ids:
                  type: array
                  items:
                    type: integer
                    description: "An affiliate ID to process."
                  description: Array of affiliate IDs to update.
                account_status:
                  type: string
                  description: New account status.
                  enum: [active, inactive, pending, suspended]
                affiliate_manager_id:
                  type: integer
                  description: ID of the affiliate manager to assign.
                internal_notes:
                  type: string
                  description: Internal notes about the status change.
                network_affiliate_tier_id:
                  type: integer
                  description: Affiliate tier ID to assign.
                network_traffic_source_id:
                  type: integer
                  description: Traffic source ID to assign.
      responses:
        "200":
          description: Pending affiliates processed successfully.
          content:
            application/json:
              example:
                result: true
              schema:
                type: object
                properties:
                  result:
                    type: boolean
                    description: Whether the pending affiliates were processed successfully.
      security:
        - API Key: []
components:
  schemas:
    Affiliate:
      type: object
      description: "An affiliate (partner) account in the network."
      properties:
        network_affiliate_id:
          type: integer
          description: Unique affiliate ID.
        network_id:
          type: integer
          description: Network ID.
        name:
          type: string
          description: Affiliate name.
        account_status:
          type: string
          enum:
            - active
            - inactive
            - pending
            - suspended
          description: Current account status.
        network_employee_id:
          type: integer
          description: Account manager employee ID.
        internal_notes:
          type: string
          description: Internal notes about this affiliate (not visible to the affiliate).
        default_currency_id:
          type: string
          description: Default currency code (e.g. USD).
        enable_media_cost_tracking_links:
          type: boolean
          description: Whether media cost tracking links are enabled for this affiliate.
        is_contact_address_enabled:
          type: boolean
          description: Whether the contact address is enabled.
        network_affiliate_tier_id:
          type: integer
          writeOnly: true
          description: The affiliate tier ID this affiliate belongs to. Only used in create/update requests.
        has_notifications:
          type: boolean
          description: Whether notifications are enabled.
        network_traffic_source_id:
          type: integer
          description: Associated traffic source ID.
        account_executive_id:
          type: integer
          description: Account executive employee ID.
        adress_id:
          type: integer
          description: Address record ID. Note the field name uses a single 'd' (`adress_id`) in the API response.
        address_id:
          type: integer
          description: Address record ID (alias).
        referrer_id:
          type: integer
          description: ID of the referring affiliate, if any.
        contact_address:
          type: object
          writeOnly: true
          description: Contact address. Only used in create/update requests.
          properties:
            address_1:
              type: string
              description: Street address line 1.
            address_2:
              type: string
              description: Apartment / suite.
            city:
              type: string
              description: City name.
            region_code:
              type: string
              description: State or region code (e.g. "CA").
            country_code:
              type: string
              description: Two-letter country code (e.g. "US").
            zip_postal_code:
              type: string
              description: ZIP or postal code.
        labels:
          type: array
          writeOnly: true
          description: Labels to assign. Only used in create/update requests. Use the relationship object to read labels.
          items:
            type: string
            description: "A label string."
        time_created:
          type: integer
          example: 1734455015
          description: Unix timestamp when the affiliate was created.
        time_saved:
          type: integer
          example: 1734455015
          description: Unix timestamp when the affiliate was last updated.
        relationship:
          type: object
          description: Related data (only present when requested via query parameter).
          properties:
            labels:
              type: object
              description: Labels associated with this affiliate.
              properties:
                total:
                  type: integer
                  description: Total number of labels.
                entries:
                  type: array
                  description: List of label strings.
                  items:
                    type: string
                    description: "A label string."
            account_manager:
              type: object
              description: Account manager details.
              properties:
                first_name:
                  type: string
                  description: Account manager's first name.
                last_name:
                  type: string
                  description: Account manager's last name.
                email:
                  type: string
                  description: Account manager's email address.
                work_phone:
                  type: string
                  description: Account manager's work phone number.
                cell_phone:
                  type: string
                  description: Account manager's cell phone number.
                instant_messaging_id:
                  type: integer
                  description: Account manager's instant messaging platform ID.
                instant_messaging_identifier:
                  type: string
                  description: Account manager's instant messaging identifier.
            encoded_value:
              type: string
              description: Encoded tracking value.
            ios_app_sources:
              type: object
              description: iOS app sources associated with this affiliate.
              properties:
                total:
                  type: integer
                  description: Total number of iOS app sources.
                entries:
                  type: array
                  description: List of iOS app source records.
                  items:
                    type: object
                    description: "An iOS app source record."
            users:
              type: object
              description: User accounts associated with this affiliate.
              properties:
                total:
                  type: integer
                  description: Total number of users.
                entries:
                  type: array
                  description: List of user records.
                  items:
                    type: object
                    description: "An affiliate user record."
            overrides:
              type: object
              description: >
                Per-affiliate visibility overrides for advertiser variables.
                Controls which of `adv1`–`adv10` and `sale_amount` are visible
                to this partner, on a per-variable basis.
              properties:
                total:
                  type: integer
                  description: Total number of override entries.
                entries:
                  type: array
                  description: List of variable visibility overrides.
                  items:
                    type: object
                    properties:
                      is_visible:
                        type: boolean
                        description: Whether this variable is visible to the partner.
                      variable:
                        type: string
                        enum:
                          - adv1
                          - adv2
                          - adv3
                          - adv4
                          - adv5
                          - adv6
                          - adv7
                          - adv8
                          - adv9
                          - adv10
                          - sale_amount
                        description: The advertiser variable being controlled.
  securitySchemes:
    API Key:
      description: The Everflow API key generated from the Control Center > Security.
      in: header
      name: X-Eflow-Api-Key
      type: apiKey
