> ## Documentation Index
> Fetch the complete documentation index at: https://docs.topsort.com/llms.txt
> Use this file to discover all available pages before exploring further.

# [BETA] Campaign Performance Forecasts

> Get campaign performance forecasts with confidence intervals.

> ⚠️ **Beta Access Required**

> Contact your sales representative to gain access to this endpoint and
> start using it.

**Currently Supported:**
- Listing campaigns (autobidding) only

**Returns total campaign forecasts (not daily) for:**
- Total impressions with confidence intervals
- Total clicks with confidence intervals
- Total purchases with confidence intervals
- Total sales with confidence intervals
- Total ad spend with confidence intervals

**Constraints:**
- Date range cannot exceed 31 days.



## OpenAPI

````yaml /openapi.json post /public/v1/toptimize/forecasting/campaign
openapi: 3.1.0
info:
  title: Topsort Endpoints v2 API Reference
  description: >
    In order for a storefront to be able to run auctions in Topsort and report
    auction-related events back to Topsort,

    both the `/v2/auctions` and `/v2/events` endpoints must be integrated.

    Below are the endpoint and model definitions for each.
  contact:
    email: wicha@topsort.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  x-logo:
    url: https://assets.topsort.com/Topsort_logo_icon_dark.svg
    backgroundColor: '#fff'
    altText: Topsort
  version: 2.0.0
servers:
  - url: https://api.topsort.com
    description: Base API URL
security: []
tags:
  - name: Auctions
    description: >-
      An auction determines which products should be promoted based on the
      vendors' bids.
  - name: Events
    description: >-
      Events are sent to Topsort as part of the attribution and reporting
      journey.
  - name: Toptimize
    description: >
      An out-of-the-box solution for prediction, ranking, retrieval, and other
      elements of ad selection.
  - name: Toppie API
    description: Toppie management API.
  - name: Campaign API
    description: Full-featured campaign management API for banners and sponsored listings.
  - name: Catalog API
    description: Products catalog management API.
  - name: Billing API
    description: Marketplace and Vendor Billing management API.
  - name: Reporting API
    description: Marketplace, Vendor, Campaign, and product reporting API.
  - name: Invitation API
    description: Vendor invitations management API.
  - name: User API
    description: User management API.
  - name: Webhooks API
    description: Webhooks API that allows event-driven automation.
  - name: Assets API
    description: Assets management API.
  - name: Segments Service
    description: Segments Service.
  - name: Forecasting Service
    description: Toptimize Forecasting Service.
  - name: Offsite Ads API
    description: Offsite Ads API that allows to manage offsite ads campaigns.
  - name: Media API
    description: Ad configuration API.
paths:
  /public/v1/toptimize/forecasting/campaign:
    post:
      tags:
        - Forecasting Service
      summary: '[BETA] Campaign Performance Forecasts'
      description: |-
        Get campaign performance forecasts with confidence intervals.

        > ⚠️ **Beta Access Required**

        > Contact your sales representative to gain access to this endpoint and
        > start using it.

        **Currently Supported:**
        - Listing campaigns (autobidding) only

        **Returns total campaign forecasts (not daily) for:**
        - Total impressions with confidence intervals
        - Total clicks with confidence intervals
        - Total purchases with confidence intervals
        - Total sales with confidence intervals
        - Total ad spend with confidence intervals

        **Constraints:**
        - Date range cannot exceed 31 days.
      operationId: get_campaign_forecast
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/Advanced_APIs_PublicListingCampaignForecastRequest
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Advanced_APIs_PublicCampaignForecastResponse
              examples:
                example:
                  value:
                    forecasts:
                      impressions:
                        forecastValue: 150000
                        forecastIntervalMin: 142000
                        forecastIntervalMax: 158000
                      clicks:
                        forecastValue: 12500
                        forecastIntervalMin: 11800
                        forecastIntervalMax: 13200
                      purchases:
                        forecastValue: 875
                        forecastIntervalMin: 820
                        forecastIntervalMax: 930
                      sales:
                        forecastValue: 52500
                        forecastIntervalMin: 49000
                        forecastIntervalMax: 56000
                      adSpend:
                        forecastValue: 10500
                        forecastIntervalMin: 10000
                        forecastIntervalMax: 11000
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Advanced_APIs_HTTPValidationError'
      security:
        - Advanced_APIs_HTTPBearer: []
components:
  schemas:
    Advanced_APIs_PublicListingCampaignForecastRequest:
      properties:
        campaignFormat:
          $ref: '#/components/schemas/Advanced_APIs_PublicCampaignFormat'
          description: Campaign format type. Currently only 'listing' is supported.
        dailyBudget:
          type: number
          exclusiveMinimum: 0
          title: Dailybudget
          description: Daily budget for the campaign
        dateRange:
          $ref: '#/components/schemas/Advanced_APIs_PublicDateRange'
          description: Campaign date range
        targetRoas:
          type: number
          exclusiveMinimum: 0
          title: Targetroas
          description: Target Return on Ad Spend
        campaignType:
          $ref: '#/components/schemas/Advanced_APIs_PublicCampaignType'
          description: Campaign type (required)
        products:
          items:
            $ref: '#/components/schemas/Advanced_APIs_PublicProductRequest'
          type: array
          minItems: 1
          title: Products
          description: List of products in the campaign (required)
        triggers:
          items:
            $ref: '#/components/schemas/Advanced_APIs_PublicTriggerRequest'
          type: array
          title: Triggers
          description: List of campaign triggers (optional, defaults to empty list)
        targets:
          title: Targets
          description: >-
            Optional list of target variables to forecast. If not provided, all
            targets will be forecasted.
          oneOf:
            - items:
                $ref: '#/components/schemas/Advanced_APIs_PublicTargetVariable'
              type: array
            - type: 'null'
      type: object
      required:
        - campaignFormat
        - dailyBudget
        - dateRange
        - targetRoas
        - campaignType
        - products
      title: PublicListingCampaignForecastRequest
      description: Public API request for a listing campaign performance forecast.
    Advanced_APIs_PublicCampaignForecastResponse:
      properties:
        forecasts:
          $ref: '#/components/schemas/Advanced_APIs_PublicCampaignForecastMetrics'
          description: Campaign performance forecasts
      type: object
      required:
        - forecasts
      title: PublicCampaignForecastResponse
    Advanced_APIs_HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/Advanced_APIs_ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Advanced_APIs_PublicCampaignFormat:
      type: string
      enum:
        - listing
      title: PublicCampaignFormat
    Advanced_APIs_PublicDateRange:
      properties:
        startDate:
          type: string
          format: date
          title: Startdate
          description: Campaign start date (YYYY-MM-DD)
        endDate:
          type: string
          format: date
          title: Enddate
          description: >-
            Campaign end date (YYYY-MM-DD). Must be within 31 days of start
            date.
      type: object
      required:
        - startDate
        - endDate
      title: PublicDateRange
    Advanced_APIs_PublicCampaignType:
      type: string
      enum:
        - autobidding
      title: PublicCampaignType
    Advanced_APIs_PublicProductRequest:
      properties:
        id:
          type: string
          title: Id
          description: Product ID
      type: object
      required:
        - id
      title: PublicProductRequest
    Advanced_APIs_PublicTriggerRequest:
      properties:
        type:
          $ref: '#/components/schemas/Advanced_APIs_PublicTriggerType'
          description: Trigger type
        value:
          type: string
          title: Value
          description: Trigger value
      type: object
      required:
        - type
        - value
      title: PublicTriggerRequest
    Advanced_APIs_PublicTargetVariable:
      type: string
      enum:
        - ad_spend
        - clicks
        - impressions
        - purchases
        - sales
      title: PublicTargetVariable
    Advanced_APIs_PublicCampaignForecastMetrics:
      properties:
        impressions:
          oneOf:
            - $ref: '#/components/schemas/Advanced_APIs_PublicForecastMetric'
            - type: 'null'
        clicks:
          oneOf:
            - $ref: '#/components/schemas/Advanced_APIs_PublicForecastMetric'
            - type: 'null'
        purchases:
          oneOf:
            - $ref: '#/components/schemas/Advanced_APIs_PublicForecastMetric'
            - type: 'null'
        sales:
          oneOf:
            - $ref: '#/components/schemas/Advanced_APIs_PublicForecastMetric'
            - type: 'null'
        adSpend:
          oneOf:
            - $ref: '#/components/schemas/Advanced_APIs_PublicForecastMetric'
            - type: 'null'
      type: object
      title: PublicCampaignForecastMetrics
    Advanced_APIs_ValidationError:
      properties:
        loc:
          items:
            oneOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    Advanced_APIs_PublicTriggerType:
      type: string
      enum:
        - search
        - category
      title: PublicTriggerType
    Advanced_APIs_PublicForecastMetric:
      properties:
        forecastValue:
          type: number
          title: Forecastvalue
          description: Predicted value
        forecastIntervalMin:
          type: number
          title: Forecastintervalmin
          description: Lower bound of forecast interval
        forecastIntervalMax:
          type: number
          title: Forecastintervalmax
          description: Upper bound of forecast interval
      type: object
      required:
        - forecastValue
        - forecastIntervalMin
        - forecastIntervalMax
      title: PublicForecastMetric
  securitySchemes:
    Advanced_APIs_HTTPBearer:
      type: http
      description: >-
        A valid API key generated in Topsort's UI. Use the TSE API key if
        calling auctions or events API, otherwise use the TSC API key.
      scheme: bearer

````