# API Changelog Source: https://docs.topsort.com/en/api-reference/api-changelog API updates and changes ## API updates and changes for 2026 ### Changed * **Campaigns responses:** `promotionType` is marked as deprecated since November 21, 2024; use `adFormat` on campaign responses and `formatProperties` on bid responses instead. See the [Get campaigns](/en/api-reference/campaign-api/get-campaigns#response-campaigns-items-promotion-type) reference. From April 23, 2026, `promotionType` will be returned as `null`; removal from requests and responses is planned for April 30, 2026 (subject to confirmation). ## API updates and changes for 2025 ### Removed * `/public/v1/campaign-service/estimated-clicks` was removed after 1 year of deprecation. It has received no traffic for 7 months. ### Added * `/public/v1/offsite-ads/audiences/user-list` endpoint for managing user list audiences in offsite ads. ### Changed * `/v2/auctions`: Added `filter` field with `AttributesFilter` schema for product attribute filtering (supports `and`/`or` operators with attributes array). ### Changed * `/v2/auctions`: Added `page` object to sponsored listings and banner auction requests. * `/v2/auctions/sponsored-brand`: Added optional `page` field to request. ### Added * `/public/v1/campaign-service/campaigns/exclusive-banner` (POST) and `/public/v1/campaign-service/campaigns/exclusive-banner/{campaign-id}` (GET, PATCH) endpoints for exclusive banner campaign management. * `/public/v1/campaign-service/campaigns/exclusive-listing` (POST) and `/public/v1/campaign-service/campaigns/exclusive-listing/{campaign-id}` (GET, PATCH) endpoints for exclusive listing campaign management. * `/public/v1/media-service/slots/{slot-id}` endpoint with DELETE and PATCH methods for individual slot management. * POST method added to `/public/v1/offsite-ads/audiences` for creating audience jobs. ### Added * `/public/v1/campaign-service/json-templates` (GET, POST) and `/public/v1/campaign-service/json-templates/{json-template-id}` (GET, PATCH) endpoints for managing campaign JSON templates. * `/public/v1/media-service/slots` endpoint (GET, POST) for listing and creating media slots. * `/public/v1/media-service/slots/{slot-id}/fallback` endpoint (DELETE) for configuring slot fallback behavior. * `/public/v1/offsite-ads/audiences` endpoint (GET) for listing audiences in offsite ads. * DELETE method added to `/public/v1/campaign-service/campaigns/{campaign-id}/bids` for deleting all bids. ### Added * `/public/v1/toppie/reporting/file-reports/daily-kpis-by-product` endpoint (GET) for exporting daily KPIs by product. * `/public/v1/campaign-service/campaigns/{campaign-id}/products` endpoint (GET, PUT) for managing products within a campaign. * Offsite ads public API endpoints under `/public/v1/offsite-ads` ### Added * `/public/v1/toptimize/forecasting/campaign` (POST), `/public/v1/toptimize/forecasting/inventory` (POST), and `/public/v1/toptimize/forecasting/marketplace` (GET) endpoints for campaign and inventory forecasting. ### Added * Offsite Ads beta endpoints (`/v2/offsite-ads/`) * `/toptimize/v1/predictions` beta endpoint for CTR/CVR predictions. * `/toptimize/v1/retrieval` beta endpoint for object retrieval. * `/public/v1/segment-service/segments/{segment-id}/upload` endpoint (POST) for uploading segment data. * `/public/v1/campaign-service/campaigns/{campaign-id}/restrictions` (GET, POST) and `/public/v1/campaign-service/campaigns/{campaign-id}/restrictions/{restriction-id}` (PATCH) endpoints for campaign restriction management. * `/public/v1/campaign-service/restriction-types` (GET) and `/public/v1/campaign-service/restriction-types/{restriction-type-id}` (GET) endpoints for managing restriction type definitions. * `/public/v1/reporting-service/file-reports/scored-attribution` endpoint (GET) for scored attribution file reports. * `/public/v1/reporting-service/file-reports/interactions` endpoint (GET) for exporting interaction data. * DELETE method added to `/public/v1/toppie/campaigns/{campaign-id}` for deleting campaigns. ### Changed * Events: Added missing references to display new pageview object. * `/v2/events`: Added optional `deviceType` and `channel` fields for impressions, clicks, purchases, and pageviews. ### Added * `/toptimize/v1/rank` beta endpoint for ranking objects. * `/public/v1/segment-service/segments` (GET, PUT) and `/public/v1/segment-service/segments/{segment-id}` (DELETE) endpoints for segment management. * `/public/v1/segment-service/segments/{segment-id}/signed-url` endpoint (GET) for obtaining signed URLs for segment uploads. * `/public/v1/toppie/products` endpoint (GET) for listing vendor products in Toppie. * `/public/v1/reporting-service/interactions` endpoint (GET) for querying interaction data. * `/public/v1/toppie/account/balance` endpoint (GET) for viewing account balance. * `/public/v1/toppie/account/topups` endpoint (GET) for viewing account top-ups. * `/public/v1/billing-service/campaign-billing-contact` endpoint (GET, PUT). * `/public/v1/billing-service/billing-contacts` (GET) and `/public/v1/billing-service/billing-contacts/{billing-contact-id}` (GET, PUT) endpoints for marketplace-level billing contact management. * `/public/v1/billing-service/vendor-billing-contact` (PUT) and `/public/v1/billing-service/vendors/{external-vendor-id}/vendor-billing-contact/{billing-contact-id}` (DELETE) endpoints for vendor-level billing contacts. * PATCH method added to `/public/v1/toppie/campaigns/{campaign-id}` for updating campaigns. ### Changed * `/v2/auctions/sponsored-brand`: Added optional `opaqueUserId` and `vendorId` fields. * Events: Added placement tracking example for carousel analytics. * `/v2/auctions/travel`: Extended to support **flights** in addition to hotels. ### Added * `/public/v1/toppie/campaigns` (GET, POST) and `/public/v1/toppie/campaigns/{campaign-id}` (GET) endpoints for Toppie campaign management. * `/public/v1/toppie/campaigns/{campaign-id}/bids` endpoint (GET) for managing campaign bids. * Toppie reporting endpoints (`/public/v1/toppie/reporting`) * `/public/v1/billing-service/vendors/{external-vendor-id}/wallets` (GET, POST) and `/public/v1/billing-service/vendors/{external-vendor-id}/wallets/{wallet-id}/adjust` (POST) endpoints for vendor wallet management. * PATCH method added to `/public/v1/catalog-search-service/catalogs/products` for updating products. ### Changed * Events: Documented that halo attribution requires `vendorId`. ### Added * `/v2/auctions/travel` endpoint for hotel travel auctions. * `/v2/events/beta/link-users` beta endpoint to link user accounts. * `/public/v1/reporting-service/marketplace/campaigns-kpis` (GET) and `/public/v1/reporting-service/marketplace/vendors-kpis` (GET) endpoints for marketplace-level KPI reporting. # Create auctions Source: https://docs.topsort.com/en/api-reference/auctions/create-auctions /openapi.json post /v2/auctions Use the `/auctions` endpoint to create auctions. Each batch of auction requests can be a combination of sponsored listing auctions and banner auctions. Each auction type has a unique body schemas. # Create sponsored brand auctions Source: https://docs.topsort.com/en/api-reference/auctions/create-sponsored-brand-auctions /openapi.json post /v2/auctions/sponsored-brand # Create travel auctions Source: https://docs.topsort.com/en/api-reference/auctions/create-travel-auctions /openapi.json post /v2/auctions/travel Use the `/auctions/travel` endpoint to create batch auctions for sponsored travel listings. We support two types of sponsored travel listings, hotels and flights. Each batch of auction requests can be a combination of sponsored hotel and flight listing auctions. Each auction type has a unique body schemas. # Authentication Source: https://docs.topsort.com/en/api-reference/authentication Learn how to authenticate with Topsort APIs using a bearer token Topsort's APIs are authenticated via bearer tokens. Requests must include an authorization header containing an API key. If this header is missing or invalid, the HTTP response code will be `401 Unauthorized`. ```sh theme={null} POST /v2/auctions HTTP/2 Host: app.topsort.com ... Authorization: Bearer ... ``` ## Obtaining an API Key By this point we will have provided you with credentials for our Auction manager. Visit the [Auction Manager: API Integration](https://app.topsort.com/new/en-US/marketplace/account-settings/api-integration) page to generate your API keys. Access the Topsort API Integration page by clicking on **Settings**, and then selecting **API Integration**. Screenshot Generate an API key by pressing the **Generate API key** button. Note that there are two different types of keys: Marketplace API keys and Advanced API keys. In order to access the `/auctions` and `/events` endpoints, you must create a Marketplace API key. For all other APIs, you need an Advanced API key. Screenshot Click on the **Copy key** button to the right of the newly generated token to copy it to your clipboard. Screenshot Use the API Key on your servers. **Keep api keys secret,** this is not a public key. **Do not share it with your frontend or clients**. **API keys are scoped per marketplace**. If you have multiple marketplaces, then you will require multiple API keys. # API Key Types Source: https://docs.topsort.com/en/api-reference/authentication/api-key-types Understand the two types of API keys in Topsort and when to use each one for different endpoints. Topsort uses two types of API keys for different purposes. ## Quick Reference | Key Type | Purpose | | ----------------------- | ------------------------------------------- | | **Marketplace API Key** | Auction and event endpoints | | **Advanced API Key** | Catalog sync, campaigns, reporting, billing | Most integrations need **both** key types: an Advanced key for catalog sync, campaigns, and reporting, and a Marketplace key for auctions and events. ## Which Key Do I Need? | Endpoint | Key Type | | ------------------------------------- | ----------- | | `POST /v2/auctions` | Marketplace | | `POST /v2/events` | Marketplace | | `/public/v1/catalog-search-service/*` | Advanced | | `/public/v1/campaign-service/*` | Advanced | | `/public/v1/reporting-service/*` | Advanced | | `/public/v1/billing-service/*` | Advanced | ## Common Errors ### 401 Unauthorized ```json theme={null} { "error": "Unauthorized", "message": "Invalid or missing API key" } ``` **Causes:** * API key not included in `Authorization` header * Key is malformed or expired * Using Advanced key on Marketplace-only endpoint **Fix:** Verify header format: `Authorization: Bearer YOUR_API_KEY` ### 403 Forbidden ```json theme={null} { "error": "Forbidden", "message": "Insufficient permissions" } ``` **Causes:** * Using an Advanced key on an endpoint that requires a Marketplace key * Using a Marketplace key on an endpoint that requires an Advanced key **Fix:** Use the key type that matches the endpoint — see [Which Key Do I Need?](#which-key-do-i-need) above ## How to Get Your Keys ### Marketplace API Key Log in to your Topsort Admin dashboard Go to **Settings** → **API Integration** Click **"Generate API key"** and select **"Marketplace API key"** Copy the key immediately and store it securely (it's only shown once) ### Advanced API Key Log in to your Topsort Admin dashboard Go to **Settings** → **API Access** Click **"Generate Key"** to create your Advanced API key Copy the key and store it securely in your environment variables ## Security Best Practices * **Never commit keys to version control** * **Store keys in environment variables** * **Rotate keys regularly** * **Use different keys for different environments (dev, staging, production)** * **Restrict key access to only necessary team members** # Add Vendor Balance Source: https://docs.topsort.com/en/api-reference/billing-api/add-vendor-balance /openapi.json post /public/v1/billing-service/vendors/{external-vendor-id}/balance Endpoint to add some balance for a vendor. Will truncate the input to its minimum denomination, e.g. USD 1,000.234 is USD 1,000.23 , as there is no fraction of a cent. # Create Wallet Source: https://docs.topsort.com/en/api-reference/billing-api/create-wallet /openapi.json post /public/v1/billing-service/vendors/{external-vendor-id}/wallets Endpoint to create a wallet for a vendor. There is a limit of 3 Wallets per vendor. # Get Billing Contacts Source: https://docs.topsort.com/en/api-reference/billing-api/get-billing-contacts /openapi.json get /public/v1/billing-service/billing-contacts Endpoint to get all the billing contacts. # Get Campaign Billing Contact Source: https://docs.topsort.com/en/api-reference/billing-api/get-campaign-billing-contact /openapi.json get /public/v1/billing-service/campaign-billing-contact Endpoint to get a billing contact campaign. # Get Vendor Balance Source: https://docs.topsort.com/en/api-reference/billing-api/get-vendor-balance /openapi.json get /public/v1/billing-service/vendors/{external-vendor-id}/balance Endpoint to get the balance for a vendor. # Get Vendor Wallets Source: https://docs.topsort.com/en/api-reference/billing-api/get-vendor-wallets /openapi.json get /public/v1/billing-service/vendors/{external-vendor-id}/wallets Endpoint to list all the wallets of a vendor. # Upsert Campaign Billing Contact Source: https://docs.topsort.com/en/api-reference/billing-api/upsert-campaign-billing-contact /openapi.json put /public/v1/billing-service/campaign-billing-contact Endpoint to upsert a billing contact campaign. # Upsert Vendor Billing Contact Source: https://docs.topsort.com/en/api-reference/billing-api/upsert-vendor-billing-contact /openapi.json put /public/v1/billing-service/vendor-billing-contact Endpoint to assign a billing contact to a vendor. # [BETA] Create exclusive banner campaign. Source: https://docs.topsort.com/en/api-reference/campaign-api/[beta]-create-exclusive-banner-campaign /openapi.json post /public/v1/campaign-service/campaigns/exclusive-banner Endpoint to create exclusive banner campaigns and its respective bids. Exclusive campaigns override auctions and are always shown by a fixed daily price. # [BETA] Create exclusive listing campaign. Source: https://docs.topsort.com/en/api-reference/campaign-api/[beta]-create-exclusive-listing-campaign /openapi.json post /public/v1/campaign-service/campaigns/exclusive-listing Endpoint to create exclusive listing campaigns and its respective bids. Exclusive campaigns override auctions and are always shown by a fixed daily price. # [BETA] Get exclusive banner campaign by ID. Source: https://docs.topsort.com/en/api-reference/campaign-api/[beta]-get-exclusive-banner-campaign-by-id /openapi.json get /public/v1/campaign-service/campaigns/exclusive-banner/{campaign-id} Endpoint to fetch a specific exclusive banner campaign by Campaign ID. # [BETA] Get exclusive listing campaign by ID. Source: https://docs.topsort.com/en/api-reference/campaign-api/[beta]-get-exclusive-listing-campaign-by-id /openapi.json get /public/v1/campaign-service/campaigns/exclusive-listing/{campaign-id} Endpoint to fetch a specific exclusive listing campaign by Campaign ID. # [BETA] Update exclusive banner campaign by ID. Source: https://docs.topsort.com/en/api-reference/campaign-api/[beta]-update-exclusive-banner-campaign-by-id /openapi.json patch /public/v1/campaign-service/campaigns/exclusive-banner/{campaign-id} Endpoint to update fields for a given exclusive banner campaign. # [BETA] Update exclusive listing campaign by ID. Source: https://docs.topsort.com/en/api-reference/campaign-api/[beta]-update-exclusive-listing-campaign-by-id /openapi.json patch /public/v1/campaign-service/campaigns/exclusive-listing/{campaign-id} Endpoint to update fields for a given exclusive listing campaign. # Create a sponsored brand campaign. Source: https://docs.topsort.com/en/api-reference/campaign-api/create-a-sponsored-brand-campaign /openapi.json post /public/v1/campaign-service/campaigns/sponsored-brand Create a regular sponsored brand campaign using external vendor and slot identifiers. Only V2 sponsored brand campaigns are supported. # Create Campaign Source: https://docs.topsort.com/en/api-reference/campaign-api/create-campaign /openapi.json post /public/v1/campaign-service/campaigns Creates a campaign with its associated budget and bids. Supports all campaign types except exclusive campaigns. # Create Campaign Bids Source: https://docs.topsort.com/en/api-reference/campaign-api/create-campaign-bids /openapi.json post /public/v1/campaign-service/campaigns/{campaign-id}/bids Endpoint to create a bid for a campaign. # Create Campaign Restriction Source: https://docs.topsort.com/en/api-reference/campaign-api/create-campaign-restriction /openapi.json post /public/v1/campaign-service/campaigns/{campaign-id}/restrictions Endpoint to create a campaign restriction. # Create Json Template Source: https://docs.topsort.com/en/api-reference/campaign-api/create-json-template /openapi.json post /public/v1/campaign-service/json-templates Endpoint to create a new JSON template. # Create or update campaign timetables (dayparting). Source: https://docs.topsort.com/en/api-reference/campaign-api/create-or-update-campaign-timetables-dayparting /openapi.json put /public/v1/campaign-service/campaigns/{campaign-id}/timetables Create or update dayparting configuration for a campaign. Dayparting allows you to control when your campaign is active during the week. You can specify active hours for each day of the week (1=Monday, 7=Sunday). HOUR SEMANTICS: - start_hour: Campaign starts at this hour (inclusive, 0-23) - end_hour: Campaign stops at this hour (exclusive, 1-24) - Example: start_hour=9, end_hour=17 runs from 9:00 AM to 5:00 PM - For all-day: start_hour=0, end_hour=24 This endpoint performs an upsert operation - it will create new timetables or update existing ones based on the day_of_week. Days not in the request remain unchanged. # Delete a campaign timetable for a specific day (dayparting). Source: https://docs.topsort.com/en/api-reference/campaign-api/delete-a-campaign-timetable-for-a-specific-day-dayparting /openapi.json delete /public/v1/campaign-service/campaigns/{campaign-id}/timetables/{day-of-week} Delete the timetable configuration for a specific day of the week. This removes the dayparting rule for the specified day, reverting the campaign to be active all day for that day (if the campaign is otherwise active). After deletion, the campaign will run 24 hours on the specified day (no time restrictions). # Delete All Bids From A Campaign Source: https://docs.topsort.com/en/api-reference/campaign-api/delete-all-bids-from-a-campaign /openapi.json delete /public/v1/campaign-service/campaigns/{campaign-id}/bids Endpoint to delete all bids from a campaign. # Delete Campaign Bid By Id Source: https://docs.topsort.com/en/api-reference/campaign-api/delete-campaign-bid-by-id /openapi.json delete /public/v1/campaign-service/campaigns/{campaign-id}/bids/{bid-id} Endpoint to delete a bid. # Delete Campaign By Id Source: https://docs.topsort.com/en/api-reference/campaign-api/delete-campaign-by-id /openapi.json delete /public/v1/campaign-service/campaigns/{campaign-id} Endpoint to delete a specific campaign. # Get a sponsored brand campaign. Source: https://docs.topsort.com/en/api-reference/campaign-api/get-a-sponsored-brand-campaign /openapi.json get /public/v1/campaign-service/campaigns/sponsored-brand/{campaign-id} Retrieve a regular sponsored brand campaign by ID. The response uses external vendor and slot identifiers and only exposes V2 sponsored brand campaigns. # Get Campaign Bids Source: https://docs.topsort.com/en/api-reference/campaign-api/get-campaign-bids /openapi.json get /public/v1/campaign-service/campaigns/{campaign-id}/bids Endpoint to retrieve all campaign's bids. # Get Campaign By Id Source: https://docs.topsort.com/en/api-reference/campaign-api/get-campaign-by-id /openapi.json get /public/v1/campaign-service/campaigns/{campaign-id} Endpoint to retrieve specific campaign by Campaign ID. It is expected to use at Campaign Page. # Get Campaign Products (Banners & Sponsored Brands) Source: https://docs.topsort.com/en/api-reference/campaign-api/get-campaign-products-banners-&-sponsored-brands /openapi.json get /public/v1/campaign-service/campaigns/{campaign-id}/products Returns the products associated with a campaign. This endpoint only applies to Banners and Sponsored Brands campaigns. It does not return products for Sponsored Listings campaigns. # Get Campaign Restriction Source: https://docs.topsort.com/en/api-reference/campaign-api/get-campaign-restriction /openapi.json get /public/v1/campaign-service/campaigns/{campaign-id}/restrictions Endpoint to get campaign restrictions. # Get Campaigns Source: https://docs.topsort.com/en/api-reference/campaign-api/get-campaigns /openapi.json get /public/v1/campaign-service/campaigns Endpoint to retrieve campaigns. Campaigns can be filtered by Vendor ID and status. It is expected to use for getting all campaigns of a marketplace & all campaigns of a vendor in dashboards. Filtering by status is expected to use at review page getting campaigns approved, pending tabs. # Get Json Template Source: https://docs.topsort.com/en/api-reference/campaign-api/get-json-template /openapi.json get /public/v1/campaign-service/json-templates/{json-template-id} Endpoint to get a specific JSON template by ID. # Get Json Templates Source: https://docs.topsort.com/en/api-reference/campaign-api/get-json-templates /openapi.json get /public/v1/campaign-service/json-templates Endpoint to get JSON templates. # Get Products In Campaign Source: https://docs.topsort.com/en/api-reference/campaign-api/get-products-in-campaign /openapi.json get /public/v1/campaign-service/products-in-campaign This endpoint returns paginated product ids currently in active campaigns. You can filter by vendor_id and ad_format, fetching only from active campaigns and bids. # Get Restriction Type Source: https://docs.topsort.com/en/api-reference/campaign-api/get-restriction-type /openapi.json get /public/v1/campaign-service/restriction-types/{restriction-type-id} Endpoint to get a specific restriction type. # Get Restriction Types Source: https://docs.topsort.com/en/api-reference/campaign-api/get-restriction-types /openapi.json get /public/v1/campaign-service/restriction-types Endpoint to get all restriction types. # List sponsored brand campaign bids. Source: https://docs.topsort.com/en/api-reference/campaign-api/list-sponsored-brand-campaign-bids /openapi.json get /public/v1/campaign-service/campaigns/sponsored-brand/{campaign-id}/bids Retrieve a cursor-paginated list of bids for a regular sponsored brand campaign. The response uses external slot identifiers and only exposes V2 sponsored brand bids. # Replace sponsored brand campaign bids. Source: https://docs.topsort.com/en/api-reference/campaign-api/replace-sponsored-brand-campaign-bids /openapi.json put /public/v1/campaign-service/campaigns/sponsored-brand/{campaign-id}/bids Replace all bids for a regular sponsored brand campaign using external slot identifiers. Only V2 sponsored brand campaigns are publicly addressable. # Retrieve campaign timetables (dayparting). Source: https://docs.topsort.com/en/api-reference/campaign-api/retrieve-campaign-timetables-dayparting /openapi.json get /public/v1/campaign-service/campaigns/{campaign-id}/timetables Retrieve the dayparting configuration for a campaign. Returns all configured timetables for the campaign, ordered by day of week. If no timetables are configured, returns an empty list. HOUR SEMANTICS: - start_hour: Campaign starts at this hour (inclusive, 0-23) - end_hour: Campaign stops at this hour (exclusive, 1-24) - Example: start_hour=9, end_hour=17 means runs from 9:00 AM to 5:00 PM. # Update a JSON template Source: https://docs.topsort.com/en/api-reference/campaign-api/update-a-json-template /openapi.json patch /public/v1/campaign-service/json-templates/{json-template-id} Partially updates a JSON template by its ID. Returns 404 if the template does not exist, 409 if the new name conflicts with an existing template, or if the template is in use and the JSON schema change is not strictly additive (only new optional top-level properties are allowed while in use). # Update a sponsored brand campaign. Source: https://docs.topsort.com/en/api-reference/campaign-api/update-a-sponsored-brand-campaign /openapi.json patch /public/v1/campaign-service/campaigns/sponsored-brand/{campaign-id} Partially update a regular sponsored brand campaign. Only V2 sponsored brand campaigns are publicly addressable. # Update Campaign Bid By Id Source: https://docs.topsort.com/en/api-reference/campaign-api/update-campaign-bid-by-id /openapi.json patch /public/v1/campaign-service/campaigns/{campaign-id}/bids/{bid-id} Endpoint to update a bid. # Update Campaign By Id Source: https://docs.topsort.com/en/api-reference/campaign-api/update-campaign-by-id /openapi.json patch /public/v1/campaign-service/campaigns/{campaign-id} Endpoint to update fields for a given campaign. # Update Campaign Restriction Source: https://docs.topsort.com/en/api-reference/campaign-api/update-campaign-restriction /openapi.json patch /public/v1/campaign-service/campaigns/{campaign-id}/restrictions/{restriction-id} Endpoint to update a campaign restriction. # Upsert Campaign Products Source: https://docs.topsort.com/en/api-reference/campaign-api/upsert-campaign-products /openapi.json put /public/v1/campaign-service/campaigns/{campaign-id}/products Endpoint to upsert campaign products. # Delete Categories Source: https://docs.topsort.com/en/api-reference/catalog-api/delete-categories /openapi.json delete /public/v1/catalog-search-service/catalogs/categories Delete one or more categories from the catalog. # Delete Products Source: https://docs.topsort.com/en/api-reference/catalog-api/delete-products /openapi.json delete /public/v1/catalog-search-service/catalogs/products Delete products by ID. # Delete Vendors Source: https://docs.topsort.com/en/api-reference/catalog-api/delete-vendors /openapi.json delete /public/v1/catalog-search-service/catalogs/vendors Delete vendors by ID. This function won't error out when trying to delete vendors that don't exist. # Get Categories Source: https://docs.topsort.com/en/api-reference/catalog-api/get-categories /openapi.json get /public/v1/catalog-search-service/catalogs/categories Get multiple categories from the catalog. # Get Categories Count Source: https://docs.topsort.com/en/api-reference/catalog-api/get-categories-count /openapi.json get /public/v1/catalog-search-service/catalogs/categories/count Get the number of categories in the catalog. # Get Category Source: https://docs.topsort.com/en/api-reference/catalog-api/get-category /openapi.json get /public/v1/catalog-search-service/catalogs/categories/{category-id} Get a single category from the catalog. # Get Product Source: https://docs.topsort.com/en/api-reference/catalog-api/get-product /openapi.json get /public/v1/catalog-search-service/catalogs/products/{product-id} Get product by ID. # Get Products Source: https://docs.topsort.com/en/api-reference/catalog-api/get-products /openapi.json get /public/v1/catalog-search-service/catalogs/products Get multiple products from the catalog. # Get Products Count Source: https://docs.topsort.com/en/api-reference/catalog-api/get-products-count /openapi.json get /public/v1/catalog-search-service/catalogs/products/count Get the number of products in the catalog. # Get Vendor Source: https://docs.topsort.com/en/api-reference/catalog-api/get-vendor /openapi.json get /public/v1/catalog-search-service/catalogs/vendors/{vendor-id} Get vendor by ID. # Get Vendors Source: https://docs.topsort.com/en/api-reference/catalog-api/get-vendors /openapi.json get /public/v1/catalog-search-service/catalogs/vendors Get vendors. # Update Products Source: https://docs.topsort.com/en/api-reference/catalog-api/update-products /openapi.json patch /public/v1/catalog-search-service/catalogs/products Update products. # Upsert Categories Source: https://docs.topsort.com/en/api-reference/catalog-api/upsert-categories /openapi.json put /public/v1/catalog-search-service/catalogs/categories Create or replace one or more categories in the catalog. # Upsert Products Source: https://docs.topsort.com/en/api-reference/catalog-api/upsert-products /openapi.json put /public/v1/catalog-search-service/catalogs/products Upsert products. # Upsert Vendors Source: https://docs.topsort.com/en/api-reference/catalog-api/upsert-vendors /openapi.json put /public/v1/catalog-search-service/catalogs/vendors Upsert vendors. # Handling Errors Source: https://docs.topsort.com/en/api-reference/errors Comprehensive guide to error codes and troubleshooting for Topsort's APIs # Errors When working with Topsort's APIs, you may encounter various error responses. This guide helps you understand, diagnose, and resolve common issues. ## Error Response Format Topsort APIs return errors as JSON arrays containing error objects: | Field | Type | Description | | :-------- | :----- | :--------------------------------------------------------- | | `errCode` | string | Short string uniquely identifying the problem | | `docUrl` | string | Link to documentation providing more information | | `message` | string | Optional human-readable explanation (may change over time) | ## HTTP Status Codes Unacceptable request format or incorrect syntax. Check request structure against API spec. API key issue or missing authorization tokens. Verify your authentication credentials. Resource doesn't exist or URL is incorrect. Check the endpoint path and resource ID. Request body doesn't match expected model. Missing required fields or wrong data types. Too many requests. Check rate limit headers: `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`. Unexpected server problem. Our team typically fixes these issues quickly. Check status page. ## Specific Error Codes * **`invalid_api_key`** - The API key in the authorization header is missing, invalid, or has expired. See [authentication](/en/api-reference/authentication) for details. * **`bad_request`** - The request could not be parsed * **`invalid_json`** - The request is not valid JSON * **`empty_request`** - Request body is empty; ensure you're sending data * **`request_canceled`** - The caller canceled the request * **`invalid_operation`** - The operation is not valid in the current state * **`missing_auctions`** - You must specify at least one auction * **`too_many_auctions`** - At most 5 auctions can be run in parallel * **`too_few_slots`** - At least one slot must be specified in an auction * **`missing_slots`** - Missing required slots field * **`invalid_auction_id`** - Auction ID doesn't correspond to a valid auction * **`missing_promotion_type`** - Must request slots for at least one promotion type * **`invalid_promotion_type`** - Invalid promotion types in slots field * **`invalid_context`** - Invalid context. Must specify at most two of: list of products, search query, or categories (for sponsored brands: at most one) * **`invalid_placement_id`** - Placement ID must be between 1 and 8 * **`missing_slot_id`** - Missing required slot ID for banner ads * **`invalid_category`** - Only one of `id`, `ids`, or `disjunctions` must be set, where no array is longer than 5 * **`invalid_opaque_user_id`** - Opaque user ID value must be no longer than 90 characters * **`no_products`** - At least one product must be specified * **`no_products_or_category`** - Either at least one product ID or a category ID must be provided * **`too_many_products`** - Exceeded limit of products in the request * **`product_info_mismatch`** - Product info arrays must all have the same length * **`invalid_quality_score`** - Quality scores must be between 0.0 and 1.0 * **`non_positive_price`** - Product price must be positive * **`invalid_geo_targeting`** - Invalid geo targeting. Must specify either `location` or `locations` * **`too_many_locations`** - At most 2 locations can be specified * **`invalid_location_cell`** - Specified location cell is not a valid H3 cell * **`invalid_device`** - The device must be one of: `desktop` or `mobile` * **`too_many_search_query_words`** - Exceeded limit of search query words in the request * **`invalid_event_time`** - At least one event is in the future * **`invalid_resolved_bid_id`** - Invalid resolvedBidId * **`invalid_use_of_external_campaign_id`** - Cannot set both `resolvedBidId` and `externalCampaignId` * **`no_purchase_items`** - At least one item must be purchased * **`missing_purchased_at`** - Required `purchasedAt` field is missing * **`invalid_marketplace`** - No such marketplace exists * **`invalid_vendor`** - No such vendor exists * **`resource_not_found`** - The requested resource was not found * **`experiment_variant_too_long`** - Marketplace experiment variants have a maximum length of 10 characters * **`account_unique_violation`** - Request breaks ledger account unique constraint * **`invalid_ledger_account`** - Ledger account does not exist * **`insufficient_balance`** - Insufficient balance * **`different_currencies`** - Both accounts must have the same currency code * **`equal_from_and_to`** - From and to must be different * **`bad_request`** (filter operation) - The filter operation can be one of `and` or `or` * **`bad_request`** (attributes) - The number of filter attributes needs to be between 1 and 3 * **`bad_request`** (promotions) - The number of filter promotions needs to be between 1 and 3 * **`invalid_travel_category`** - Travel category must be a non-empty string if provided * **`invalid_travel_date_range`** - End date must be greater than start date * **`too_many_passengers`** - Number of passengers must be less than ten * **`invalid_traveler_type`** - Traveler type must be one of: `family`, `group`, `solo`, `couple` * **`invalid_date_format`** - Date must follow format `YYYY-MM-DD` (e.g., 2012-05-08) * **`invalid_travel_type`** - Type must be one of: `hotels`, `flights` * **`missing_variation_id`** - Missing variation ID * **`missing_flight_travel_context`** - Missing fields from flight travel context * **`internal_server_error`** - The server has encountered a problem * **`request_canceled`** - The caller canceled the request ## Common Integration Issues **Events return 200 but don't show in dashboard:** * Check `occurredAt` is within last 30 days * Verify product exists in catalog * Confirm event type spelling (`click`, not `Click`) **Auctions returning no winners:** * **Check campaign budget** (most common issue) * **Verify account balance is positive** * Confirm products are in stock and active * Verify active campaigns exist * Check bid amounts aren't too low **Attribution not working correctly:** * See our [Attribution Troubleshooting Guide](/knowledge-base/ad-platform/reporting/attribution-troubleshooting) * Check resolved bid IDs are passed correctly * Verify purchase events include proper product IDs **Connection refused or timeout:** * Test connectivity: `curl -I https://api.topsort.com` * Check firewall allows outbound HTTPS (port 443) * Whitelist `*.topsort.com` domains * Verify TLS/SSL certificate validation **Budget exhaustion is the #1 cause of empty auctions.** Before debugging complex auction issues, first check that your campaigns have sufficient daily budget and account balance. Campaigns with zero budget cannot participate in auctions. ## Detailed Validation Errors Some endpoints return detailed validation errors with field-level information: ```json theme={null} { "error": "validation_error", "message": "Invalid request body", "details": [ { "field": "events[0].productId", "message": "Product 'sku_999' not found in catalog" }, { "field": "events[0].occurredAt", "message": "Timestamp cannot be in the future" } ] } ``` Use the `details` array to identify exactly which fields have issues and what needs to be corrected. ## Rate Limiting Retry failed requests with increasing delays between attempts: ```python theme={null} def retry_with_backoff(url, max_retries=5): delay = 1 for i in range(max_retries): response = requests.get(url) if response.status_code != 429: return response time.sleep(delay) delay = min(delay * 2, 64) ``` Respect the rate limit headers in responses: * `X-RateLimit-Limit` - Total requests allowed * `X-RateLimit-Remaining` - Requests remaining * `X-RateLimit-Reset` - When limit resets Wait until `X-RateLimit-Reset` before retrying. Auctions (`/v2/auctions`) and Events (`/v2/events`) endpoints are **not rate-limited**. Rate limits apply to other endpoints like campaign management and reporting APIs. ## Connection & Network Issues ### Troubleshooting Checklist Verify you can reach Topsort's API: ```bash theme={null} curl -I https://api.topsort.com ``` Ensure outbound HTTPS (port 443) traffic is allowed and whitelist: * `api.topsort.com` * `*.topsort.com` Ensure your HTTP client supports modern TLS versions: ```bash theme={null} openssl s_client -connect api.topsort.com:443 ``` Set appropriate timeout values and implement retry logic: ```python theme={null} session = requests.Session() session.timeout = (10, 30) # (connect, read) ``` Visit [topsort.statuspage.io](https://topsort.statuspage.io) for service status ### Common Network Issues **Symptoms:** Certificate validation errors, SSL handshake failures **Solutions:** * Update your HTTP client to support modern TLS versions * Ensure your system trusts standard certificate authorities * Test with: `openssl s_client -connect api.topsort.com:443` **Symptoms:** Connection refused, requests hanging **Solutions:** * Whitelist Topsort domains (`api.topsort.com`, `*.topsort.com`) * Allow outbound HTTPS traffic on port 443 * Configure proxy settings if required by your network * Test without proxy to isolate issue **Symptoms:** Requests timing out, hanging indefinitely **Solutions:** * Increase timeout values in your HTTP client * Implement retry logic with exponential backoff * Check for large request payloads exceeding limits * Use connection pooling for better performance **Symptoms:** Issues from specific geographic regions **Solutions:** * Test from different locations to isolate regional problems * Use a CDN or proxy service if needed * Contact support with your location details ## Debugging Tools Check the **Dev Tools** tab in your Ad Platform for detailed API request/response logs. See our [Developer Logs guide](/api-reference/logs) for help interpreting log entries. Monitor service health and planned maintenance at [topsort.statuspage.io](https://topsort.statuspage.io) Subscribe to updates for real-time notifications. ## Need Help? If you're still experiencing issues after consulting this guide: * **Check status page:** [topsort.statuspage.io](https://topsort.statuspage.io) * **Contact support** with error details and API request examples * **Review API docs** for endpoint-specific requirements # [Beta] Report Link Users Source: https://docs.topsort.com/en/api-reference/events/[beta]-report-link-users /openapi.json post /v2/events/beta/link-users Use the `/events/beta/link-users` endpoint to report to Topsort linked opaque user IDs. This endpoint allows linking two opaque user IDs for attribution purposes. The `from` field represents the original opaque user ID, and the `to` field represents the target opaque user ID to be linked. The request will fail if the `from` and `to` opaque user IDs are the same. Contact your sales representative to gain access to this endpoint and start using it. # Report events Source: https://docs.topsort.com/en/api-reference/events/report-events /openapi.json post /v2/events Use the `/events` endpoint to report user interactions and activity in on a marketplace: - **Impressions** — a user viewed an asset. - **Clicks** — a user clicked on an asset. - **Purchases** — a user created an order. - **Page views** — a user visited a page. Interactions require either a `resolvedBidId`, for sponsored events coming from the `/v2/auctions` response, or an `entity` that describes the entity that was interacted with, in the case of organic or non-sponsored events. For analytics purposes, you can use the `placement` field to differentiate different listings or banners. For example, on a product page with a carousel of products, you can track impressions and clicks related to the carousel by including `/carousel` at the end of the `path` field in the `placement` object. This allows you to monitor the performance of carousel products in the [Data Room](https://docs.topsort.com/knowledge-base/analytics/data-room/). # Running auctions Source: https://docs.topsort.com/en/api-reference/examples/auctions Learn how to use the auctions API to create auctions for listings and banners. The auctions API enables you to create a wide variety of [auctions](/en/ad-server/auctions/auctions-api). Whether you want to include sponsored listings in search results or banners on your homepage, we've got you covered. ## Before you begin Before you're ready to use the auctions API, you need to: 1. [Obtain an API key](/en/api-reference/authentication#obtaining-an-api-key) to authenticate. 2. [Create several campaigns](/en/knowledge-base/ad-platform/campaign-creation/), to have bids available for the auctions. **Ensure your campaigns have sufficient budget!** The most common reason for empty auction results is budget exhaustion. Campaigns with zero remaining budget cannot participate in auctions, leading to no winners. Check your campaign budgets before testing auctions. ## Request The `/auctions` endpoint allows you to run up to 5 auctions in one request. The full spec for this endpoint [is found here](/en/api-reference/auctions/create-auctions). This can be quite a lot to take in at once, so let's stick to the basics now. Every request body should be provided as JSON and is generally structured as follows. ```json theme={null} { "auctions": [ { "type": "listings", "slots": 2 }, { "type": "banners", "slots": 1 } ] } ``` There are several interesting things about this (incomplete) snippet: * Auctions are provided as an array to the `auctions` field. You can provide 1 to 5 auctions in a single request. * Each auction has a `type` that will determine whether it's auctioning listings or banners. * Each auction has a `slots` field, this determines the maximum number of winners of the auction. To complete the above snippet you will need to add more fields, check out the [sponsored listings example](/en/api-reference/examples/sponsored-listings/set-of-products) or [sponsored banners example](/en/api-reference/examples/sponsored-banners/banners) for more information. ## Response **Do not cache this response** or it's results. Auctions need to be unique per page view, this is what makes the system work. If the auction results are cached, the same results could be shown to multiple users or to the same user multiple times. If there are no [request errors](https://topsort.mintlify.app/api-reference/errors), the auctions endpoint will return the results for each auction. A successful response does not mean that each auction succeeded or has winners. You will need to check the results to determine this. ### Response with winners Suppose that both auctions in the earlier request result in winners, the response could look something like this: ```json theme={null} { "results": [ { "winners": [ { "rank": "1", "resolvedBidId": "WyJiX01mazE1IiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0=" }, { "rank": "2", "resolvedBidId": "WyJlX1hKYm5OIiwiMTNiNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0==" } ], "error": false }, { "winners": [ { "rank": "1", "resolvedBidId": "WyJzb21lLXNsb3QiLCIxM2I1NTgyOC04ZWFkLTQyOTktODMyNy1jZWJiMDAyYTBmYTgiLCJiYW5uZXJzIiwiZGVmYXVsdCIsIiJd==" } ], "error": false } ] } ``` Things to note about this response: * Auction results are under a top level `results` property. * The order of the results corresponds to the order of the auctions. * Each result has an array of winners. This array can be empty and it will never be more than the `slots` of the auction. * It's possible for auctions to fail/succeed independently. The `error` flag indicates whether an auction succeeded. ### Empty Winners Array If `winners` is empty (`[]`), common causes include: * **Budget exhausted:** Campaigns have spent their daily/total budget * **No active campaigns:** No campaigns are targeting the auction context * **Bid too low:** Campaign bids are below auction floor prices * **Product mismatch:** Campaign products don't match auction criteria The exact fields on the winners depend on the type of the auction, but they will always have: * `rank` a 1-based number corresponding to its position in `winners`. * `resolvedBidId` identifying the bid that made this winner win. This ID is used to relate the bid to events. ### Response without winners It's not guaranteed that an auction will result in winners. If there are no active campaigns that match it's criteria, there won't be any bids to place. If our earlier auction request did not have any winners for either auction, it's response will look something like this: ```json theme={null} { "results": [ { "winners": [], "error": false }, { "winners": [], "error": false } ] } ``` Note that this response still contains results for both auctions. ## Further reading Check out the other pages in this section to see complete examples for different use cases. # Banner Attribution Source: https://docs.topsort.com/en/api-reference/examples/sponsored-banners/attribution Learn how to use the auctions API to achieve banner purchase attribution. Attributing conversions to the right campaign is vital for optimizing campaign performance and enabling data-driven decisions. Because banners can link to several kinds of targets, setting up attribution requires a bit more work compared to listings. In this example, you'll learn how to set up attribution for banners that link to products, brands, or vendors. Let's get started. # Overview In the context of banner attribution, the primary goal is to track and attribute conversions resulting from interactions with a banner and products associated with the banner you've configured in Topsort. Sometimes a user may view a banner, click on it, and then make a purchase later. In such cases, it's essential to attribute the purchase to the banner that initially caught the user's attention. ## Common Practice/Recommendation When a user views a banner within a page, any subsequent purchases of products associated with the banner by the same user should be attributed to the banner campaign. # Implementation: Attribution Methods Currently, there are **two primary methods** for attributing a purchase to a banner within the platform, depending on the type of landing page the banner redirects to: one is product detail & listing pages (PDP & PLP), and the other is vendor pages. ## 1. Product Detail & Listing Pages (PDP & PLP) This method involves sending a `resolvedBidId` along with an `additionalAttribution` object in a follow-up event linked to a specific product. The user journey follows this sequence: ### **Step 1:** **Page Loads with a Banner** * A page loads with a banner that has won a Topsort auction. * If the banner is set to charge by CPM (Cost Per Mille), a **banner impression event** should be sent to Topsort, including the `resolvedBidId` from the auction response, for billing purposes. * If the user clicks on the banner and it’s set to charge by CPC (Cost Per Click), a **banner click event** should be sent to Topsort, again using the `resolvedBidId` from the auction response, for billing purposes. ### **Step 2:** **User Click and Redirection** * Upon clicking the banner, the user is redirected to the specified landing page. * From this point, different event requirements come into play depending on the type of banner landing page: **Case 1.1. PDP (Product Detail Page)** * If the banner redirects to a Product Detail Page, a **product click event** should be reported to Topsort when the user clicks on the banner. * This event must include the `resolvedBidId` from the banner and the `additionalAttribution` object. * In this case, the `additionalAttribution` object should have: * **`id`**: Product ID of the clicked product. * **`type`**: Set as "product". * This approach ensures that any subsequent purchase of the product is attributed to the original banner. Example of a click event with the `additionalAttribution` object: ```json theme={null} { "clicks": [ { "id": "9dcb05ad-9bb4-40da-bd71-663cab413564", "resolvedBidId": "ChAGcYkXyzR3q5UEOql7QpBd...", "placement": { "path": "/home/banner-destination-page" }, "occurredAt": "2024-10-23T06:03:21.403Z", "opaqueUserId": "7205415c-179f-4f7f-9fde-3ca8e7f16bc7", "additionalAttribution": { "id": "MKJY40600", "type": "product" } } ] } ``` **Case 1.2. PLP (Product Listing Page)** * If the banner leads to a Product Listing Page, a **product click event** should be sent to Topsort only after the user clicks on one of the listed products. * This event should include both the `resolvedBidId` from the banner and an `additionalAttribution` object. * This ensures that any subsequent purchase of the clicked product is correctly attributed to the initial banner. **Case 1.3. BLP (Brand or Vendor Landing Page)** * If the banner leads to a brand or vendor page, and the goal is to attribute subsequent purchases to that brand/vendor, then **Halo attribution** should be used. See the next section for more details. ## 2. Vendor attribution When the banner redirects to a vendor landing page or if all products purchased from a vendor after seeing a banner related to it should be attributed, then we use Halo attribution. This kind of attribution indirectly links a purchase to the banner by associating the vendor or brand from the `resolvedBidId` of the original banner event. This ensures that purchases are attributed even when the conversion path is not direct. Halo attribution can work in two ways: ### **2.1. Vendor Only Attribution:** Banners can attribute all purchases of products from a specific vendor to the banner that led the user to the vendor's page. Communicate with the Topsort team to set up this attribution method at [support@topsort.com](mailto:support@topsort.com). ### **2.2. Vendor + Other Attribution:** This approach is used when not all banners redirect to vendor pages and multiple landing page types exist. The flow is the same as described in [Product Detail & Listing Pages (PDP & PLP)](#1-product-detail--listing-pages-pdp--plp), but each purchased product item must be reported with its vendor ID. Example: ```json theme={null} { "purchases": [ { "id": "06581ac9-0098-7797-b913-820b6bbbbed4", "opaqueUserId": "065e8780-d526-789c-a813-cd1a9ab08d8e", "occurredAt": "2024-10-28T07:43:54-06:00", "items": [ { "vendorId": "VEIA929919", "unitPrice": 900, "quantity": 1, "productId": "MKQUJ9191" } ] } ] } ``` # Sponsored Banners Source: https://docs.topsort.com/en/api-reference/examples/sponsored-banners/banners Learn how to use the auctions API to create auctions for listings and banners. Banner Ad Integration: 3 stages 1. **Banner Configurations**: Create and share ad slots. 2. **Auctions for Banners**: Work with auction variables, requests and responses 3. **Rendering Banners**: render and display the winning banner assets Banner ads can be used as homepage sliders, featured brands, and carousels. # **Banner Configurations** Provide a list of pages with unique identifiers for each banner slot. ## **Landing Pages**: Homepage or Custom Pages Create slots for high-traffic homepages or other landing pages. A slot includes: * **SlotID**: A **unique** identifier that can contain alphanumeric characters and the following symbols: `!"#$%&'()*+,-._/:;<>?@[]^{}~=` * **Name**: A descriptive name (e.g. Homepage Slide 1, Above Trending Products ). * **URL or Deeplink**: The URL where the slot is located. * **Landing Page name**: The slot's corresponding landing page. * Image **Width** and **Height**, if you require different sizes across devices we support 1 more set of image sizes | SlotID | Landing Page Name | URL or Deeplinks | Width | Height | Additional Width (optional) | Additional Height (optional) | | :----------- | :----------------- | :------------------------------------------------- | :---- | :----- | :-------------------------- | :--------------------------- | | top-slot-1 | Homepage Christmas | [http://example.com/home](http://example.com/home) | 100 | 50 | 40 | 40 | | right-slot-2 | Homepage Christmas | [http://example.com/home](http://example.com/home) | 50 | 200 | | | Use [this sample file](https://docs.google.com/spreadsheets/d/1KMnGnYp6D3u4kwwofm3nZ97Jgwtvys5fqEfGRmO3aVQ/edit#gid=0) to bulk upload banner configurations. ## **Category and Search** Allow vendors to target specific categories and keywords. Define banner slots and share them. Example: | SlotID | Width | Height | Alternative Width (optional) | Alternative Height (optional) | | :-------------- | :---- | :----- | :--------------------------- | :---------------------------- | | category-bottom | 100 | 50 | 40 | 40 | # **Auction Requests for Banners** Storing the resolvedBidId. The **resolvedbidId** simplifies event attribution and recording for you and your vendors, similar to **auctionID** in sponsored listings. It needs to be stored so events can be reported later, either as a cookie or session variable for web applications, or stored as an internal variable for mobile apps. ### Requests Fields | Variable | Type | Definition | Required/optional | Notes | | :---------- | :------ | :-------------------------------------------- | :---------------------------------------------------------------------------------------------- | :------------------------------------------------------- | | type | string | Type of auction | required | Must be set as "banners" | | slots | integer | Maximum number of auction winners | required | number of winners you would like the auction to return | | slotId | string | External slot ID provided by the marketplace. | required | Format: `^[\w!\"#$%&'()_+,\-._/:;<>?@\[\]^\{\}~=\\]\_$` | | categoryId | string | Marketplace's category ID for the auction. | required only if category banners | Defaults to homepage auction if no category ID provided. | | searchQuery | string | | required only if search banners \*you can pass both categoryID and searchQuery in the same call | Example "blue running shoes" | | device | string | Target device: desktop or mobile. | optional | Enum: "desktop" or "mobile." Defaults to "desktop." | ### Response Fields | Variable | Type | Definition | | --------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | resultType | string | "banners" | | winners.resolvedBidId | string | A Topsort ID to be used when this item is interacted with (for reporting impressions or clicks) | | winners.type | string | Type of the winning bid. Enum: "product", "vendor", "brand", "url". | | winners.rank | integer | The product's auction rank indicates its position, with 1 being the winner. In the auction response, the winners array is sorted, and the rank corresponds to the entry's index. | | winners.id | string | The marketplace's unique ID for the winning entity. | | winners.asset | array | | | winners.asset.url | string | URL source for a banner asset. The asset is served by Topsort's CDN, contained in asset array | # **Rendering Banners** Set the banner configurations inside the Topsort admin dashboard. Insert the banner in your web app's DOM or add a component to your mobile app code. ### **Web Apps** For web apps, use the [`picture` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture), which will let you provide multiple sources to the client browser. For example, if the asset has 2 sources: ```json theme={null} "asset": [ { "url": "https://topsort.cdnprovider.com/lhs-banner-image-for-p_PJbnN-1x.png", "mimeType": "image/png", "dimensions": { "width": 400, "height": 100, } }, { "url": "https://topsort.cdnprovider.com/lhs-banner-image-for-p_PJbnN-2x.png", "mimeType": "image/png", "dimensions": { "width": 800, "height": 200, } } ] ``` Then you may generate the following HTML: ```html theme={null} banner ``` The client's browser will then choose the most adequate size depending on the user's device capabilities and only fetch the size that best fits the user's device. ### Native iOS (Swift) We recommend using **[AlamofireImage](https://github.com/Alamofire/AlamofireImage)** to handle download and render options. You may get your client's device scaling factor by calling and pick the right size. ```swift theme={null} [UIScreen mainScreen].scale; ``` ### In Android (Java) Use Glide library to render and cache images. As with iOS, you will need to check the device's scaling factor to determine which image to download: ```java theme={null} // Get the screen's density scale final float scale = getResources().getDisplayMetrics().density; ``` # Sponsored Banners in Carousels and Swimlanes Source: https://docs.topsort.com/en/api-reference/examples/sponsored-banners/carousels Creating carousels and swimlanes with Topsort banners ## Banner Carousels and Swimlanes You can create carousels and swimlanes using Banners by requesting an auction for banners and specifying the number of banners you need for the carousel or swimlane. The banner candidates will be the banner campaigns created for the `slotId` related to the carousel or swimlane. Topsort will return the `product id` of the winners and the assets with links to creatives to be added to the carousel or swimlane. You can also create single banner slot for the carousel or swimlane, and request 3 results from the auction. For example, suppose you have a "Back to School" landing page with a carousel featuring three campaigns from different brands. When a visitor lands on this page, you'll make a request with the `slots` parameter set to 3 so that Topsort can provide at least three winners. After receiving the winners, you can add the three banner ads to the carousel. If there are fewer than three winners, you can either add a fallback image for your marketplace promotions or show only one or two banners. ## Request Here's an example auction request for a carousel with three banner slots targeting brands: ```json theme={null} { "auctions": [ { "type": "banners", "slots": 3, "slotId": "backtoschool-carousel" } ] } ``` ## Response The response will include three products you can display in the carousel, ranked by the auction results. If there are no qualifying bids (no winners) or if there was an error, the response will be empty. In this case, you can only show the organic results. A new boolean variable, **error**, indicates whether the auction was resolved successfully. Here's an example of the response for a call with one auction request using the API V2 in JSON format: ```json theme={null} { "results": [ { "winners": [ { "rank": 1, "type": "brand", "id": "p_Mfk15", "resolvedBidId": "WyJiX01mazE1IiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0", "asset": [ { "url": "https://topsort.cdnprovider.com/lhs-banner-image-for-p_PJbnN-1x.png" } ] }, { "rank": 2, "type": "brand", "id": "p_8VKDt", "resolvedBidId": "WyJlX1BKYm5OIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0", "asset": [ { "url": "https://topsort.cdnprovider.com/lhs-banner-image-for-p_Paesa2N-1x.png" } ] }, { "rank": 3, "type": "product", "id": "p_PJbnN", "resolvedBidId": "WyJlX1BKYm5OIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwiYmFubmVyQWRzIiwiZGVmYXVsdCIsIiJd", "asset": [ { "url": "https://topsort.cdnprovider.com/lhs-banner-image-for-p_PJbasnx-2x.png" } ] } ], "error": false } ] } ``` # Sponsored Banners on category pages Source: https://docs.topsort.com/en/api-reference/examples/sponsored-banners/categories Working with product categories in the Topsort ecosystem ## Banner Ads on Category Pages To display banner ads on category pages, the process is similar to that of search result pages. Instead of using the `searchQuery` field, you should use the `category` field in your auction request. There are three options for specifying the category of brands, products, or vendors participating in the auction: * Single Category * Multiple Categories * Category Disjunctions ### Request Example - Single Category Banner Receive up to 5 auction results in 1 API call ```json theme={null} { "auctions": [ { "type": "banners", "slots": 1, "slotId": "homepage", "device": "mobile", "category": { "id": "c_yogurt" } } ] } ``` ### Response Example - Category ```json theme={null} { "results": [ { "winners": [ { "rank": 1, "winnerType": "product", "winnerId": "p_PJbnN", "resolvedBidId": "WyJlX1BKYm5OIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwiYmFubmVyQWRzIiwiZGVmYXVsdCIsIiJd", "asset": [ { "url": "https://topsort.cdnprovider.com/lhs-banner-image-for-p_PJbnN-1x.png" } ] } ], "error": false } ] } ``` ### Example: Category Disjunctions Category disjunctions allow you to target multiple categories in a single auction request. You can specify multiple categories and the auction will consider ads from any of those categories. This is useful when you want to display banner ads that are relevant to various categories on a specific page. Here's an auction request with a single banner slot targeting both hiking boots and running shoes categories using category disjunctions: ```json theme={null} { "auctions": [ { "type": "banners", "slots": 1, "slotId": "categories-ribbon", "category": { "disjunctions": [["hiking_boots", "running_shoes"]] } } ] } ``` The sample response below includes all the necessary information to serve the banner ads: ```json theme={null} { "results": [ { "winners": [ { "rank": 1, "winnerType": "vendor", "winnerId": "p_PJbnN", "resolvedBidId": "WyJlX1BKYm5OIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwiYmFubmVyQWRzIiwiZGVmYXVsdCIsIiJd", "asset": [ { "url": "https://topsort.cdnprovider.com/lhs-banner-image-for-p_PJbnN-1x.png" } ] } ], "error": false } ] } ``` You can request **up to 5 auctions** in a single request. If you have multiple banner slots on your category pages, you can request auctions for them in one call. # Sponsored Banners on landing pages Source: https://docs.topsort.com/en/api-reference/examples/sponsored-banners/landing-pages Learn how to use the auctions API to create auctions specifically for landing pages High-visibility locations like the homepage and landing pages (specially crafted standalone pages for marketing purposes) are excellent choices for displaying relevant and engaging banner ads. To serve banner ads on these pages, start by configuring your banner slots. When making auction requests for landing pages, ensure that the `category` and `searchQuery` fields are left empty. Here's an example with only one banner slot on the search results page on desktop: ```json theme={null} { "auctions": [ { "type": "banners", "slots": 1, "slotId": "backtoschool_banners_top", "device": "desktop" } ] } ``` You can see a sample response with everything you need to serve the banner ads. ```json theme={null} { "results": [ { "winners": [ { "rank": 1, "winnerType": "brand", "winnerId": "p_PJbnN", "resolvedBidId": "WyJlX1BKYm5OIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwiYmFubmVyQWRzIiwiZGVmYXVsdCIsIiJd", "asset": [ { "url": "https://topsort.cdnprovider.com/lhs-banner-image-for-p_PJbnN-1x.png" } ] } ], "error": false } ] } ``` # Sponsored Banners on search pages Source: https://docs.topsort.com/en/api-reference/examples/sponsored-banners/search Learn how to use the auctions API to create auctions for search results To serve targeted banner ads on your search pages based on user queries, simply include the search query and slot ID in your auction request. Here's an example showcasing a single banner slot on a search results page for mobile devices: ```json theme={null} { "auctions": [ { "type": "banners", "slots": 1, "slotId": "search_banner_top", "device": "mobile", "searchQuery": "blue running shoes" } ] } ``` The sample response below provides all the necessary information to serve the banner ad: ```json theme={null} { "results": [ { "winners": [ { "rank": 1, "winnerType": "product", "winnerId": "p_PJbnN", "resolvedBidId": "WyJlX1BKYm5OIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwiYmFubmVyQWRzIiwiZGVmYXVsdCIsIiJd", "asset": [ { "url": "https://topsort.cdnprovider.com/lhs-banner-image-for-p_PJbnN-1x.png" } ] } ], "error": false } ] } ``` winnerType can be "product", "brand", "vendor", or "url" based on the target of the winning banner ads campaign. # Sponsored brands Source: https://docs.topsort.com/en/api-reference/examples/sponsored-brands Learn how to use the Sponsored Brands auctions API to create auctions for brand promotions. The Sponsored Brands Auctions API allows you to run auctions to promote brands using assets, text, and associated products. ## Before You Begin To use the Sponsored Brand Auctions API, ensure you have completed the following: 1. [Obtain an API key](/en/api-reference/authentication#obtaining-an-api-key) for authentication. 2. [Create several campaigns](/en/knowledge-base/ad-platform/campaign-creation/), to have bids available for the auctions. ## Request The `/auctions/sponsored-brand` endpoint allows you to run auctions for sponsored brand placements. For the full specification of this endpoint, refer to the [API documentation](/en/api-reference/auctions/create-sponsored-brand-auctions). ### Example Request ```json theme={null} { "auctions": [ { "winners": 2, "placementId": "some-placement", "triggers": { "products": { "ids": ["1", "8"] } } } ] } ``` ### Example Request with Geolocation Targeting ```json theme={null} { "auctions": [ { "winners": 2, "placementId": "some-placement", "triggers": { "searchQuery": "electronics" }, "geoTargeting": "new-york", "opaqueUserId": "user-123" } ] } ``` ### Example Request with Attributes Filter ```json theme={null} { "auctions": [ { "winners": 2, "placementId": "some-placement", "triggers": { "searchQuery": "running shoes" }, "filter": { "operator": "or", "attributes": ["brand:nike", "category:66e895c424dd8e36c1318b0c"] }, "opaqueUserId": "user-123" } ] } ``` The `filter` field narrows the auction to ads whose attributes match the given `key:value` pairs. Use `operator: "or"` to keep ads matching **any** of the attributes (broader match), or `operator: "and"` to keep only ads matching **all** of them (stricter match). Ads that don't match are excluded before ranking, so filtered-out bids never win or get charged. This feature requires additional integration and configuration — contact your Topsort representative to enable it. #### Key Fields: * **`auctions`**: An array containing auction objects. * **`winners`**: The maximum number of winners for the auction. * **`placementId`**: The ID of the placement where the ad will appear. * **`triggers`**: Targeting criteria including: * **`products.ids`**: An array of product IDs associated with the auction. * **`searchQuery`**: Search terms for keyword-based targeting. * **`category.id`**: Product category for broader targeting. * **`geoTargeting`**: *(Optional)* Geographic location identifier for location-based campaign filtering. * **`opaqueUserId`**: *(Optional)* Anonymous user identifier for personalization and enhanced targeting. * **`filter`**: *(Optional)* Restricts the auction to ads whose attributes match the given `key:value` pairs. * **`operator`**: `or` (match any attribute) or `and` (match all attributes). * **`attributes`**: Up to 5 `key:value` strings. Both the key and value are limited to 40 characters each. *** ## Response **Do not cache this response** or its results. Auctions must remain unique per page view to ensure proper operation. Caching may result in repeated results for multiple users or sessions. If no [request errors](https://topsort.mintlify.app/api-reference/errors) occur, the endpoint returns the results of the auction. ### Response With Winners Example response when winners are found: ```json theme={null} { "results": [ { "winners": [ { "rank": 1, "resolvedBidId": "ChAGc-G66Wt7LKQEOcW8VBdIEhABjz_zDXx7db-ZYpxiwJ3DGhABjr4Lt_J0_a7Xv_uIfyOXIgUKATEQATDrrg8", "productId": "1", "title": "Brand Example Promo 1", "assets": [ { "url": "https://assets.hosted.topsort.com/5bcccb92e5eaaa73ce9fcc545e944865bf70e9b60e5a048979769282450343c4/example-banner-1.png", "role": "image", "contentType": "image/png", "contentLength": 33902, "width": 920, "height": 920 }, { "url": "https://assets.hosted.topsort.com/c27c9cd94badc90fb50827e144dfacb2f51a601560905b950f525cec725ea85f/example-logo-1.png", "role": "logo", "contentType": "image/png", "contentLength": 80648, "width": 264, "height": 264 } ], "campaignId": "018f3ff3-0d7c-7b75-bf99-629c62c09dc3" }, { "rank": 2, "resolvedBidId": "ChAGc-G66Wt7LKQEOcW8VBdIEhABk0pue7N5wYmzE04uO_iOGhABjr4Lt_J0_a7Xv_uIfyOXIgUKATgQATDrrg8", "productId": "8", "title": "Brand Example Promo 2", "assets": [ { "url": "https://assets.hosted.topsort.com/c049a46d834ab071cdde63e401d4efcd554e1a124f05c4ba9b3743fed2d43c4b/example-banner-2.jpeg", "role": "image", "contentType": "image/jpeg", "contentLength": 4505, "width": 403, "height": 125 }, { "url": "https://assets.hosted.topsort.com/db41a8b8b22c5ed9091f9f154b552b6bc1d1dbeb85059190f1c3b202977938f1/example-logo-2.png", "role": "logo", "contentType": "image/png", "contentLength": 34747, "width": 140, "height": 160 } ], "campaignId": "01934a6e-7bb3-79c1-89b3-134e2e3bf88e" } ], "error": false } ] } ``` ### Response With No Winners Example response when no winners are found: ```json theme={null} { "results": [ { "winners": [], "error": false } ] } ``` *** ## **Further Reading** For additional examples and use cases: * [Create Sponsored Listings Auctions](/en/api-reference/examples/sponsored-listings) * [Create Sponsored Banner Auctions](/en/api-reference/examples/sponsored-banners) *** # Sponsored listings on category pages Source: https://docs.topsort.com/en/api-reference/examples/sponsored-listings/categories The examples on this page show how to run [auctions](/en/ad-server/auctions/auctions-api) for products belonging to specific [categories](/en/ad-server/catalog/product-feed). Only bids that target products belonging to the given categories will have a chance to win these auctions. Bids targeting products that belong to other categories will not participate. ## Use cases Running these kind of auctions on search pages will allow your vendors to promote products on category pages. **Non traditional categories:** Our catalog system does not make any assumption about what a category **is**. If your marketplace deals with vacation homes for example, categories could be geographic locations instead of product groups. ## Specifying categories The `/auctions` endpoint supports several ways to specify categories. When you create an auction, you must pick **one** of the following methods: | Method | Relevant field | Description | | :-------------- | :---------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- | | Single category | `category.id` | Bid targets must belong to the category. The `id` of category is the same value used when [upsert product](/en/api-reference/catalog-api/upsert-products). | | All categories | `category.ids` | Bid targets must belong to **all** of the categories. | | Disjunctions | `category.disjunctions` | Bid targets must belong to at least **one of** the categories of the disjunction. | Let's look at some examples. ## Example API calls ### Request: Single category ```json theme={null} { "auctions": [ { "type": "listings", "slots": 2, "category": { "id": "laptop_bags" } } ] } ``` The request above will create a single listings auction that: * Has a maximum of two winners due to the `slots` field. * Only allows bids that target products in a single category. The category ID is specified in the `category.id` field. In this case, only bids that target products in the `laptop_bags` category can take part in the auction. ### Request: All categories ```json theme={null} { "auctions": [ { "type": "listings", "slots": 2, "category": { "ids": ["summer_hats", "sale"] } } ] } ``` The request above will create a single listings auction that: * Has a maximum of two winners due to the `slots` field. * Only allows bids that target products that belong to **all categories**. The category IDs are specified in the `category.ids` field. This field is plural. It's called `ids`, not `id`. Only bids that target products that belong to both the `summer_hats` and the `sale` categories can take part in this auction. ### Request: Disjunctions ("at least one category") ```json theme={null} { "auctions": [ { "type": "listings", "slots": 2, "category": { "disjunctions": [["large", "medium"]] } } ] } ``` The request above will create a single listings auction that: * Has a maximum of two winners due to the `slots` field. * Only allows bids that target products that belong to **one of the categories for the disjunction**. The disjunctions are specified as string arrays in the `category.disjunctions` field. Only bids that target products that are in `large` or `medium` categories can participate in this auction. ### Response **Do not cache this response** or its results. Auctions need to be unique per page view, this is what makes the system work. If the auction results are cached, the same results could be shown to multiple users or to the same user multiple times. If the bids targeting products in the appropriate categories exist, a response to any of the above requests could look something like this: ```json theme={null} { "results": [ { "winners": [ { "rank": 1, "type": "product", "id": "p_Mfk15", "resolvedBidId": "WyJiX01mazE1IiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0=" }, { "rank": 2, "type": "product", "id": "p_PJbnN", "resolvedBidId": "WyJlX1BKYm5OIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0=" } ], "error": false } ] } ``` Notable here: * The type of the winners is `product`, because we're running a listings auction. * There are two winners, the maximum that is allowed by the `slots` field in the request. ## Next steps The winners will need to be combined with product data to a create a result that can be shown to the end-user. Check [this page](/en/api-reference/examples/sponsored-listings/combining-results) for an example. # Combining winners and organic results Source: https://docs.topsort.com/en/api-reference/examples/sponsored-listings/combining-results How to combine auction winners and organic listings After running a listing [auction](/en/ad-server/auctions/auctions-api), you will often want to combine the winners with organic results. For example, suppose you're building a category section of a webshop that will also show a number of sponsored products. You will need a way to "inject" your auction winners into the regular category results. This page shows the steps involved in building such a category section, but similar considerations apply to other pages or widgets. ## Scenario The category section needs to support pagination and show 3 products per page. If possible, the first product on each page will be a sponsored product. The products on this category page have the following structure: ```json theme={null} { "id": "sku-367", "categoryId": "Shoes", "name": "Running shoes", "image": "photo_123.jpg", "description": "Beautiful and fast running shoes", "resolvedBidId": null } ``` The `resolvedBidId` is `null` when the product is not promoted and contain a string ID when it is. Our goal is to have the pseudo code in place for an endpoint that could create lists of such products. ## 1. Query your organic results The first step will be to query your organic results. The products that should be displayed for a specific page and category. The code to do this could look like this: ```js theme={null} const pageSize = 3; let products = queryProductsInCategory(pageSize, cursor, categoryId); console.log(products); ``` Let's say we were to run this code for the first page of the `Shoes` category, and there's 3 or more products available in this category. This code would then output something similar to this: ```json theme={null} [ { "id": "sku-367", "categoryId": "Shoes", "name": "Running shoes", "image": "photo_123.jpg", "description": "Beautiful and fast running shoes" }, { "id": "sku-897", "categoryId": "Shoes", "name": "Slippers", "image": "slippers.jpg", "description": "A pair of comfortable slippers" }, { "id": "sku-343", "categoryId": "Shoes", "name": "Dress shoes", "image": "dress_shoe_original.jpg", "description": "Elegant dress shoes for formal events" } ] ``` Note that these products don't have the `resolvedBidId` field yet, let's add it. ```js theme={null} const pageSize = 3; let products = queryProductsInCategory(pageSize, cursor, categoryId); products.forEach((prod) => { prod.resolvedBidId = null; }); ``` Now, we do need to consider what happens if there are **no organic results** for this page and category. We probably want to return a 404 error and not run any auctions. This gives us the following code: ```js theme={null} const pageSize = 3; let products = queryProductsInCategory(pageSize, cursor, categoryId); if (products.length === 0) { throw new NotFoundError("no products found"); } products.forEach((prod) => { prod.resolvedBidId = null; }); ``` With this error handling in place, we're ready to run an auction. ## 2. Running an auction In our scenario we want to run an auction for a single slot: ```js theme={null} // skip earlier code... const slots = 1; const winners = runAuctionForCategory(slots, categoryId); console.log(winners); ``` **Not sure how run an auction for a category?** Check out [these examples](/en/api-reference/examples/sponsored-listings/categories). If there are winners, the output of the above code would look something like this: ```json theme={null} [ { "rank": 1, "type": "product", "id": "sku-444", "resolvedBidId": "WyJiX01mazE1IiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0=" } ] ``` If you look at the winners, you will see that they contain no product data, just a bunch of ID's. We will need to query the product data for these winners. Also, it's possible for there to be no winners. It could simply be that there are no suitable active campaigns for this auction, but there are many other potential reasons. Regardless, we need to account for this case and we'll simply return the organic results available in `products`. ```js theme={null} // skip earlier code... const slots = 1; const winners = runAuctionForCategory(slots, categoryId); if (winners.length === 0) { return products; } ``` ## 3. Query product data for winners Now, when there **are winners**. We need to query the product data for them. ```js theme={null} // skip earlier code... const ids = winners.map((x) => x.id); const promoProducts = queryProductsByIds(ids); console.log(promoProducts); ``` Following through on our earlier examples, this could log something like: ```json theme={null} [ { "id": "sku-444", "categoryId": "Shoes", "name": "Wooden clogs", "image": "clogs.jpg", "description": "Original wooden clogs." } ] ``` Again, we need to add the `resolvedBidId` to complete this data. But, this time we shouldn't set it to `null`, because we're now dealing with promoted products. If we assume `queryProductsByIds` will return products in the same order as the provided `ids`, we can add the bid IDs as follows: ```js theme={null} // skip earlier code... const ids = winners.map((x) => x.id); const promoProducts = queryProductsByIds(ids); promoProducts.forEach((prod, i) => { prod.resolvedBidId = winners[i].resolvedBidId; }); ``` **Why is this bid ID necessary?** The bid ID is vital to enable Topsort to attribute [events](/en/ad-server/events/events-api) to bids and campaigns. Now all that remains is to merge our promoted products with the organic results. ## 4. Merging We want to show the promoted products at the start of the list. To achieve, we will need to prepend the `promoProducts` to the `products`. However, this can then make `products` have more elements than our intended page size of 3. So we need to slice it to remain in this page size. ```js theme={null} // skip earlier code... products.unshift(...promoProducts); return products.slice(0, pageSize); ``` Now our code returns a maximum of 3 products, of which the first product can be a sponsored product. ## Full code ```js theme={null} // query for organic products. const pageSize = 3; let products = queryProductsInCategory(pageSize, cursor, categoryId); if (products.length === 0) { throw new NotFoundError("no products found"); } products.forEach((prod) => { prod.resolvedBidId = null; }); // run an auction. const slots = 1; const winners = runAuctionForCategory(slots, categoryId); if (winners.length === 0) { return products; } // query product data for winners. const ids = winners.map((x) => x.id); const promoProducts = queryProductsByIds(ids); promoProducts.forEach((prod, i) => { prod.resolvedBidId = winners[i].resolvedBidId; }); // merge results. products.unshift(...promoProducts); return products.slice(0, pageSize); ``` # Sponsored listings in search results Source: https://docs.topsort.com/en/api-reference/examples/sponsored-listings/search Learn how to use sponsored listings on search results The example on this page shows how to run [auctions](/en/ad-server/auctions/auctions-api) for products originating from search results. There are two ways to run these type of auctions: * Using the `searchQuery` parameter, where only bids that target products with matching keywords will have a chance to win such auctions. * Using a [set of products](/en/api-reference/examples/sponsored-listings/set-of-products) and additionaly use the `searchQuery` parameter to expand the list of bids by adding products with matching keywords to the ones in the set of products. ## Use cases Running these kind of auctions on search pages will allow your vendors to promote products inside the search results. ## Example API call ### Request: using `searchQuery` ```json theme={null} { "auctions": [ { "type": "listings", "slots": 2, "searchQuery": "Running shoes" } ] } ``` The request above will create a single listings auction: * It will have a maximum of two winners due to the `slots` field. * The `searchQuery` field determines what keywords bid targets must have. Only bids that target products with the `Running shoes` keyword can take part in this auction. ### Response ```json theme={null} { "results": [ { "winners": [ { "rank": 1, "type": "product", "id": "p_Mfk15", "resolvedBidId": "WyJiX01mazE1IiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0=" }, { "rank": 2, "type": "product", "id": "p_PJbnN", "resolvedBidId": "WyJlX1BKYm5OIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0=" } ], "error": false } ] } ``` Notable here: * The type of the winners is `product`, because we're running a listings auction. * There are two winners, the maximum that is allowed by the `slots` field in the request. ### Request: combining products and `searchQuery` ```json theme={null} { "auctions": [ { "type": "listings", "slots": 2, "products": { "ids": [ "p_ojng4", "p_8VKDt", "p_Mfk15" ] } "searchQuery": "Running shoes" } ] } ``` The request above will create a single listings auction: * It will have a maximum of two winners due to the `slots` field. * The `searchQuery` field determines what keywords bid targets must have. Products entering this auctions will be `"p_ojng4"`, `"p_8VKDt"`, `"p_Mfk15"` and those with a keyword matching the `searchQuery`. ### Response ```json theme={null} { "results": [ { "winners": [ { "rank": 1, "type": "product", "id": "p_Mfk15", "resolvedBidId": "WyJiX01mazE1IiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0=" }, { "rank": 2, "type": "product", "id": "p_PJbnN", "resolvedBidId": "WyJlX1BKYm5OIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0=" } ], "error": false } ] } ``` Notable comments: * The type of the winners is `product`, because we're running a listings auction. * There are two winners, the maximum that is allowed by the `slots` field in the request. * The winner in rank 1 `"p_Mfk15"` comes from the set of product and rank 2 `"p_PJbnN"` comes from matching keywords since its `id` was not specified in the auction request. Running auctions using the `searchQuery` parameter enhances Topsort to improve the Keywords Matching algorithm. Using this type of auctions does not allow to use **quality scores**. ## Next steps The winners will need to be combined with product data to a create a result that can be shown to the end-user. Check [this page](/en/api-reference/examples/sponsored-listings/combining-results) for an example. # Sponsored listings from a set of products Source: https://docs.topsort.com/en/api-reference/examples/sponsored-listings/set-of-products How to run an auction for a set of products In this example we will use the API to run an [auction](/en/ad-server/auctions/auctions-api) for a set of [products](/en/ad-server/catalog/). Only bids that target the products in this set will have a chance to win this auction. Bids that target other products will not participate. **This allows you full control over which products get shown where**, while still enabling your vendors to promote products. ## Use cases We don't prescribe how you create your set of products, you can use any algorithm you desire. All we need is a list of product IDs. For example, use your own algorithm to generate: * Cross-sells. * Related products. * Checkout upsells. Collect the resulting IDs and pass them to an auction. Your vendors will then be able to bid for opportunities to appear in valuable positions in the marketplace. ## Example API call ### Request Let's assume we use some kind of algorithm to create a set of product IDs. We can then pass them to an auction request: ```json theme={null} { "auctions": [ { "type": "listings", "slots": 2, "products": { "ids": ["p_PJbnN", "p_ojng4", "p_8VKDt", "p_Mfk15"] } } ] } ``` The request above will create a single listings auction: * It will have a maximum of two winners due to the `slots` field. * The `products.ids` is the set of products. These need to exist in [your catalog](/en/ad-server/catalog/). As said before, only bids that target these products will participate in the auction. The auction endpoint supports up to 10000 product IDs per auction, but we recommend sending no more than the 500 most relevant. ### Adding custom quality scores You may sometimes want to incorporate custom quality scores for each product. The quality score is a number between 0 and 1 that encodes the relevance of the participating products. The use of quality scores helps mitigate risks and losses due to non-relevant products winning auctions. To include custom quality scores in the request, modify the `products` field as shown below: ```json theme={null} { "auctions": [ { "type": "listings", "slots": 2, "products": { "ids": ["p_PJbnN", "p_ojng4", "p_8VKDt", "p_Mfk15"], "qualityScores": [0.5, 0.4, 0.7, 0.6] } } ] } ``` In this example: * Product `p_PJbnN` has a quality score of `0.5`. * Product `p_ojng4` has a quality score of `0.4`. * Product `p_8VKDt` has a quality score of `0.7`. * Product `p_Mfk15` has a quality score of `0.6`. **Important**: The number of quality scores must match the number product IDs. If they do not match, the request will fail. **Caveat**: You cannot include quality scores and a search query. While running an auction with a search query and a set of products is allowed, the request cannot include custom quality scores. ### Response **Do not cache this response** or its results. Auctions need to be unique per page view, this is what makes the system work. If the auction results are cached, the same results could be shown to multiple users or to the same user multiple times. If bids targeting the products exist, they could win this auction. The resulting response would look something like this: ```json theme={null} { "results": [ { "winners": [ { "rank": 1, "type": "product", "id": "p_Mfk15", "resolvedBidId": "WyJiX01mazE1IiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0=" }, { "rank": 2, "type": "product", "id": "p_PJbnN", "resolvedBidId": "WyJlX1BKYm5OIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0=" } ], "error": false } ] } ``` Notable here: * The type of the winners is `product`, because we're running a listings auction. * Both winning `id` correspond to a product ID in the request. * There are two winners, the maximum that is allowed by the `slots` field in the request. ## Next steps The winners will need to be combined with product data to create a result that can be shown to the end-user. Check [this page](/en/api-reference/examples/sponsored-listings/combining-results) for an example. # Webhook event & payloads Source: https://docs.topsort.com/en/api-reference/examples/webhooks/event-payloads Learn about the event and payload specifications for webhooks. ## Example event response Below is an example of a webhook event response for a campaign update. Common fields for all events are: * `channel`: The type of the event that occurred * `timestamp`: When the event occurred * `id`: Unique id for the event which can be used for deduplication * `payload`: The payload contains the details of the event and will vary depending on the event, which is covered in detail below ```json theme={null} { "channel": "campaign:update", "timestamp": "2024-10-31T14:42:55.759185Z", "id": "gUo", "payload": { "name": "My campaign", "campaign_id": "edac69a3-3ca2-41d6-af9e-08d3126099b4" } } ``` ## Campaign creation Triggered when a campaign is created. To see the full specification of the payload, see the [Campaign Create](/en/api-reference/campaign-api/create-campaign) API response. ```json theme={null} { "channel": "campaign:create", "timestamp": "2024-10-31T14:42:55.759185Z", "id": "gUo", "payload": { "name": "My campaign", "campaign_id": "edac69a3-3ca2-41d6-af9e-08d3126099b4" } } ``` ## Campaign update Triggered when a campaign is updated. To see the full specification of the payload, see the [Campaign Update](/en/api-reference/campaign-api/update-campaign-by-id) API response. ```json theme={null} { "channel": "campaign:update", "timestamp": "2024-10-31T14:42:55.759185Z", "id": "gUo", "payload": { "name": "My new campaign name", "campaign_id": "edac69a3-3ca2-41d6-af9e-08d3126099b4" } } ``` ## Campaign deletion Triggered when a campaign is deleted. ```json theme={null} { "channel": "campaign:delete", "timestamp": "2024-10-31T14:42:55.759185Z", "id": "gUo", "payload": { "name": "My campaign", "ad_format": "listing", "vendor_id": "2355d342-222e-4dc9-af92-81c3865b3b66", "campaign_id": "edac69a3-3ca2-41d6-af9e-08d3126099b4", "campaign_type": "autobidding", "marketplace_id": "ad666c53-b174-497a-b52f-77354947456c" } } ``` # Using webhooks Source: https://docs.topsort.com/en/api-reference/examples/webhooks/usage Learn how to create and use webhooks. # Overview You can create webhooks to receive notifications when certain events occur in your account. For example, you can create webhooks to receive notifications when a campaign is created, updated, or deleted. To receive notifications, you need to specify the URL where the notifications will be sent. When an event occurs, your URL will receive an HTTP POST request with the details of the event. Your URL: * Must be publicly accessible * Must be able to receive POST requests * Must return a 2xx HTTP status code for successful requests To create a webhook, you need to call the [Create Webhook](/en/api-reference/webhooks-api/create-webhook) API. You can specify the event that will trigger the webhook by using the `channel` field. You can only create one webhook per channel. # Retries If your webhook URL is unreachable at the time of the event, we will retry sending the request up to 5 times with exponential backoff within the next 1 minute. We will only retry the request for 5xx or 429 HTTP status code. # Validation To ensure that your server only processes webhook deliveries that were sent by Topsort and that the delivery was not tampered with, you should validate the webhook signature before processing the delivery further. Topsort will use your webhook secret and the event payload to generate a signature and include it in the `X-TS-Signature-256` HTTP header for every delivery. You can specify your webhook secret when creating a webhook. If you don't specify a secret, we will generate one for you. You should store your secret safely on your server. Topsort uses HMAC hex digest to compute the hash of the signature. The signature will always start with `sha256=`. You should verify that the signature is correct by recomputing the hash on your side and comparing it to the signature in the `X-TS-Signature-256` header. ## Example signature verification ```python theme={null} import hmac import hashlib secret = "my-webhook-secret" request = ... # incoming request from the webhook delivery signature = hmac.new( key=secret.encode(), msg=await request.body(), digestmod=hashlib.sha256, ).hexdigest() expected_signature = "sha256=" + signature incoming_signature = request.headers["X-TS-Signature-256"] if not hmac.compare_digest(incoming_signature, expected_signature): # The signature is not valid, do not process the delivery else: # The signature is valid, process the delivery ``` # Introduction Source: https://docs.topsort.com/en/api-reference/introduction This reference is generated from the Topsort [openapi specification](#openapi-specification) and includes quite a few operations. However, only two are required for a typical integration. ## A typical integration Provide your catalog via a product feed. (Have vendors create campaigns). Run auctions [via the API](/en/api-reference/auctions/create-auctions) or using our clients. The details will depend on your marketplace and needs. A selection of examples is available [here](/en/api-reference/examples/auctions). Use one of the analytics libraries to report events. ## Available API's Typical integrations will use these APIs: * **Auctions:** Runs auctions in your marketplace. * **Events:** Collects data on auction results. For advanced integrations you might want to look at: * **Audiences:** Manage audiences. * **Campaigns:** Manage campaigns. * **Catalog:** Manage products, categories and vendors. * **Billing:** Manage vendor balances. * **Reporting:** Read reports on marketplace, campaign or product performance. * **Invitations:** Invite vendors to your marketplace. ## URLs and redirects To minimize the impact of auctions on your app's performance, there is no redirect from URLs with a trailing slash (`/`). This is to avoid an extra round trip before auction winners are returned. For example, when you want to run an auction, use `/v2/auctions`, not `/v2/auctions/`. Using an URL with a trailing slash will result in a `404 Not Found` error. ## API Status You can monitor and check API Status [here](https://topsort.statuspage.io/). ## Rate Limits Topsort enforces rate limits on some of the endpoints to ensure that the quality of service is maintained for all users. The rate limits are different for the production and sandbox environments and are as follows: | Environment | Endpoint | Rate Limit | | ----------- | ------------------- | --------------------------- | | Sandbox | Catalog API | 4 rps | | Sandbox | Other Advanced APIs | 5 requests every 2 seconds | | Sandbox | Auctions and Events | 10,000 rps (default) | | Production | Catalog API | 10 rps | | Production | Other Advanced APIs | 45 requests every 2 seconds | | Production | Auctions and Events | 10,000 rps (default) | The default rate limit for Auctions and Events endpoints is 10,000 requests per second. This limit can be increased based on your specific traffic requirements. Contact your Topsort representative to discuss higher limits for your integration. ### Rate limit headers Use these headers to navigate rate limits and when you can make another request: * `X-RateLimit-Limit` - total number of requests allowed for the time period * `X-RateLimit-Remaining` - remaining number of requests for the time period * `X-RateLimit-Reset` - when you can make another request ### How to handle rate limits When you exceed the rate limit, you will receive a `429 Too Many Requests` response. To handle this, you can implement a retry mechanism with an exponential backoff strategy. This will help you to avoid hitting the rate limit again. Here is an example of how you can implement this in Typescript: ```typescript theme={null} /** * Wraps `fetch()` with a retry function that respects retry limits from the API * * @param {string|URL} url * @param {RequestInit} request * @param {number} retries = 1 * @returns {Promise} */ async function fetchWithRetry(url, request, retries = 1) { const response = await fetch(url, request); if (!response.ok) { if (response.status === 429) { // Handle rate limit const s = response.headers.get("X-RateLimit-Reset"); await new Promise((resolve) => setTimeout(resolve, s * 1000)); return fetchWithRetry(url, request, retries + 1); } throw new Error( `Failed to upload: ${response.status} ${await response.text()}` ); } } ``` ## OpenAPI Specification The OpenAPI specification is available as a JSON file [here](/openapi.json). # Developer Logs Source: https://docs.topsort.com/en/api-reference/logs Access and interpret API logs in the Topsort admin platform ## Where to Find Logs Navigate to **Dev Tools** tab in your Topsort Ad Platform to access real-time logs for your API key. ## Log Availability | Environment | What's Logged | Retention | | -------------- | ------------------------------- | --------- | | **Staging** | All API requests and responses | 30 days | | **Production** | Errors and failed requests only | 30 days | As your production API usage scales up, successful requests may be filtered from logs to improve performance. Errors and debugging information will always be available. ## Understanding Log Entries ### Successful Requests Schema validator notification screenshot Successful API calls show: * **Status:** HTTP 200/201/204 status codes * **Timestamp:** When the request was made * **Endpoint:** Which API endpoint was called * **Response time:** How long the request took * **Request size:** Size of request/response data ### Error Entries Schema validator error screenshot Failed requests include additional debugging information: * **Status:** HTTP error code (400, 401, 403, etc.) * **Error details:** Specific error code and message * **Request body:** What data was sent (for debugging) * **Stack trace:** Internal error details (when available) ## Common Log Patterns ### Authentication Issues ``` 401 Unauthorized - invalid_api_key Missing Authorization header ``` **Solution:** Add `Authorization: Bearer YOUR_API_KEY` header ### Validation Errors ``` 422 Unprocessable Entity - invalid_product_id Product 'sku_123' not found in catalog ``` **Solution:** Verify product exists and is spelled correctly ### Rate Limiting ``` 429 Too Many Requests - rate_limited X-RateLimit-Remaining: 0 ``` **Solution:** Implement exponential backoff retry logic ## Using Logs for Debugging ### 1. Events Not Appearing in Dashboard Look for: * **200 status** on `/events` calls * **Validation errors** in event payload * **Timestamp issues** (`occurredAt` in future or too old) ### 2. Empty Auction Results Check: * Campaign budget status * Product availability in catalog * Auction request format ### 3. Attribution Problems Review event logs for: * Consistent user ID usage * Proper `resolvedBidId` from auctions * Timing of click/purchase events ## Best Practices ### Log Monitoring * Check logs after deploying new integration code * Monitor error rates during high-traffic periods * Set up alerts for recurring error patterns ### Troubleshooting Workflow 1. **Reproduce the issue** in staging environment 2. **Check recent logs** for error patterns 3. **Verify request format** against [API documentation](/api-reference) 4. **Test with minimal payload** to isolate the problem 5. **Contact support** with log timestamps for complex issues ## Privacy and Data Handling * Logs may contain sensitive data from your requests * Production logs automatically expire after 30 days * Access to logs is restricted to admin users only * Personal data in logs follows standard data retention policies ## Need Help? If you're seeing persistent errors in your logs: 1. **Note the timestamp** of problematic requests 2. **Copy the exact error message** and request details 3. **Contact support** with this information for faster resolution Our team can access detailed server-side logs to help diagnose complex integration issues. # [BETA] Account Activity Reports. Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-account-activity-reports /openapi.json get /public/v1/toppie/reporting/account-activity Retrieve account activity reports. # [BETA] Create Toppie Campaign Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-create-toppie-campaign /openapi.json post /public/v1/toppie/campaigns Create a new agency campaign with the provided details. # [BETA] Delete Toppie Campaign Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-delete-toppie-campaign /openapi.json delete /public/v1/toppie/campaigns/{campaign-id} Delete an agency campaign. # [BETA] Get Agency Account Report. Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-get-agency-account-report /openapi.json get /public/v1/toppie/reporting Retrieve a general report for an account. # [BETA] Get Campaign Products Report. Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-get-campaign-products-report /openapi.json get /public/v1/toppie/reporting/campaigns/{campaign-id}/products Retrieve a product-level report for a specific campaign. # [BETA] Get Campaign Report. Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-get-campaign-report /openapi.json get /public/v1/toppie/reporting/campaigns/{campaign-id} Retrieve a detailed report for a specific campaign. # [BETA] Get Campaigns Reporting. Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-get-campaigns-reporting /openapi.json get /public/v1/toppie/reporting/campaigns Retrieve a list of campaigns and their reports. # [BETA] Get Toppie Campaign Bids Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-get-toppie-campaign-bids /openapi.json get /public/v1/toppie/campaigns/{campaign-id}/bids Retrieve bidding data for a specific campaign. # [BETA] Get Toppie Campaign Details Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-get-toppie-campaign-details /openapi.json get /public/v1/toppie/campaigns/{campaign-id} Retrieve configuration details for a specific campaign. # [BETA] Get Toppie Campaigns Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-get-toppie-campaigns /openapi.json get /public/v1/toppie/campaigns Retrieve a list of campaigns associated with a specific account. # [BETA] List Account Products Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-list-account-products /openapi.json get /public/v1/toppie/products Retrieve a list of products associated with a specific account. # [BETA] Update Toppie Campaign Source: https://docs.topsort.com/en/api-reference/toppie-api/[beta]-update-toppie-campaign /openapi.json patch /public/v1/toppie/campaigns/{campaign-id} Update an agency campaign with the provided details. # Get Agency Daily Kpis By Product Dump Urls Source: https://docs.topsort.com/en/api-reference/toppie-api/get-agency-daily-kpis-by-product-dump-urls /openapi.json get /public/v1/toppie/reporting/file-reports/daily-kpis-by-product Retrieve pre-signed S3 URLs for daily product-wise KPI files. This endpoint provides a list of Amazon S3 pre-signed URLs, allowing access to product-wise daily KPIs for Toppie. The data is provided in Parquet file format. Files become available daily after **3 AM UTC** and contain KPI data for the **previous day**. # [Beta] Add Quality Score Source: https://docs.topsort.com/en/api-reference/toptimize/[beta]-add-quality-score /openapi.json post /toptimize/v1/predictions Use the `/predictions` endpoint to get contextual predictions of conversion and relevance metrics, which are personalized by user and context.In order to provide predictions, Topsort requires that events are also sent, as a source of information. # [Beta] Rank objects Source: https://docs.topsort.com/en/api-reference/toptimize/[beta]-rank-objects /openapi.json post /toptimize/v1/rank > ⚠️ **Beta Access Required** > Contact your sales representative to gain access to this endpoint and start using it. Use the `/ranking` endpoint to re-rank objects to show on a page. This endpoint can retrieve sponsored and non-sonsored objects and rank them together, according to an appropriate context and behavior information. # [Beta] Retrieve objects Source: https://docs.topsort.com/en/api-reference/toptimize/[beta]-retrieve-objects /openapi.json post /toptimize/v1/retrieval > ⚠️ **Beta Access Required** > Contact your sales representative to gain access to this endpoint and start using it. Use the `/retrieval` endpoint to get recommendations of which products are relevant given a certain context. Context is provided by user information, plus seed products. This can be used to retrieve object to display on a PDP (single seed product) or in a cart (multiple seed products). In order to provide retrieval, Topsort requires that events are also sent, as a source of information. # Banners.js Source: https://docs.topsort.com/en/ad-platform/banners/bannersjs Learn how to integrate Topsort with Banners.js Topsort's [banner.js public library](https://github.com/Topsort/banners.js/) allows marketplaces display banner ads through a low-code integration. By using a simple HTML tag, the marketplace can connect to Topsort's ad server and render banners from active campaigns without complex integrations. ## Installation You can install the library using npm or yarn, or load the SDK directly in your HTML file by including a ` ``` ## Usage This example shows a minimal setup required to do it. The integration works with standard HTML and Javascript, making it compatible with most frontend stacks. To test it, you just need to add your Marketplace API Key and the banner slot id, configured in the campaign. ```html theme={null} ``` ## Banner Attributes These are the attributes available for the `` component. They serve as input to the auction request, to fetch the right winners for that context. | Name | Type | Description | | ----------------------- | ------ | ------------------------------------------------------- | | width | number | Banner width | | height | number | Banner height | | id | string | The slot ID for this banner, configured at the campaign | | Category-id (optional) | string | Contextual category for targeting | | Search-query (optional) | string | Contextual keyword for targeting | ## Banner Behaviors These are the attributes available for the `` component. They serve as input to the auction request, to fetch the right winners for that context. | Name | Type | Description | | ----------------- | ----------- | ---------------------------------------------------------- | | getLink(banner) | string | Destination URL of the banner, configured at the campaign. | | getLoadingElement | HTMLElement | A custom element to be shown when the banner is loading. | | getErrorElement | HTMLElement | A custom element to be shown when an error occurs. | ## Banner Interface The banner interface is the structure of a banner object. Each banner contains metadata about the campaign, and the resolvedBidId, the parameter needed for tracking user interactions (clicks and impressions). | Name | Type | Description | | ------------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | type | "product" \| "vendor" \| "brand" \| "url" | The type of the winning entity, represented by the banner, configured at the campaign. | | id | string | The ID of the winning entity. If the entity is of type URL, this is the URL. | | resolvedBidId | string | The corresponding bid ID of the winning entity, needed for tracking user interaction (clicks, impressions) with the ad. | | asset | \[\{ url: string }] | An array of urls linking to the assets of the banner. | # Google Tag Manager (GTM) Source: https://docs.topsort.com/en/ad-platform/banners/google-tag-manager How to integrate Topsort with Google Tag Manager (GTM) using our banners.js script You can use Google Tag Manager to inject our banner ads script in your platform. Check the Banner JS documentation for more details. ## Prerequisites You need to have a Google Tag Manager account and access to the GTM container for the website where you want to add the HTML. Copy the code below and paste it onto every page of your website. Paste this code as high in the `` of the page as possible (setting your GTM key): ```html theme={null} ``` Paste this code immediately after the opening `` tag (setting your GTM key): ```html theme={null} ``` You need to have a `` tag in the HTML with the height and width of the slot you want to display. ```html theme={null} ``` ## On Google Tag Manager Open your Google Tag Manager dashboard. Click on 'Current Workspace' from the sidebar and then select another one if needed. Click on 'Tags' from the sidebar and then 'New'. Select 'Custom HTML Tag' from the list of tag types. Enter your custom HTML code into the HTML text box. The code must include your topsort Marketplace API Key. To get a new token go to app.topsort.com → Settings → API Integration. ```html theme={null} ``` Choose a trigger to determine when the HTML should be executed (e.g., Page View, Click, etc.). Save your tag and use the 'Preview' mode to test the functionality of your HTML on your site. Check that the site is showing the banners, that the events are being reported correctly and that the opaqueUserId changes when using different browsers. Once verified, publish the changes to make the HTML live on your website. # Ad Platform | Standard Integration Source: https://docs.topsort.com/en/ad-platform/index Learn how to create and manage campaigns on the Topsort platform **Ad Platform** is your complete, out-of-the-box advertising solution for marketplaces looking to launch and grow their retail media business quickly. Built for ease of use and rapid deployment, it provides everything you need to start monetizing your traffic without extensive development work. With Ad Platform, you get pre-built tools for campaign management, reporting dashboards, event tracking, and multiple integration options that work with your existing marketplace infrastructure. Whether you're displaying banner ads or sponsored product listings, Ad Platform handles the complexity so you can focus on growing revenue. ## Who Is This For? Ad Platform is ideal for: * **Marketplaces** looking for quick, low-code integration * **Product teams** who want to launch ads without extensive backend work * **Businesses** seeking standard advertising features with minimal customization **Need more control?** If you require full API access and custom implementations, explore [Ad Server](/en/ad-server) instead. ## Key Features Quick setup with pre-built tools Create and manage ad campaigns Ready-made dashboards and reporting Banner ads and sponsored listings ## Integration Options Choose the integration path that fits your marketplace: ### Banners Display banner advertisements across your marketplace with minimal setup. JavaScript SDK for banner ads Deploy banners with GTM ### Listings Monetize your product search results with sponsored listings. Import catalog with feeds Enrich search results with sponsored products Track user interactions and conversions ### SDKs & Libraries Client libraries for seamless integration into your application. Client-side web SDK Native Swift SDK for iOS apps Native Kotlin SDK for Android apps Server-side PHP library ### Platform Plugins Pre-built integrations for popular e-commerce platforms. Native VTEX marketplace integration Salesforce Commerce Cloud integration ## Getting Started New to Ad Platform? Follow these steps: 1. **Choose your integration method** - Select from banners, listings, SDKs, or plugins 2. **Import your catalog** - Use product feeds to make your inventory available for ads 3. **Set up ad placements** - Integrate our tools where you want ads to appear 4. **Enable campaigns** - Allow advertisers to create and manage campaigns 5. **Track & optimize** - Monitor performance and optimize for better results Start with [Product Feed](/en/ad-platform/listings/product-feed) to import your catalog, then add [Banners.js](/en/ad-platform/banners/bannersjs) or [Topsort Proxy](/en/ad-platform/listings/topsort-proxy) for ad display. ## Need Full API Control? While Ad Platform provides excellent out-of-the-box functionality, some businesses need complete flexibility: * **Custom ad logic** and ranking algorithms * **Full control** over auction mechanics * **Advanced integrations** with proprietary systems * **Custom event tracking** and analytics If this describes your needs, explore [Ad Server](/en/ad-server) for complete API access and maximum customization. # Analytics.js Source: https://docs.topsort.com/en/ad-platform/listings/analytics-js Integrate and send interaction events with the analytics.js library Topsort's [analytics.js public library](https://github.com/Topsort/analytics.js) allows marketplaces to easily send Topsort interaction events, such as clicks, impressions and purchases, with a low-code integration. By using a simple HTML tag, the marketplace can connect to Topsort's ad server and send all tracking events related to an ad. ## Installation You can install the library using npm: ```html theme={null} npm install @topsort/analytics.js@2.4.0 --save ``` ## Configuration At your application's entry point, e.g. index.js ```html theme={null} window.TS = { token: "", url: "https://api.topsort.com", }; // Import the library to initialize it. import "@topsort/analytics.js"; ``` ## Marking Promoted Elements To allow Topsort to automatically track clicks, impression and purchases, use the HTML element `data-ts-*` to mark promoted elements in the page. ### Organic (non-promoted) elements ```html theme={null}
...
``` ### Promoted elements ```html theme={null}
...
``` ### Clickable areas Use `data-ts-clickable` to indicate what areas should trigger a click event: ```html theme={null}
Product Title
Help
``` ### Banner attribution For banner ads with product attribution: ```html theme={null}
...
``` ### Purchase tracking Use `data-ts-items` JSON array to track purchases: ```html theme={null}
My purchase
``` ## End to End Example Note that banners.js is required for topsort-banner tag, to learn more check [Banners.js documentation.](https://docs.topsort.com/en/ad-platform/banners/bannersjs) ```html theme={null}
Clickable content
Non clickable content
My purchase
``` # Product Feed Source: https://docs.topsort.com/en/ad-platform/listings/product-feed Integrate your product catalog with Topsort using a product feed This is the same content as the Ad Server Product Feed documentation. For the full reference, see [Ad Server > Catalog > Product Feed](/en/ad-server/catalog/product-feed). A product feed allows you to share your catalog with Topsort, synchronize data and maintain campaigns up-to-date. During the integration process you can provide us with the url of your product feed and we will ensure your catalog remains up to date. Our platform supports several formats: * Google Product Data Specification. * Tab separated values (TSV). * Comma separated values (CSV). If your product catalog is already on a third-party platform like Algolia or VTEX, we can integrate directly with them for updates and synchronization, ensuring the product information is accurate. ## Google Product Data Specification Share your catalog with Topsort using existing Google product feeds. We support the [Google Product Data Specification](https://support.google.com/merchants/answer/7052112?hl=en). ## TSV and CSV We support sharing your catalog using TSV and CSV feeds. **Which format should you use?** We recommend you use TSV over CSV. CSV is more error prone due to commas often being present in the catalog data. **If your product name or category name contains commas, you must use TSV.** For full documentation including supported columns, file examples, and webhook processing, see the [Ad Server Product Feed documentation](/en/ad-server/catalog/product-feed). # Topsort Proxy Source: https://docs.topsort.com/en/ad-platform/listings/topsort-proxy Learn how to use Topsort's proxy solution to augment your catalog results with promoted products The proxy is a middle layer between the marketplace backend and the results server (Algolia's server, for example). It acts as a bridge between the marketplace, the search engine and Topsort. This allows the proxy to ingest auction winners retrieved from Topsort into the response provided by the search engine, and return the final merged response to the marketplace. The proxy is compatible with most tech stacks, and it has been tested with platforms like VTEX, Algolia, and Salesforce. ## How to Use the Proxy To start using the proxy, you only need to change the hostname in your existing API call, from your catalog or search engine to our proxy. For example, change from: ```http theme={null} https://api.site.com/catalog/query?taxonomy=clothes ``` to: ```http theme={null} https://site.proxy.topsort.com/catalog/query?taxonomy=clothes ``` And we take it from there. We send the request to Topsort's auction engine and to the catalog or search engine. If any of the products returned by the catalog or search engine is promoted, we will indicate it in the merged response we'll build, which will be returned to the marketplace. Currently, the proxy supports application/json responses. Support for XML and GraphQL is planned. ## How Promoted Products Are Added Consider the following request, which fetches products from the 'office' taxonomy: ```http theme={null} GET https://api.site.com/catalog/query?taxonomy=office ``` The response from the catalog or search server without Topsort's proxy integration: ```json theme={null} { "products": [ { "id": "1", "name": "High-Speed Color Laser Printer" }, { "id": "2", "name": "Adjustable Height Standing Desk" }, { "id": "3", "name": "Ergonomic Swivel Office Chair" }, { "id": "4", "name": "Wireless Keyboard and Mouse Combo" }, { "id": "5", "name": "Magnetic Whiteboard with Marker Set" } ] } ``` After merging promoted products into the response: ```json theme={null} { "products": [ { "id": "3", "name": "Ergonomic Swivel Office Chair", "rank": 1, "resolvedBidId": "..." }, { "id": "6", "name": "Multi-drawer Filing Cabinet", "rank": 2, "resolvedBidId": "..." }, { "id": "1", "name": "High-Speed Color Laser Printer" }, { "id": "2", "name": "Adjustable Height Standing Desk" }, { "id": "4", "name": "Wireless Keyboard and Mouse Combo" } ], "topsort": { "winners": [ { "rank": 1, "type": "product", "id": "3", "resolvedBidId": "..." }, { "rank": 2, "type": "product", "id": "6", "resolvedBidId": "..." } ] } } ``` ## Understanding the New Fields * **rank**: The position of the promoted product in the auction. * **resolvedBidId**: A unique ID used to track the product in analytics. A new object named **topsort** is added at the root level only when promoted products are included. ## How to Track Events If you use Topsort's analytics.js library or Events API, use the product id and resolvedBidId fields to track user interactions: ```html theme={null}
...
``` ## Proxy Features * **Response Caching**: Reduces latency by caching successful responses from the catalog or search engine. * **Staging Mode**: Allows testing before going live. * **Catalog Sync Support**: Sends information to keep Topsort's catalog up to date. * **Built-in Logging**: Collects data on products, auctions, and performance. # Salesforce Source: https://docs.topsort.com/en/ad-platform/plugins/salesforce Overview of Topsort's integration with Salesforce ## Salesforce + Topsort Integration This integration enables Salesforce Commerce Cloud (SFCC) users to connect with Topsort's retail media auction system. It allows marketplaces receive ranked auction results and display both sponsored products and banners directly within their storefront. 🔗 **GitHub Repository**: [Topsort Salesforce Integration](https://github.com/Topsort/salesforce-topsort-auctions) ### Features * Seamless connection between SFCC and Topsort Auctions API * Real-time auction requests and ranked product results * Banner support for advertising campaigns ### Getting Started 1. Visit the [GitHub repository](https://github.com/Topsort/salesforce-topsort-auctions) 2. Follow the installation steps in the README 3. Configure your Topsort API credentials 4. Customize banner placements and product listings as needed For support or questions, contact the Topsort integrations team. # VTEX Source: https://docs.topsort.com/en/ad-platform/plugins/vtex Guide to integrate Topsort with VTEX using VTEX IO Toolbelt If you use VTEX as your e-commerce platform, you can integrate Topsort directly into your VTEX store to offer ad placements to your vendors. This integration is composed by the following apps: * Catalog Integration * Auctions Integration (Sponsored Listings) * Events Integration These apps work together to synchronize your catalog with Topsort, display sponsored products in search results, and track user interactions for reporting and optimization. ## Prerequisites * A VTEX account with administrative access. * The VTEX IO Toolbelt installed and configured. * A Topsort account with a Marketplace API Key and an Advanced API Key. Log in to your VTEX account: ```sh theme={null} vtex login {YOUR_ACCOUNT_NAME} ``` ## Setting up Your API Key Install the Topsort Services Settings app: ```sh theme={null} vtex install topsortpartnercl.services ``` Then configure the API Key: 1. Go to the admin of your VTEX Workspace. 2. Go to App > App Management and find the services app. 3. Click on settings and add the API Key, then click on Save. Verify the installation by going to `{{workspace__url}}/_v/ts/settings`. ## Importing Catalog into Topsort You can integrate your VTEX catalog with Topsort using the Afiliados endpoint. Please get in touch with your Topsort representative for assistance with the setup. ## Sponsored Listings in Search Results 1. Remove the native VTEX Search Resolver app. Topsort uses a fork of VTEX’s latest Search Resolver under the hood—same base behavior, but augmented with Topsort's auction logic. If not uninstalled, the apps will conflict: ```sh theme={null} vtex uninstall vtex.search-resolver ``` 2. Install the Auction Integration app: ```sh theme={null} vtex install topsortpartnercl.auctions ``` 3. Access the VTEX Admin portal, navigate to Apps > My Apps, and find Topsort's Auctions Integration. 4. Configure the number of sponsored slots and click Save. ## Tracking Events The Events Integration app tracks impressions, clicks, and purchases. ```sh theme={null} vtex install topsortpartnercl.events ``` Access the VTEX Admin portal, navigate to Apps > My Apps, and find Topsort's Events Integration. # Android Source: https://docs.topsort.com/en/ad-platform/sdks/android Overview of Topsort's Kotlin library for auction requests and event tracking in Android applications Topsort's [Kotlin library](https://github.com/Topsort/topsort.kt) enables our clients to easily send auction requests and track events within Android applications. Minimum Java version required: 17. ## Installation Add the dependency to your build.gradle file: ```kotlin theme={null} dependencies { implementation 'com.topsort:topsort-kt:2.0.0' } ``` ## Setup ### Kotlin ```kotlin theme={null} import android.app.Application import com.topsort.analytics.Analytics class KotlinApplication : Application() { override fun onCreate() { super.onCreate() Analytics.setup( application = this, opaqueUserId = "", token = "" ) } } ``` ### Java ```java theme={null} import android.app.Application; import com.topsort.analytics.Analytics; public class JavaApplication extends Application { @Override public void onCreate() { super.onCreate(); Analytics.INSTANCE.setup(this, "", ""); } } ``` ## Reporting Events ### Kotlin ```kotlin theme={null} // Purchase fun reportPurchase() { val item = PurchasedItem( productId = "", unitPrice = 1295, quantity = 20 ) Analytics.reportPurchase( id = "", items = listOf(item), ) } // Click (promoted) fun reportClickPromoted() { val placement = Placement(path = "search_results", location = "position_1") Analytics.reportClickPromoted( id = "", resolvedBidId = "", placement = placement ) } // Impression (promoted) fun reportImpressionPromoted() { val placement = Placement(path = "search_results", location = "position_1") Analytics.reportImpressionPromoted( id = "", resolvedBidId = "", placement = placement ) } ``` ## Banner Ads Add BannerView to your activity XML: ```xml theme={null} ``` Setup in your activity: ```kotlin theme={null} class SampleActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.sample_activity) this.lifecycleScope.launch { val bannerView = findViewById(R.id.bannerView) val bannerConfig = BannerConfig.CategorySingle(slotId = "slot", category = "category") bannerView.setup( bannerConfig = bannerConfig, screenName = "sample_activity", onClick = { id, entityType -> onBannerClick(id, entityType) } ) } } } ``` For full documentation, see the [GitHub repository](https://github.com/Topsort/topsort.kt). # iOS Source: https://docs.topsort.com/en/ad-platform/sdks/ios Integrate Topsort's Swift library for auction requests and event tracking in mobile applications Topsort's [Swift library](https://github.com/Topsort/topsort.swift) enables our clients to easily send auction requests and track events within iOS applications. ## Installation Install using package.swift: ```swift theme={null} let package = Package( dependencies: [ .package(url: "https://github.com/Topsort/topsort.swift.git", from: "1.0.0"), ] ) ``` ## Configuration ```swift theme={null} import SwiftUI import Topsort @main struct MyApp: App { init() { Topsort.shared.configure(apiKey: "your-api-key", url: "https://api.topsort.com") } var body: some Scene { WindowGroup { ContentView() } } } ``` ## Requesting Auctions ```swift theme={null} import Topsort let products = AuctionProducts(ids: ["p_dsad", "p_dvra", "p_oplf"]) let category = AuctionCategory(id: "c_fdfa") let auctions = [ Auction(type: "banners", slots: 1, slotId: "home-banner", device: "mobile", category: category), Auction(type: "listings", slots: 2, device: "mobile", products: products) ] let result: AuctionResponse = await Topsort.shared.executeAuctions(auctions: auctions) ``` ## Reporting Events ### Impressions and Clicks ```swift theme={null} var body: some View { VStack { AsyncImage(url: self.product.image_url) Text(self.product.name) } .onAppear { Topsort.shared.track(impression: self.event()) } .onTapGesture { Topsort.shared.track(click: self.event()) } } ``` ### Purchases ```swift theme={null} Button("Purchase me!") { let item = PurchaseItem(productId: myProduct.id, unitPrice: myProduct.price) let event = PurchaseEvent(items: [item], occurredAt: Date.now) Topsort.shared.track(purchase: event) } ``` ## Displaying Banners ```swift theme={null} import TopsortBanners struct ContentView: View { var body: some View { TopsortBanner(bannerAuctionBuilder: .init(slotId: "slotId", deviceType: "device")) .contentMode(.fill) .onNoWinners({ }) .onError({ error in }) .onImageLoad({ }) .buttonClickedAction({ response in }) .frame(maxHeight: 50) .clipped() } } ``` For full documentation, see the [GitHub repository](https://github.com/Topsort/topsort.swift). # JavaScript SDK Source: https://docs.topsort.com/en/ad-platform/sdks/javascript-sdk Overview of Topsort's JavaScript SDK for auctions and event tracking The [Topsort JavaScript SDK](https://github.com/Topsort/topsort.js) is the official client library to integrate with Topsort's auction and event tracking APIs. Built in TypeScript, this SDK simplifies the integration, allowing the creation of an end-to-end flow in minutes. ## Installation ```html theme={null} ``` ## Creating an Auction ```javascript theme={null} import { TopsortClient } from "https://unpkg.com/@topsort/sdk@latest/dist/index.mjs"; const topsortClient = new TopsortClient({ apiKey: window.TS.token }); const auctionDetails = { auctions: [ { type: "listings", slots: 3, searchQuery: "winter", }, { type: "banners", slots: 1, device: "desktop", slotId: "slot123", }, ], }; topsortClient .createAuction(auctionDetails) .then((result) => console.log("Auction Result", result)) .catch((error) => console.error("Auction Error", error)); ``` ## Reporting Events ```javascript theme={null} const winners = auctionResult.results.flatMap((result) => result.winners || []); if (winners.length > 0) { const impressions = winners.map((winner) => ({ resolvedBidId: winner.resolvedBidId, id: crypto.randomUUID(), occurredAt: new Date().toISOString(), opaqueUserId: crypto.randomUUID(), placement: { path: "/search/winter" }, })); topsortClient .reportEvent({ impressions }) .then((result) => console.log("Event Result", result)) .catch((error) => console.error("Event Error", error)); } ``` ## Retryable Errors The `reportEvent` function returns `retry: true` for 429 or 5xx errors: ```javascript theme={null} topsortClient.reportEvent(eventPayload).then((result) => { if (result.retry) { console.warn("Transient error. Retry the call."); } }); ``` For full documentation and end-to-end examples, see the [GitHub repository](https://github.com/Topsort/topsort.js). # Topsort.php Source: https://docs.topsort.com/en/ad-platform/sdks/topsort-php A PHP Software Development Kit for interacting with the auctions and events endpoints [Topsort.php](https://github.com/Topsort/topsort.php) is a PHP Software Development Kit for Topsort Promoted Listings API. ## Installation Install with Composer: ```bash theme={null} composer require topsort/sdk ``` Or add to your composer.json: ```json theme={null} { "require": { "topsort/sdk": "3.0.0" } } ``` ## Running an Auction ```php theme={null} create_auction($slots, $products)->wait(); ``` ## Reporting Click Events ```php theme={null} "/categories/shoes", ]; $topsort_client->report_click([ "placement" => $placement, "resolvedBidId" => "AKFU78", ]); ``` ## Reporting Impression Events ```php theme={null} [ "path" => "/categories/shoes", ], "resolvedBidId" => "AKFU78", ]; $topsort_client->report_impression($impression); ``` ## Reporting Purchase Events ```php theme={null} "gDG0HV97ed2s", "quantity" => 2, "unitPrice" => 10000, ] ]; $topsort_client->report_purchase([ "occurredAt" => new DateTime(), "items" => $items, ]); ``` For full documentation, see the [GitHub repository](https://github.com/Topsort/topsort.php). # Assets API Source: https://docs.topsort.com/en/ad-server/additional-apis/assets-api Integrate with our Assets API Topsort's [Assets API](/en/api-reference/assets-api) is designed to provide tools for managing assets that can be used in campaigns (e.g. banner ads). It also includes collection management tools. These are its main functionalities: * Create, retrieve, update, and delete individual assets. - List multiple assets with filters (e.g., by vendor, type, status) and pagination. * Create, retrieve, update, and delete asset collections. - List collections, filterable by vendor, with pagination. # Billing API Source: https://docs.topsort.com/en/ad-server/additional-apis/billing Integrate with our Billing API Topsort's [Billing API](/en/api-reference/billing-api) provides functionalities for managing billing aspects for both admins and vendors. Here's a list of its capacities: * Get the current balance for a specific vendor. - Add funds to a vendor's balance, including a description for the transaction. - Burn (reduce) a vendor's balance for a specified reason. - List all wallets associated with a vendor. - Create a new wallet for a vendor (limit of 3 per vendor). - Adjust the balance of a specific wallet (add positive amount, burn negative amount). * Retrieve a list of all billing contacts, optionally filtered by vendor ID. * Get details for a specific billing contact using its ID. - Create or update (upsert) a billing contact's information. - Retrieve the billing contact associated with a specific campaign. - Assign or update the billing contact for a specific campaign. - Assign a billing contact to a specific vendor. - Remove the assignment of a billing contact from a vendor. # Campaign API Source: https://docs.topsort.com/en/ad-server/additional-apis/campaign-api Integrate with our Campaign API Campaigns allow admins and vendors to promote products, banners or brands, using Topsort's UI and the [Campaign API](/en/api-reference/campaign-api). If self-service is enabled, vendors can create campaigns themselves and submit them for approval (for banner ads). ## Campaign Properties These properties can be set on campaign creation using our API: * Bidding Strategy * Bids * Budget * Wallet ## Sponsored Listings Campaigns designed for promoting products. A single campaign can have multiple products, and Topsort's algorithm will determine the best one to participate in auctions, depending on their quality scores and campaign objectives. Each product of the campaign will have its own bid, and the bid participates in the auctions based on its triggers. There are three types of triggers: 1. **Set of products**: only bids that target the products listed in the set will participate in the auction. 2. **Category**: only bids that target products belonging to the given categories will have a chance to win the auction. 3. **Search term**: only bids that target products with matching keywords will have a chance to win such auctions. ## Banner and Video Ads Banner and Videos Ads can be created to specific contexts of your platform: Landing Pages, Search and Category. Different placements can be created in each context, and each placement has different configurations. ### Landing Page Placements Landing page placements allows you to create banner ads in different pages of your platform, without the need of targeting or filtering. These placements includes: * **Slot ID**: an unique identifier of the placement. * **Name**: a description of the placement, reference in the UI for placement selection. * **URL or Deeplink**: the URL of the landing page. * **Creative Width and Height, for two different dimensions**: desktop and mobile. Landing Page Slots ### Search and Categories Placements Search and Categories placements allow you to create banner ads for targeting specific categories or keywords. These placements include: * **Slot ID**: an unique identifier of the placement. * **Creative Width and Height, for two different dimensions**: desktop and mobile. Search Slots # Invitation API Source: https://docs.topsort.com/en/ad-server/additional-apis/invitation-api Integrate with our Invitation API More APIs to customize your exact workflow and build your preferred version of an ad business. Check the complete documentation of our [Invitation API](/en/api-reference/invitation-api). With this API, you can invite advertisers and vendors user accounts. Send invitations using vendor ID and email. Supports bulk invites (up to 500 at once). Useful for onboarding new sellers into the ad platform. # Offsite Ads API Source: https://docs.topsort.com/en/ad-server/additional-apis/offsite Integrate with our Offsite Ads API Topsort's [Offsite Ads API](/en/api-reference/offsite-ads-api) provides functionalities for managing offsite ad campaigns, audiences, and reporting. This API includes: * **Advertisers**: Create and retrieve advertiser details. * **Audiences**: List, create, and upload users (via file) to audiences. * **Campaigns**: List, create, retrieve details for, and update offsite campaigns. * **Geotargeting**: Retrieve geotargeting settings for a specific campaign. * **Jobs**: Check the status of asynchronous operations (like creation or uploads). * **Reporting**: Get performance reports for campaigns, including overall summaries, daily breakdowns, and product-level details. # Reporting API Source: https://docs.topsort.com/en/ad-server/additional-apis/reporting-api Integrate with our Reporting API Topsort's [Reporting API](/en/api-reference/reporting-api) offers access to performance data across campaigns, vendors and marketplaces. You can download campaign and marketplace performance metrics such as: * Daily or total reports for campaigns, vendors, products, or the entire marketplace. * Scored attribution reports (via S3 links). * Interaction reports: impressions, clicks, purchases by time granularity. Reports are available at different contexts and levels of granularity: ## Campaign Reports * Total campaign and daily breakdown performance reports, including campaign metrics such as ROAS, CTR and CPC. * Reports with aggregated metrics by product can also be obtained. * Campaigns KPIs: list of campaign level KPIs, with optional filtering by vendor, ad formats and other fields. ## Vendor Reports * Total vendor and daily breakdown performance reports, including total impressions, clicks, purchases, ad spend and ROAS. * Vendor level KPIs: list of vendor level KPIs. ## Marketplace Reports * Aggregated report on the marketplace level. * Also available with daily breakdown. ## Interaction Reports * Allows exporting engagement (impressions, clicks, purchases) grouped by campaigns, products or vendors. * Can optionally be aggregated by days or hours. ## Attribution Files * Topsort provides scored attribution files. * The files include impressions, clicks and purchases associated with campaign IDs, along with the attribution data. * The files are available in parquet format, downloaded via pre-signed URLs. # Algolia Source: https://docs.topsort.com/en/ad-server/auctions/algolia Integrate auction results with an existing Algolia index This guide shows how to integrate Topsort auction results with your existing Algolia index, allowing organic and promoted products to be listed in the same flow. Algolia is a powerful search engine that provides fast and relevant results for navigating catalogs. By integrating Algolia with Topsort, we can sync your catalog directly into Topsort, without needing extra catalog integrations. The integration will also enable you to prioritize promoted products in the organic results returned by Algolia. Check Topsort's Proxy integration for more details. ## How it Works To integrate Topsort with Algolia, make sure you comply with these prerequisites: * Your product catalog is stored in an Algolia index. * You are querying Algolia using the Algolia SDK. Create an Algolia API key with the following permissions: search, browse, listIndexes (additional permissions like addObject and deleteObject may be needed depending on how you manage your index updates). * The browse permission enables downloading of your entire catalog. * The listIndexes permission allows Topsort to check the index's last modification date to avoid unnecessary updates Contact Topsort support and share your Algolia index name. This allows Topsort to configure and start importing your catalog. Update your Algolia SDK configuration to point to Topsort's Proxy. This will allow Topsort to prioritize promoted products in the organic results returned by Algolia. ```javascript theme={null} import algoliasearch from 'algoliasearch/lite'; const client = algoliasearch('YourApplicationID', 'YourWriteAPIKey', { hosts: [{ url: 'myslug-sandbox.topsort.workers.dev' }], }); const index = client.initIndex('your_index_name'); ``` ## Auction Results and Event Tracking The promoted products prioritized in the response of Topsort's Proxy will have a resolvedBidId parameter that uniquely identifies that product's auction. You can use it to visually mark the product as "Promoted" for the end use. The resolvedBidId is also needed to identify the auction winner when reporting events (impressions, clicks, purchases). Check our Events Tracking documentation for more detail. # Auctions API Source: https://docs.topsort.com/en/ad-server/auctions/auctions-api Integrate with our Auctions API Topsort's [Auctions API](/en/api-reference/auctions) determines which bids from active campaigns should be promoted. As a marketplace admin, you can define where, when and how auctions should be created. We have three types of auctions available: * **Sponsored Products**: allow promoting specific products in search results, category listings, PDPs and product carousels. * **Banner Ads and Video Ads**: ads to be displayed in search, category or landing pages. * **Sponsored Brands**: allow promoting brands in search, category or landing pages. An auction should be created for each page view. If the auction results are cached, the same results could be shown to multiple users or to the same user multiple times. This will impact campaign performance tracking. ## Auction Creation Use the appropriate API to create an auction and retrieve winners. The key parameters needed for any auction are: * **Type**: listings, banners, videos or brands * **Max winners**: maximum number of winners to be returned. If the auction engine encounters less winners then the maximum number requested, all winners will be returned. * **Triggers**: triggers are targeting elements used to filter which campaigns are eligible in the auction. * **Product IDs - Automatic Trigger**: Targets bids for specific products. This trigger can be used to promote products that were returned by your search engine and have bids from active campaigns. * **Category IDs**: Targets bids for specific categories. This trigger can be used to return winners related to one or more categories. * **Search Query**: Target bids matching keywords. * **Geolocation**: Target bids matching geolocation. ## Auction Resolution Topsort matches the auction criteria with active campaigns and filters bids that are eligible to participate, considering the parameters defined in the auction request, and are above the reserve price. Reserve price is the minimum bid price allowed by the marketplace. Winning bids are defined and ranked, considering two main objectives: * Optimize advertiser ROAS, considering the best products based on their metrics (CTR, CVR, quality score). * Maximize retailers revenue, considering the bidding amount of each product. ## Displaying Winners and Tracking Events Winning bids are returned by Topsort's API with an unique **Resolved Bid ID**. This parameter identifies every promoted item that participated in an auction. It's used to ensure accurate reporting and attribution. This parameter should be sent with the impressions, clicks and purchases that are reported with the Events API. # Catalog Integration Source: https://docs.topsort.com/en/ad-server/catalog/index Integrate your product catalog with Topsort to enable sponsored product campaigns The Catalog is the foundation of your Topsort integration. Before running auctions or tracking events, you need to synchronize your product catalog with Topsort. This ensures that vendors can create campaigns for their products and that the auction system has accurate, up-to-date product information. ## Integration Options Share your catalog using a product feed URL. Topsort automatically fetches and synchronizes your catalog data. Use the Catalog API for real-time updates and programmatic control over your product data. ## What Gets Synchronized Your catalog integration includes three key entities: | Entity | Description | Required | | -------------- | --------------------------------------- | -------- | | **Products** | Items that can be promoted in campaigns | Yes | | **Categories** | Product groupings for targeting | Yes | | **Vendors** | Sellers who can create campaigns | Yes | ## Getting Started Decide between a Product Feed (recommended for most integrations) or the Catalog API (for real-time programmatic updates). Ensure your catalog data includes product IDs, names, categories, and vendor information. Set up your product feed URL or implement API calls to keep your catalog up-to-date. Check that products, categories, and vendors appear correctly in the Topsort platform. ## Next Steps * [Set up a Product Feed](/en/ad-server/catalog/product-feed) - Recommended for most integrations * [Use the Catalog API](/en/api-reference/catalog-api/upsert-products) - For programmatic updates * [Learn about Catalog Management](/en/knowledge-base/ad-platform/catalog-management) - Best practices and configuration # Product Feed Source: https://docs.topsort.com/en/ad-server/catalog/product-feed Integrate your product catalog with Topsort using a product feed A product feed allows you to share your catalog with Topsort, synchronize data and maintain campaigns up-to-date. During the integration process you can provide us with the url of your product feed and we will ensure your catalog remains up to date. Our platform supports several formats: * Google Product Data Specification. * Tab separated values (TSV). * Comma separated values (CSV). Topsort fetches data from a product feed If your product catalog is already on a third-party platform like Algolia or VTEX, we can integrate directly with them for updates and synchronization, ensuring the product information is accurate. For detailed instructions on setting up these connections and specific requirements for each platform, please refer to the "3rd Party Integrations - Partners" section of our documentation. ## Google Product Data Specification Share your catalog with Topsort using existing Google product feeds. We support the [Google Product Data Specification](https://support.google.com/merchants/answer/7052112?hl=en). ## TSV and CSV We support sharing your catalog using TSV and CSV feeds. The instructions in this section apply to both formats. **Which format should you use?** We recommend you use TSV over CSV. CSV is more error prone due to commas often being present in the catalog data. **If your product name or category name contains commas, you must use TSV.** ### Supported Columns | Name | Required | Default | Description | | :------------------------ | :---------------------------------- | :-------------------- | :----------------------------------------------------------------------------------------------------------------------------- | | `id` | yes | - | Unique identifier for each product. | | `active` | no | true | Whether the product can be part of campaigns or auctions. Inactive products will be removed from existing campaigns. | | `title` | yes | - | Name of the product | | `category.0.name` | yes | - | Category name of the primary category for this product. | | `category.0.id` | no | Slug of category name | ID of the primary category for this product. | | `vendor.0.name` | yes if not use `seller_name` | - | Vendor of the product. This is the entity that has their own budget to advertise this product and competes with other vendors. | | `vendor.0.id` | yes if not use `external_seller_id` | Slug of vendor name | ID of the vendor of this product. | | `seller_name` | yes if not use `vendor.0.name` | | Vendor name of the product, same value as `vendor.0.name`. | | `external_seller_id` | yes if not use `vendor.0.id` | | ID of the vendor of this product. | | `google_product_category` | yes | - | Categories provided in Google Taxonomy Format. | | `product_type` | no | - | Additional taxonomy for the product. | | `price` | no | - | Product price. | | `image_link` | no | - | URL to an image of the product. | | `link` | no | - | URL to the page of the product in the marketplace. | | `availability` | no | - | Stock status. Must be one of `in stock`, `out of stock` or `preorder`. | | `description` | no | - | Detailed description of the product. | | `gtin` | no | - | Global Trade Item Numbers. Covers EAN, UPC, JAN, ISBN and ITF-14. | | `brand` | no | - | Indicate the product's brand name. | Categories can be provided in several ways. But only one is required. You can associate a product with more categories and vendors. See the section below. ### File examples #### Example TSV using vendor.0.name ```tsv theme={null} id name description vendor.0.id vendor.0.name vendor.0.image_link category.0.id category.0.name category.1.id category.1.name image_link price availability 1293 Green Mask Green Mask for removing imperfections, use during night or day 1710000087 Derma Laboratories 10000087 Skin Care 61 Beauty & Health https://i.postimg.cc/0QxMWmbd/shampoo.png 23935.29 out of stock 1302 Cleanser Gel N/A 17829100 Shiny Laboratories 10000087 Skin care https://i.postimg.cc/0QxMWmbd/shampoo.png 16050.42 in stock ``` #### Example CSV using vendor.0.name ```csv theme={null} id,name,description,vendor.0.id,vendor.0.name,vendor.0.image_link,category.0.id,category.0.name,category.1.id,category.1.name,image_link,price,availability 1293,Green Mask,"Green Mask for removing imperfections, use during night or day",1710000087,Derma Laboratories,,10000087,Skin Care,61,Beauty & Health,https://i.postimg.cc/0QxMWmbd/shampoo.png,23935.29,out of stock 1302,Cleanser Gel,N/A,17829100,Shiny Laboratories,,10000087,Skin care,,,https://i.postimg.cc/0QxMWmbd/shampoo.png,16050.42,in stock ``` ### Multiple categories and vendors Products can be associated with multiple categories and/or vendors. As you might have noticed, the category and vendor columns contain indices. You can add additional category and/or vendor columns as long as you increase the index appropriately. For example, a product with three categories and two vendors would have at the very least these columns: ```txt theme={null} category.0.id category.1.id category.2.id vendor.0.id vendor.1.id ``` ### Google Taxonomy Format Alternatively, you can use [Google's Taxonomy Format](https://support.google.com/merchants/answer/7052112?hl=en#product_category) as category names. This allows you to describe more complex hierarchical relationships. For example, this hierarchy: ```txt theme={null} Apparel & Accessories > Clothing > Dresses ``` Will result in three categories: ```json theme={null} [ { "id": "apparel-and-accessories", "name": "Apparel & Accessories", "path": "apparel_and_accessories" }, { "id": "clothing", "name": "Clothing", "path": "apparel_and_accessories.clothing" }, { "id": "dresses", "name": "Dresses", "path": "apparel_and_accessories.clothing.dresses" } ] ``` ## Optional fields and auction optimization The table above lists the minimum a product needs to participate in auctions. Beyond that minimum, we recommend including these fields for every product, since we use them to improve relevance and reporting: * `description` * `price` * `link` * `brand` * `gtin` ## Hosting your product feed Your product feed needs to be continuously accessible to Topsort so that we can keep our data up to date. We can currently access public product feeds or feeds that are protected using [Basic HTTP Authorization](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization). In addition, use the [ETag Response headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) to help us determine if a product feed has been updated since last fetch. ## Deleting products The `active` property can be set to `false` to mark a product as inactive. This can be done both [via the API](/en/api-reference/catalog-api/upsert-products) and via the product feed. Inactive products will not be included in new campaigns or auctions. And will not be considered in any active campaigns. You can also set this when a product is out of stock, discontinued, or otherwise not available for sale. To permanently delete products from Topsort's system, [use the API](/en/api-reference/catalog-api/delete-products) or omit them from the uploaded feed file. ## Generated slugs When categories or vendors don't have an ID, we generate one on the fly. **Prefer to use explicit IDs** It's recommended to provide the IDs explicitly in your product feed, these IDs are used as references when managing campaigns and auctions. If you use generated IDs you will need to use the same algorithm on the marketplace side to create such references. These IDs use a **slug** derived from the name. A slug is a kebab case formatted string that is suitable for inclusion in URLs. For example, `Hello world` becomes `hello-world`. The format is based on the [npm slugify](https://www.npmjs.com/package/slugify) library. ## Dev Tools Marketplaces that send their catalog via a product feed can open **Dev Tools > Catalog** in the marketplace Admin Dashboard to monitor ingestion health without opening a support ticket. The Catalog tab surfaces key sync metrics at a glance: * **Last sync time**: when the most recent catalog sync ran * **Average sync duration**: how long syncs typically take * **Success rate**: across the last 14 runs * **Recent sync runs**: each ingestion with how many records were processed or skipped With this view, engineering teams can confirm feeds are running on schedule and quickly spot failures or skipped-heavy runs. # End-to-End API Example Source: https://docs.topsort.com/en/ad-server/e2e-api-example End to end integration example with our APIs This example demonstrates a full flow using Topsort's APIs for a sponsored product campaign with category targeting. Replace API keys and IDs with your actual credentials and values. **Steps:** Sync your product catalog with Topsort Set up a sponsored product campaign Request auction winners Report impressions, clicks, and purchases Retrieve campaign performance data * For managing products, campaigns, and reports, use an Advanced API Key (TSC\_...). - For auctions and events, use a Marketplace API Key (TSE\_...). ## 1. Sync Catalog A sample product example-product-coca-cola, from category soft-drinks is used in this example. Remember to use your Advanced API Key. ```javascript theme={null} const apikey = "TSC_..."; const body = { products: [ { active: true, categories: ["soft-drinks"], id: "example-product-coca-cola", imageURL: "https://intl.cokestore.com/media/catalog/product/1/6/16181_squeeze-ko-can-maria-2.png", name: "Coca Cola can", price: "9.99", vendors: ["coca-cola"], }, ], }; try { const response = await fetch( "https://api.topsort.com/public/v1/catalog-search-service/catalogs/products", { method: "PUT", mode: "cors", headers: { Authorization: `Bearer ${apikey}`, "Content-Type": "application/json; charset=utf-8", }, body: JSON.stringify(body), } ); if (!response.ok) { console.error("unexpected status: " + response.status); } else { console.log("success status: " + response.status); } } catch (error) { console.error(error); } ``` ## 2. Create Campaign In this example, a campaign is created to promote the product example-product-coca-cola, having a keyword trigger (soft drink). Remember to use your Advanced API Key. ```javascript theme={null} const apikey = "TSC_..."; const body = { bids: [ { target: { type: "product", id: "example-product-coca-cola", }, triggers: [ { type: "keyword", value: { matchType: "exact", words: ["soft drink"], }, }, ], }, ], budget: { type: "daily", amount: 10000, }, campaignType: "autobidding", isActive: true, status: "approved", adFormat: "listing", name: "An example campaign", }; try { const response = await fetch( "https://api.topsort.com/public/v1/campaign-service/campaigns?vendor_id=demo-vendor", { method: "POST", mode: "cors", headers: { Authorization: `Bearer ${apikey}`, "Content-Type": "application/json; charset=utf-8", }, body: JSON.stringify(body), } ); if (!response.ok) { console.error("unexpected status: " + response.status); } else { console.log("success status: " + response.status); } } catch (error) { console.error(error); } ``` ## 3. Send Auction Request In this example, an auction request is created to return winners triggered by the search term "soft drink". Remember to use your Marketplace API Key. ```javascript theme={null} const apikey = "TSE_..."; const body = { auctions: [ { searchQuery: "soft drink", slots: 1, type: "listings", }, ], }; try { const response = await fetch("https://api.topsort.com/v2/auctions", { method: "POST", mode: "cors", headers: { Authorization: `Bearer ${apikey}`, "Content-Type": "application/json; charset=utf-8", }, body: JSON.stringify(body), }); if (!response.ok) { console.error("unexpected status: " + response.status); } else { console.log("success status: " + response.status); } } catch (error) { console.error(error); } ``` ## 4. Tracking Events In this example, a click on a promoted product is tracked using our API. The resolvedBidId of the winner returned by the auctions call needs to be sent in the body of the request, to guarantee correct attribution of sales. Remember to use your Marketplace API Key. ```javascript theme={null} const apikey = "TSE_..."; const body = { clicks: [ { id: "d0cf3f56-a719-4e02-9c88-625f965ae6e7", occurredAt: "2024-07-23T11:49:04+00:00", opaqueUserId: "71303ce0-de89-496d-8270-6434589615e2", resolvedBidId: "ChAGafmNzX5wy4sEaDnXi4iWEhABjxq1RG513IkbvRgIVcd6GhABjmiyW3t2Ur066CLC3jWVIgoKBjExMjYzNBABMPuVDw", }, ], }; try { const response = await fetch("https://api.topsort.com/v2/events", { method: "POST", mode: "cors", headers: { Authorization: `Bearer ${apikey}`, "Content-Type": "application/json; charset=utf-8", }, body: JSON.stringify(body), }); if (!response.ok) { console.error("unexpected status: " + response.status); } else { console.log("success status: " + response.status); } } catch (error) { console.error(error); } ``` # Events API Source: https://docs.topsort.com/en/ad-server/events/events-api Track impressions, clicks, and purchases to enable attribution and campaign optimization The Events API allows you to send real-time user interaction data to Topsort. This data powers campaign attribution, reporting, and optimization algorithms. ## Event Types Topsort tracks three core event types: | Event | Description | When to Send | | -------------- | --------------------------------- | ---------------------------------------------- | | **Impression** | User views a promoted product | When a sponsored product is rendered on screen | | **Click** | User clicks on a promoted product | When a user clicks a sponsored product | | **Purchase** | User completes a transaction | When an order is confirmed | ## Integration Options Send events directly to Topsort's Events API for maximum control and flexibility. Use our JavaScript SDK for easy client-side event tracking. Route events through Segment if you're already using it for analytics. Integrate via RudderStack for unified event routing. ## Key Concepts ### Resolved Bid ID The `resolvedBidId` is a unique identifier returned from the Auctions API that links an event to a specific auction winner. This is required for impression and click events to enable proper attribution. ```json theme={null} { "impressions": [ { "resolvedBidId": "WyJiX01mazE1IiwiMTJhNTU4MjgtOGVh...", "occurredAt": "2023-05-01T12:00:00Z" } ] } ``` ### Event Attribution Events are attributed to campaigns based on: * **Direct attribution**: User interacts with a promoted product and converts * **Halo attribution**: User views a promoted product but purchases a different product from the same vendor Learn more about [attribution models](/en/knowledge-base/ad-server/attribution). ## Implementation Steps When displaying auction winners, store the `resolvedBidId` from the auction response. Send an impression event when a sponsored product becomes visible to the user. Send a click event when a user clicks on a sponsored product. Send purchase events when orders are completed, including all purchased products. ## Example: Sending Events ```bash theme={null} curl -X POST https://api.topsort.com/v2/events \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "impressions": [ { "resolvedBidId": "WyJiX01mazE1IiwiMTJhNTU4...", "occurredAt": "2023-05-01T12:00:00Z" } ], "clicks": [ { "resolvedBidId": "WyJiX01mazE1IiwiMTJhNTU4...", "occurredAt": "2023-05-01T12:00:05Z" } ] }' ``` ## Next Steps * [Events API Reference](/en/api-reference/events/report-events) - Full API documentation * [Analytics.js Guide](/en/ad-platform/listings/analytics-js) - Client-side tracking * [Attribution Models](/en/knowledge-base/ad-server/attribution) - Understanding attribution # RudderStack Source: https://docs.topsort.com/en/ad-server/events/rudderstack Learn how to integrate Topsort Events with RudderStack This guide explains how to set up Topsort as a destination in RudderStack. You can also check our documentation in [Rudderstack's Knowledge Base](https://www.rudderstack.com/docs/destinations/streaming-destinations/topsort/cloud-mode/). 1. In the RudderStack dashboard, add your data source (website or app). 2. From the list of destinations, select Topsort. 3. Complete the following settings: | Setting | Description | | ------- | ---------------------------------------------------- | | Name | Unique name for this destination. | | API Key | Obtain this on Topsort > Settings > API Integration. | Click Set-up mapping in the dashboard to define how [RudderStack events](https://www.rudderstack.com/docs/event-spec/ecommerce-events-spec/) map to Topsort events. Example for mapping these events: | RudderStack event | Topsort event | | ------------------- | ------------- | | Order Completed | Purchase | | Product Clicked | Click | | Product Added | Click | | Product Viewed | Impression | | Product List Viewed | Impression | Prevent double-counting by reviewing your event firing logic. Use `rudderanalytics.track()` to send events to Topsort. Example: ```javascript theme={null} rudderanalytics.track("Product Added", { product_id: "9578257311", sku: "8472-998-0112", name: "Sample Product" }) ``` Check the mapping of all fields of each event in the Rudderstack's Knowledge Base # Twilio Segment Source: https://docs.topsort.com/en/ad-server/events/twilio-segment Learn how to integrate Topsort Events with Twilio Segment If you're using Twilio Segment to track events on your site, you can send events to Topsort directly by adding the Topsort Destination in your Segment account. Please refer to [Topsort documentation](https://segment.com/docs/connections/destinations/catalog/actions-topsort/) on the Twilio Segments knowledge base. As a prerequisite for this integration, you must have a Segment account and a working Source (website or app). Topsort uses three main events, all mapped from Segment's eCommerce Spec: | Topsort Event | Default Segment Mapping | Alternate Mapping | | :-----------: | :---------------------: | :-----------------: | | `impressions` | Product Viewed | Product List Viewed | | `clicks` | Product Clicked | Product Added | | `purchases` | Order Completed | — | * Avoid sending duplicated clicks. If both Product Clicked and Product Added are fired from the same user action, choose only one. * If you're using custom events, reach out at [support@topsort.com](mailto:support@topsort.com) to map them properly. 1. In Segment, go to Connections > Catalog > Destinations 2. Search for Topsort, then click Add Destination 3. Select the relevant Source (your site or app) Segment App 1. In the Topsort Manager Platform, go to Settings > API Integration 2. Copy or create your Marketplace API Key 3. Back in Segment, open the Topsort destination's Settings tab and paste your API Key Segment Settings The API Key allows Segment to send events to your Topsort account. 1. Only enable the Track events you're actively sending from your site Segment Mappings Prevent double-counting by reviewing your event firing logic. 2. Add the `resolvedBidId` field to: * Product Viewed events * Product Clicked events The `resolvedBidId` uniquely identifies the promoted winner of the auction. You can retrieve it from the Auctions API or Proxy response. Example call: ```javascript theme={null} analytics.track('Product Clicked', { productId: '12345', resolvedBidId: '67890' // required for Topsort attribution }); ``` Topsort recommends identifying logged users with Segment's identify method. Example: ```javascript theme={null} analytics.identify('361b1fdfbeaa9d64a13c033eb9f970dc6740f6bc', { email: 'john.doe@example.com' }); ``` Logged-out users are tracked with an `anonymousId`. If using server-side sources, include at least userId or anonymousId. Once a user is identified, each call to Segment's Track method automatically records the user ID. Users that are not logged in can be tracked using an anonymousId. # Ad Server | Full API Integration Source: https://docs.topsort.com/en/ad-server/index Every feature and capacity we deliver can be used through our APIs **Ad Server** is your complete API-first advertising solution, designed for businesses that need full control and customization. Every feature and capability Topsort offers is accessible through our comprehensive API suite, giving you maximum flexibility to build exactly what you need. With Ad Server, you have complete control over auction logic, ranking algorithms, event tracking, and reporting. Perfect for companies with in-house development teams who want to deeply integrate advertising into their platform's unique architecture and workflows. ## Who Is This For? Ad Server is ideal for: * **Enterprises** with in-house engineering teams and custom requirements * **Technical teams** needing full control over ad logic and ranking algorithms * **Businesses** requiring deep integration with proprietary systems * **Platforms** with unique auction mechanics or custom workflows **Want a faster setup?** If you need quick deployment without extensive API integration, explore [Ad Platform](/en/ad-platform) instead. ## Key Benefits Full control over every aspect Build your own ranking algorithms Integrate with proprietary systems Access to all API capabilities ## Core APIs Build your advertising platform using three foundational APIs: ### Catalog API Keep your products, categories, and vendors synchronized with Topsort. Manage product catalog data Manage advertiser accounts Organize product taxonomy Keep catalog data current ### Auctions API Trigger real-time bidding and retrieve winners for sponsored products and banners. Real-time bidding mechanics Sponsored product listings Banner ad auctions Handle auction results ### Events API Track impressions, clicks, and purchases to enable optimization, reporting, and attribution. Event tracking fundamentals Track ad views Track ad interactions Track conversions and revenue ## Getting Started New to Ad Server? Follow these steps: 1. **Set up your environment** - Get API credentials and configure authentication 2. **Sync your catalog** - Use the Catalog API to import products, vendors, and categories 3. **Implement auctions** - Integrate auction calls into your search and browse flows 4. **Track events** - Send impression, click, and purchase events to close the loop 5. **Test and optimize** - Monitor performance and refine your implementation Start with [Authentication](/en/ad-server/authentication) to get your API credentials, then move to [Catalog API](/en/ad-server/catalog) to sync your products. ## Advanced Capabilities Once you have the basics working, explore advanced features: * **Custom ranking algorithms** - Implement your own logic for ad placement * **A/B testing** - Run experiments on auction parameters and ranking strategies * **Custom attribution models** - Build attribution logic that fits your business * **Real-time reporting** - Create custom dashboards using our analytics endpoints * **Multi-region deployments** - Scale across geographic regions ## Want Quick Setup Instead? While Ad Server provides maximum flexibility and control, some businesses prefer a faster path: * **Pre-built UI components** instead of custom development * **Managed campaign tools** instead of custom workflows * **Out-of-box reporting** instead of custom dashboards * **Low-code integration** instead of full API implementation If this describes your needs, explore [Ad Platform](/en/ad-platform) for pre-built tools and faster deployment. # [BETA] Create Collection Source: https://docs.topsort.com/en/api-reference/assets-api/[beta]-create-collection /openapi.json post /public/v1/assets/collection Creates a collection. # [BETA] Delete Collection Source: https://docs.topsort.com/en/api-reference/assets-api/[beta]-delete-collection /openapi.json delete /public/v1/assets/collection/{collection-id} Deletes a collection. # [BETA] Get Collection Source: https://docs.topsort.com/en/api-reference/assets-api/[beta]-get-collection /openapi.json get /public/v1/assets/collection/{collection-id} Retrieves a collection. # [BETA] Get Collections Source: https://docs.topsort.com/en/api-reference/assets-api/[beta]-get-collections /openapi.json get /public/v1/assets/collections Retrieves a list of collections. # [BETA] Update Collection Source: https://docs.topsort.com/en/api-reference/assets-api/[beta]-update-collection /openapi.json patch /public/v1/assets/collection/{collection-id} Updates a collection. # Create Asset Source: https://docs.topsort.com/en/api-reference/assets-api/create-asset /openapi.json post /public/v1/assets/asset Creates an asset. # Delete Asset Source: https://docs.topsort.com/en/api-reference/assets-api/delete-asset /openapi.json delete /public/v1/assets/asset/{asset-id} Deletes an asset. # Get Asset Source: https://docs.topsort.com/en/api-reference/assets-api/get-asset /openapi.json get /public/v1/assets/asset/{asset-id} Retrieves an asset. # Get Assets Source: https://docs.topsort.com/en/api-reference/assets-api/get-assets /openapi.json get /public/v1/assets/assets Retrieves a list of assets. # Update Asset Source: https://docs.topsort.com/en/api-reference/assets-api/update-asset /openapi.json patch /public/v1/assets/asset/{asset-id} Updates an asset. # Adjust Wallet Balance Source: https://docs.topsort.com/en/api-reference/billing-api/adjust-wallet-balance /openapi.json post /public/v1/billing-service/vendors/{external-vendor-id}/wallets/{wallet-id}/adjust Endpoint to change the balance for a wallet. It will add the amount to the wallet if the amount is positive and burn the amount if it is negative. The amount is ISO 4217 currency code compliant meaning that 100 as an input for USD marketplace will be 1 USD. # Burn Vendor Balance Source: https://docs.topsort.com/en/api-reference/billing-api/burn-vendor-balance /openapi.json post /public/v1/billing-service/vendors/{external-vendor-id}/balance/burn Endpoint to burn some amount of balance for a vendor. # Delete Vendor Billing Contact Source: https://docs.topsort.com/en/api-reference/billing-api/delete-vendor-billing-contact /openapi.json delete /public/v1/billing-service/vendors/{external-vendor-id}/vendor-billing-contact/{billing-contact-id} Endpoint to unassign a billing contact from a vendor. # Get Billing Contact Source: https://docs.topsort.com/en/api-reference/billing-api/get-billing-contact /openapi.json get /public/v1/billing-service/billing-contacts/{billing-contact-id} Endpoint to get a billing contact. # Upsert Billing Contact Source: https://docs.topsort.com/en/api-reference/billing-api/upsert-billing-contact /openapi.json put /public/v1/billing-service/billing-contacts/{billing-contact-id} Endpoint to upsert a billing contact. # Endpoint to notify events generated in topsort Source: https://docs.topsort.com/en/api-reference/endpoint-to-notify-events-generated-in-topsort /openapi.json webhook webhooks When an event is triggered we'll send you a POST request with this data. Use the Webhooks API to manage the target url and the accepted events. # [BETA] Campaign Performance Forecasts Source: https://docs.topsort.com/en/api-reference/forecasting-service/[beta]-campaign-performance-forecasts /openapi.json post /public/v1/toptimize/forecasting/campaign 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. # [BETA] Invite Vendors Source: https://docs.topsort.com/en/api-reference/invitation-api/[beta]-invite-vendors /openapi.json post /public/v1/invitation-service/invitations Invites a collection of Vendors to the Topsort platform. The request payload should contain an array of pairs of vendor's ID, and email. # Create Slot Source: https://docs.topsort.com/en/api-reference/media-api/create-slot /openapi.json post /public/v1/media-service/slots Create a new slot. # Delete Banner Fallback Source: https://docs.topsort.com/en/api-reference/media-api/delete-banner-fallback /openapi.json delete /public/v1/media-service/slots/{slot-id}/fallback Delete a banner fallback for a given slot. # Delete Slot Source: https://docs.topsort.com/en/api-reference/media-api/delete-slot /openapi.json delete /public/v1/media-service/slots/{slot-id} Delete an unused slot. # Get Slots Source: https://docs.topsort.com/en/api-reference/media-api/get-slots /openapi.json get /public/v1/media-service/slots Get slots for a given marketplace. # Toggle Slot Source: https://docs.topsort.com/en/api-reference/media-api/toggle-slot /openapi.json patch /public/v1/media-service/slots/{slot-id} Activate/Deactivate a slot. # Create a new advertiser Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/create-a-new-advertiser /openapi.json post /public/v1/offsite-ads/advertisers Create a new advertiser. # Create Campaign Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/create-campaign /openapi.json post /public/v1/offsite-ads/campaigns Create a new offsite campaign. # Create Offsite Audiences Job Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/create-offsite-audiences-job /openapi.json post /public/v1/offsite-ads/audiences/user-list Create a new offsite audience job. This endpoint creates a job to create an offsite audience alongside a presigned url to upload the audience csv file. The presigned url is valid for 1 hour and should be used to upload the audience csv file. The audience creation will begin once the csv file is uploaded. The audience CSV should contain one or more of the following columns with hashed and normalized identifiers: hashed_email, hashed_phone, hashed_first_name, hashed_last_name, hashed_mobile_device_id. Strongest identifiers are hashed_email and hashed_phone. Hashing should use the SHA256 method. The audience will be synced to the specified DSPs. # Delete Offsite Audience Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/delete-offsite-audience /openapi.json delete /public/v1/offsite-ads/audiences/{audience-id} Delete an existing offsite audience from Topsort as well as synced DSPs. # Get Active Vendors Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/get-active-vendors /openapi.json get /public/v1/offsite-ads/vendors/active Get vendors that have at least one campaign created for the given DSP. This endpoint returns a list of vendors that have at least one campaign created for the given DSP. The list is paginated and the next page token is returned in the response. The next page token can be used to get the next page of vendors. # Get advertiser onboarding state for a specific DSP Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/get-advertiser-onboarding-state-for-a-specific-dsp /openapi.json get /public/v1/offsite-ads/advertisers/{vendor-id} Get advertiser onboarding state for a specific DSP. # Get Campaign Aggregated Report Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/get-campaign-aggregated-report /openapi.json get /public/v1/offsite-ads/reporting/campaigns/{campaign-id} Get campaign report. # Get Campaign Daily Report Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/get-campaign-daily-report /openapi.json get /public/v1/offsite-ads/reporting/campaigns/{campaign-id}/daily Get campaign daily report. # Get campaign information Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/get-campaign-information /openapi.json get /public/v1/offsite-ads/campaigns/{campaign-id} Get campaign. # Get Campaign Products Report Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/get-campaign-products-report /openapi.json get /public/v1/offsite-ads/reporting/campaigns/{campaign-id}/products Get campaign products report. This endpoint returns a report of products that were advertised in a campaign. Product level report is available for Google Ads campaigns only. If the campaign is not a Google Ads campaign, It returns 404. # Get Job Status Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/get-job-status /openapi.json get /public/v1/offsite-ads/jobs/{job-id} Get job status. # Get Vendor Balances Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/get-vendor-balances /openapi.json get /public/v1/offsite-ads/vendors/balances Get vendor balances for the given vendors and DSP. # Get vendor offsite campaigns Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/get-vendor-offsite-campaigns /openapi.json get /public/v1/offsite-ads/campaigns Get vendor offsite campaigns. # List Offsite Audiences Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/list-offsite-audiences /openapi.json get /public/v1/offsite-ads/audiences List offsite audiences. # Replace Offsite Audiences Job Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/replace-offsite-audiences-job /openapi.json put /public/v1/offsite-ads/audiences/{audience-id} Replace the contents of an existing offsite audience. This endpoint returns a new job id and presigned url for uploading the replacement audience CSV. # Update Campaign Source: https://docs.topsort.com/en/api-reference/offsite-ads-api/update-campaign /openapi.json patch /public/v1/offsite-ads/campaigns/{campaign-id} Update a campaign. # Get Campaign Daily Report Source: https://docs.topsort.com/en/api-reference/reporting-api/get-campaign-daily-report /openapi.json get /public/v1/reporting-service/campaigns/{campaign-id}/daily Endpoint to get a campaign's daily behavioral summary report between given dates. # Get Campaign Report Source: https://docs.topsort.com/en/api-reference/reporting-api/get-campaign-report /openapi.json get /public/v1/reporting-service/campaigns/{campaign-id} Endpoint to get a campaign's total behavioral summary report between given dates. # Get Campaign Report By Product Source: https://docs.topsort.com/en/api-reference/reporting-api/get-campaign-report-by-product /openapi.json get /public/v1/reporting-service/campaigns/{campaign-id}/products Endpoint to get a campaign's total behavioral summary report, divided by products, between given dates. # Get Interactions Dump Urls Source: https://docs.topsort.com/en/api-reference/reporting-api/get-interactions-dump-urls /openapi.json get /public/v1/reporting-service/file-reports/interactions Get interaction files for an specific date. This endpoint returns a list of Amazon S3 pre-signed urls containing detailed interactions data in a parquet file format. The files are available after 3am UTC and contains the interactions data for the previous day. # Get Marketplace Campaigns Kpis Source: https://docs.topsort.com/en/api-reference/reporting-api/get-marketplace-campaigns-kpis /openapi.json get /public/v1/reporting-service/marketplace/campaigns-kpis Get KPIs for campaigns in a marketplace using external vendor IDs. # Get Marketplace Daily Report Source: https://docs.topsort.com/en/api-reference/reporting-api/get-marketplace-daily-report /openapi.json get /public/v1/reporting-service/marketplace/daily Endpoint to get a marketplace's daily behavioral summary report between given dates. # Get Marketplace Interactions Report Source: https://docs.topsort.com/en/api-reference/reporting-api/get-marketplace-interactions-report /openapi.json get /public/v1/reporting-service/interactions Get interactions report for a marketplace grouped by entity type. This endpoint returns detailed interaction data (impressions, clicks, purchases, etc.) aggregated by the specified entity type (vendor, campaign, or product) and time granularity (daily or hourly). Results can optionally be filtered to a single vendor or campaign. The response is paginated to handle large datasets. # Get Marketplace Report Source: https://docs.topsort.com/en/api-reference/reporting-api/get-marketplace-report /openapi.json get /public/v1/reporting-service/marketplace Endpoint to get a marketplace's total behavioral summary report between given dates. # Get Marketplace Vendors Kpis Source: https://docs.topsort.com/en/api-reference/reporting-api/get-marketplace-vendors-kpis /openapi.json get /public/v1/reporting-service/marketplace/vendors-kpis Get KPIs for vendors in a marketplace using external vendor IDs. # Get Product Daily Report Source: https://docs.topsort.com/en/api-reference/reporting-api/get-product-daily-report /openapi.json get /public/v1/reporting-service/campaigns/{campaign-id}/products/{product-id}/daily Endpoint to get a product's daily behavioral summary report between given dates. # Get Product Report Source: https://docs.topsort.com/en/api-reference/reporting-api/get-product-report /openapi.json get /public/v1/reporting-service/campaigns/{campaign-id}/products/{product-id} Endpoint to get a product's total behavioral summary report between given dates. # Get Scored Attribution Dump Urls Source: https://docs.topsort.com/en/api-reference/reporting-api/get-scored-attribution-dump-urls /openapi.json get /public/v1/reporting-service/file-reports/scored-attribution Get scored attribution files for an specific date. This endpoint returns a list of Amazon S3 pre-signed urls containing detailed attribution data in a parquet file format. The files are available after 3am UTC and contains the attribution data for the previous day. # Get Vendor Daily Report Source: https://docs.topsort.com/en/api-reference/reporting-api/get-vendor-daily-report /openapi.json get /public/v1/reporting-service/vendors/{vendor-id}/daily Endpoint to get a vendor's daily behavioral summary report between given dates. # Get Vendor Report Source: https://docs.topsort.com/en/api-reference/reporting-api/get-vendor-report /openapi.json get /public/v1/reporting-service/vendors/{vendor-id} Endpoint to get a vendor's total behavioral summary report between given dates. # Delete a segment. Source: https://docs.topsort.com/en/api-reference/segments-service/delete-a-segment /openapi.json delete /public/v1/segment-service/segments/{segment-id} Delete a segment. # Get upload users signed url for a segment. Source: https://docs.topsort.com/en/api-reference/segments-service/get-upload-users-signed-url-for-a-segment /openapi.json get /public/v1/segment-service/segments/{segment-id}/signed-url Retrieve a signed URL for uploading a segment user file. This endpoint returns a pre-signed URL that allows you to securely upload a segment user file. File requirements: - The file must be in plain text format (".txt"). - It should not contain headers. - Each line must represent a single opaque user ID. - The file must not exceed 50 MiB. The signed URL can be used to upload the file directly via an HTTP PUT request. For more information, see the [AWS documentation on uploading objects using presigned URLs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/PresignedUrlUploadObject.html). Returns ------- dict: A dictionary containing the signed URL and any additional metadata required for upload. # Retrieve a list of segments. Source: https://docs.topsort.com/en/api-reference/segments-service/retrieve-a-list-of-segments /openapi.json get /public/v1/segment-service/segments Retrieve a list of segments. # Retrieve a segment by ID. Source: https://docs.topsort.com/en/api-reference/segments-service/retrieve-a-segment-by-id /openapi.json get /public/v1/segment-service/segments/{segment-id} Retrieve a segment by its external ID. # Upload users to a segment. Source: https://docs.topsort.com/en/api-reference/segments-service/upload-users-to-a-segment /openapi.json post /public/v1/segment-service/segments/{segment-id}/upload Uploads a file with segment users. # Upsert segments with the provided information. Source: https://docs.topsort.com/en/api-reference/segments-service/upsert-segments-with-the-provided-information /openapi.json put /public/v1/segment-service/segments Upsert segments with the provided information. # Create User Source: https://docs.topsort.com/en/api-reference/user-api/create-user /openapi.json post /public/v1/user-service/advertiser-users Create a user. # Get User By Email Source: https://docs.topsort.com/en/api-reference/user-api/get-user-by-email /openapi.json get /public/v1/user-service/advertiser-users Get a user by email. # Update User Source: https://docs.topsort.com/en/api-reference/user-api/update-user /openapi.json put /public/v1/user-service/advertiser-users Update a user vendor access. This will substitute accesses, so vendor ids not present in the update will be removed. # Create Webhook Source: https://docs.topsort.com/en/api-reference/webhooks-api/create-webhook /openapi.json post /public/v1/webhooks/webhooks Creates a webhook. # Delete Webhook Source: https://docs.topsort.com/en/api-reference/webhooks-api/delete-webhook /openapi.json delete /public/v1/webhooks/webhooks/{webhook-id} Deletes the webhook. # Get Webhook Source: https://docs.topsort.com/en/api-reference/webhooks-api/get-webhook /openapi.json get /public/v1/webhooks/webhooks/{webhook-id} Returns the webhook. # Get Webhooks Source: https://docs.topsort.com/en/api-reference/webhooks-api/get-webhooks /openapi.json get /public/v1/webhooks/webhooks Returns all webhooks. # Update Webhook Source: https://docs.topsort.com/en/api-reference/webhooks-api/update-webhook /openapi.json patch /public/v1/webhooks/webhooks/{webhook-id} Updates a webhook. # Getting Started Source: https://docs.topsort.com/en/overview/getting-started Get started with your API Keys to begin integrating with Topsort First you'll get access to your Topsort sandbox. To use our low-code libraries, the main thing you need is a Marketplace API Key. It can be created in the admin dashboard, at `Account Settings > API Integration`. The Marketplace API Key is used for Actions and Events, while the Advanced API Key is used for Catalog and other APIs. Create your API keys In your Admin Dashboard, you can see logs of all API requests made with your Marketplace and Advanced APIs. View activity log as you interact with the APIs **Critical: Add budget before testing auctions!** Campaigns without sufficient budget cannot participate in auctions, leading to empty results. This is the most common integration issue. Ensure your account has a positive balance and campaigns have daily budgets set. Before running your first auctions, make sure to: * Add funds to your account balance * Set appropriate daily budgets for your campaigns * Monitor budget consumption in the dashboard # Glossary Source: https://docs.topsort.com/en/overview/glossary Complete reference of retail media terminology covering auctions, campaigns, metrics, ROAS, attribution models, and ad optimization strategies This glossary provides definitions for common terms used in retail media advertising and campaign management. ## Core Concepts The catalog contains the items that will be promoted by advertisers. For retailers, these are products sold by 1P and 3P sellers. Tools used by advertisers to promote products, enabling them to promote their catalog on the retailer's platform. Every promoted item in a campaign is eligible for auctions. An auction requests the best options to fill a placement, considering optimization parameters for advertiser performance and retailer financial goals. Purchases made by shoppers who interacted with an ad are attributed to campaigns. Parameters include attribution window and model (last click, multi-touch, etc). ## General Terms The format or style of an advertisement. Common types include: Sponsored Listings, Banner Ads, Video Ads, Native Ads, etc. The period of time in which conversions or sales are attributed to an ad. Varies by ad format: 7-14 days for Sponsored Listings, 14-30 days for Sponsored Brands, 14-30 days for Banner/Video Ads. The type of device where the ad is viewed or interacted with: Mobile Web, Desktop, or App. The specific location where the ad is displayed within a retail platform (e.g., homepage, search results, product pages). Words or phrases used by customers in search queries that trigger ad placement (e.g., "running shoes," "laptop accessories"). Internal term for the unique identifier of a product in your catalog. Also called Product ID or SKU. In the API, this is the `id` field in product objects. An anonymized user identifier used when you cannot share actual user IDs. Must be consistent across events for the same user session to enable attribution. Fraudulent or bot traffic that should be filtered from reporting. Marketplaces are responsible for filtering SIVT before sending events to Topsort. ## Performance Metrics The total number of times an ad is shown to users. The number of times users clicked on an ad for which an advertiser will be billed. The percentage of impressions that result in clicks. **Formula:** CTR = (Clicks ÷ Impressions) × 100 The average cost per click. **Formula:** Average CPC = Total Ad Spend ÷ Total Clicks The total cost of the campaign, including all ad clicks and associated charges. The total revenue generated from purchases as a result of the ad campaign. The total number of completed orders resulting from clicks on the ad. The total number of individual items sold as a result of the ad campaign. The percentage of users who completed a purchase after clicking on the ad. **Formula:** Conversion Rate = (Sales ÷ Clicks) × 100 ## Advanced Metrics The total revenue generated per dollar spent on ads. **Formula:** ROAS = Sales ÷ Total Ad Spend A ROAS of 3.0 means $3 in revenue for every $1 spent on advertising. The ROAS for the same product (SKU) that was clicked. Tracks revenue generated per dollar spent specifically on the clicked SKU. The ROAS for products from the same brand that were clicked. Used to track brand lift and halo effects. ## Cost & Pricing Models The cost per thousand impressions. A pricing model where advertisers pay for every 1,000 times their ad is shown. **Formula:** CPM = (Total Ad Spend ÷ Impressions) × 1,000 The cost an advertiser pays each time a user clicks on their ad. A performance-based pricing model where payment occurs only when the ad is clicked. **Formula:** CPC = Total Ad Spend ÷ Total Clicks The cost to acquire a customer through an ad campaign. **Formula:** CPA = Total Ad Spend ÷ Conversions (Sales) The average value of an order generated from an ad click. **Formula:** AOV = Sales ÷ Orders The average position of an ad relative to other ads in a given placement. Higher rank means better visibility. The percentage of total ad impressions captured by a brand versus competitors. **Formula:** SOV = (Your Impressions ÷ Total Market Impressions) × 100 ## Attribution Models Attribution model where the final ad click before a purchase is credited with the sale. Most common model for direct response campaigns. Attribution model where credit is given to multiple touchpoints throughout the customer journey. Useful for understanding the full path to purchase. Attribution model where credit is given to ads shown but not clicked, influencing a purchase after the fact. Common for awareness campaigns. Attribution model where a vendor receives credit when a user clicks on Product A but purchases Product B from the same vendor. Requires `vendorId` in purchase events. The unique identifier returned from an auction that connects events (impressions, clicks, purchases) back to the winning bid for attribution purposes. ## Campaign Management Changes made to bids to optimize ad placement, typically based on factors like time of day, device type, location, or keyword performance. The distribution of ad spend across different campaigns, keywords, or placements to maximize ROI. The average total spend across all campaigns or ads. **Formula:** Average Ad Spend = Total Ad Spend ÷ Number of Campaigns The unique product identifier (e.g., SKU, UPC, or ASIN) associated with the product(s) being advertised. The dimensions and format of the ad creative (e.g., 970x90, 300x250 pixels for banner ads, 16:9 for video ads). ## Ad Formats Ads that appear within product search results or category pages, typically appearing as "sponsored" or "promoted" products. High purchase intent format. Ads displayed in fixed sections of a webpage, such as at the top, side, or bottom of the page. Used for awareness and discovery. Ads designed to blend seamlessly with the content of the website or platform, making them look like part of the organic content (e.g., sponsored articles). A type of ad that allows multiple products to be displayed in a sliding format. Often used for showcasing different product variations or collections. Ads targeted at users who have previously interacted with the brand or product but have not yet converted. # Going Live Source: https://docs.topsort.com/en/overview/going-live Complete guide to preparing for and executing a smooth transition to production with comprehensive testing and monitoring strategies. Before moving to production, conduct thorough User Acceptance Tests (UAT) to ensure a smooth transition. This guide walks you through pre-launch preparation, testing procedures, deployment steps, and post-launch monitoring. **Your go-live process may vary** depending on your integration path and ad formats. This guide covers the most common scenarios, but your specific implementation may differ. For example: * **Sponsored Listings** require full catalog integration with product data * **Banner Ads** may only require vendor/advertiser setup without product-level catalog * **Placement configurations** vary based on your ad format choices Work with your Topsort contact to confirm which sections apply to your integration. ## Pre-Launch Checklist * [ ] Product feed is connected and updating regularly * [ ] All product attributes (id, name, price, image, category) are populated * [ ] Product availability is accurate * [ ] Category taxonomy is properly mapped (based on your agreed taxonomy structure) * [ ] Auction requests include all required fields * [ ] Response handling is implemented * [ ] Impression tracking fires when sponsored products are visible * [ ] Click tracking fires on product clicks (including "Add to Cart" if applicable) * [ ] Purchase events include all order details * [ ] User IDs are consistent across all events * [ ] Vendors/advertisers are configured in the system * [ ] Placements or JSON templates are created in the system * [ ] Banner creative assets are uploaded and approved * [ ] Click-through URLs are configured correctly * [ ] (Optional) content standards are uploaded to the system * [ ] Auction requests include all required fields * [ ] Banner placement IDs are correctly configured * [ ] Response handling returns banner creative data * [ ] Banner rendering logic is implemented * [ ] Impression tracking fires when banner is visible * [ ] Click tracking fires on banner clicks * [ ] User IDs are consistent across all events ### Common Configuration (All Ad Formats) **API Credentials:** * [ ] Sandbox API keys are properly configured * [ ] Production API keys are ready (don't switch yet) * [ ] API keys are stored securely in environment variables * [ ] Key rotation process is documented **Environment Setup:** * [ ] Staging environment mirrors production configuration * [ ] All API endpoints are configured correctly * [ ] Timeout values are appropriate (recommended: 500-1000ms) * [ ] Error handling is implemented **Ad Display:** * [ ] Ad placements render correctly on all device types * [ ] Ad labels are clearly visible (see labeling guidelines below) * [ ] Ad images/creatives load properly with fallbacks * [ ] Click-through behavior works as expected **Performance:** * [ ] Page load times are acceptable with ads * [ ] Ads don't block critical page rendering * [ ] Mobile experience is optimized (touch targets, responsive layouts, fast load times) * [ ] Accessibility requirements are met **Instrumentation:** * [ ] Error tracking is configured (Sentry, Datadog, etc.) * [ ] Performance monitoring is in place * [ ] Custom dashboards are set up * [ ] Alerting thresholds are defined **Logging:** * [ ] API request/response logging is enabled * [ ] Error logs are being captured * [ ] Audit trail for ad events is configured * [ ] Log retention policies are set ### Ad Labeling Guidelines Use labels that clearly indicate promotional content while avoiding ad-blocker triggers: * **"Featured"** * **"Recommended"** * **"Client's Choice"** * **"Top Pick"** Avoid using "Sponsored" or "Ad" as these terms are commonly targeted by ad blockers. If operating in the European Union, the **Digital Services Act (DSA)** requires: * [ ] Clear labeling that content is an advertisement * [ ] Display of the advertiser name in ad details * [ ] Transparency about why the ad was shown to the user Work with your legal team to ensure full DSA compliance. ## User Acceptance Testing (UAT) ### 1. Catalog Testing **In Topsort Admin Panel:** 1. Navigate to Catalog section 2. Verify products are visible and searchable 3. Check that product data is complete: * Product names, images, and prices are correct * Categories are properly assigned * Product availability status is accurate **Test Campaign Creation:** 1. Create a new test campaign named `UAT-TEST-[DATE]` 2. Try adding products to the campaign 3. Verify product search and filtering works 4. Confirm product selection saves correctly **Expected Result:** All products should be selectable when creating campaigns, with accurate and complete information. **In Topsort Admin Panel:** 1. Navigate to Vendors/Advertisers section 2. Verify vendors are configured correctly 3. Verify click-through URLs are correct **Test Campaign Creation:** 1. Create a new test campaign named `UAT-TEST-[DATE]` 2. Select banner ad format 3. Configure targeting and bid settings 4. Activate the campaign **Expected Result:** Banner campaigns should be creatable with proper creative assets and targeting options. ### 2. Auctions & Events Testing **Setup:** * Create `UAT-TEST` campaign with 3-5 products * Set high bid amount (\$10+) to ensure wins * Activate the campaign **Test Scenarios:** 1. Verify auction request is sent 2. Check that winning products are returned 3. Confirm products render on page **Validation:** * Check browser network tab for API calls * Verify auction response contains products * Ensure resolvedBidId is captured for event tracking **Test All Event Types:** **Impression Events:** * Load page with sponsored products * Verify impression event fires when ad is visible * Check resolvedBidId is included **Click Events:** * Click on sponsored product * Verify click event fires immediately * **Note:** "Add to Cart" actions also count as clicks if configured * Confirm navigation/action works correctly **Purchase Events:** * Complete a purchase with sponsored product * Verify purchase event includes: * Product ID and quantity * Order value and order ID * **User ID** (required for attribution) **Setup:** * Create `UAT-TEST` banner campaign * Set high bid amount to ensure wins * Activate the campaign **Test Scenarios:** 1. Load page with banner placement 2. Verify auction request is sent 3. Check that winning banner creative is returned 4. Confirm banner renders correctly on page **Validation:** * Check browser network tab for API calls * Verify auction response contains banner data * Ensure resolvedBidId is captured for event tracking **Test All Event Types:** **Impression Events:** * Load page with banner placement * Verify impression event fires when banner is visible * Check resolvedBidId is included **Click Events:** * Click on banner * Verify click event fires immediately * Confirm click-through URL navigation works **Note:** Purchase events may not apply to banner-only integrations unless you're tracking downstream conversions. **Test with Two Different Users:** Perform all tests with at least two unique user sessions to verify proper user tracking and attribution. ### 3. Data Validation **For Each Test User:** * Take screenshots of ad placements * Capture network requests showing API calls * Document order details for purchase events (if applicable) * Note timestamps for each action Send the following to your Topsort contact: * Screenshots of ad impressions * Network logs showing auction and event calls * Test campaign name and time range * User identifiers used in testing Topsort will provide a summary including: * Total auctions received * Impression and click counts * Purchase counts (for listing ad integrations) * Data quality score * Any data discrepancies or issues **Verify Alignment:** * Numbers match your test actions * Attribution chain is complete * No missing or duplicate events ## Production Deployment ### Deployment Steps **Option 1: Product Feed** * Share your production feed URL with Topsort * Ensure feed is accessible and updates regularly * Recommended update frequency: Every 15-60 minutes **Option 2: Catalog API** * Use the [Catalog API](/en/ad-server/catalog/) for real-time updates * Implement create, update, and delete operations * Set up scheduled full catalog sync **Verify:** * Product count matches expectations * All required fields are populated * Images are loading correctly **Vendor Setup:** * Confirm all vendors/advertisers are configured * Verify banner creatives are uploaded and approved * Check click-through URLs are production-ready **Verify:** * All active vendors are visible in admin * Banner creatives display correctly * Targeting options are configured **Using Topsort UI:** 1. Topsort provides admin panel credentials 2. You receive production API URL 3. [Generate API keys](/en/api-reference/authentication) in admin 4. Store keys securely in production environment **Using Custom UI:** 1. Receive production API URL from Topsort 2. Receive production API key(s) 3. Configure keys in your environment **Never commit API keys to version control.** Use environment variables or secure secret management systems. **Pre-Deployment:** * Review all code changes one final time * Ensure sandbox credentials are parameterized * Confirm rollback procedure is documented * Schedule deployment during low-traffic period **Deployment Process:** 1. Deploy code to production environment 2. Update environment variables with production credentials 3. Restart services to pick up new configuration 4. Verify application starts successfully **Immediate Verification:** * Check application logs for errors * Test basic functionality (page loads) * Verify API connectivity ### Traffic Ramping Strategy **Recommended Approach:** **Day 1-2:** 10% of traffic * Monitor closely for errors * Validate data accuracy * Check performance metrics **Day 3-5:** 50% of traffic * Compare metrics with baseline * Ensure system stability * Fine-tune if needed **Day 6+:** 100% of traffic * Full production launch * Continue monitoring * Optimize performance **Use Feature Flags to Control:** * Which placements show ads * Percentage of users seeing ads * A/B testing configurations * Emergency kill switch **Benefits:** * Instant rollback without deployment * Gradual rollout control * Per-placement configuration * Reduced deployment risk ## Post-Launch Monitoring ### Critical Metrics to Monitor **API Performance:** * Auction API response time (target: \<500ms p95) * Event API success rate (target: >99.5%) * Error rates and types * API timeout frequency **Application Performance:** * Page load time impact * Time to first ad render * JavaScript errors * Memory usage patterns **Action Items if Issues Detected:** * Response time >1s: Review timeout settings * Error rate >1%: Check API credentials and network * High JS errors: Review client-side implementation **Event Tracking:** * Impression-to-click ratio (typical: 1-5%) * Click-to-purchase ratio (typical: 2-10%, for listing ads) * Event volume consistency * Attribution completeness **Data Integrity:** * User IDs are present and consistent * resolvedBidIds are captured for impressions and clicks * Purchase amounts are reasonable (listing ads) * Duplicate events are minimal **Dashboard Checks:** * Compare Topsort dashboard with your analytics * Verify revenue attribution matches * Check for data gaps or spikes **Campaign Performance:** * Total impressions delivered * Click-through rate (CTR) * Conversion rate (listing ads) * Return on ad spend (ROAS) **User Experience:** * Ad viewability rates * User engagement with ads * Impact on organic conversion rate * Page bounce rate changes **Revenue Impact:** * Incremental revenue from ads * Average order value changes * Vendor adoption rate * Campaign creation velocity ### Troubleshooting Common Issues **Possible Causes:** * No active campaigns * Bid amounts too low * Product targeting too narrow * Auction API errors **Debugging Steps:** 1. Check browser console for errors 2. Verify auction API response 3. Confirm campaigns are active 4. Review targeting criteria **Possible Causes:** * Event not triggered on checkout * Missing user ID in event payload * Incorrect product ID format * Network failures **Debugging Steps:** 1. Test purchase flow manually 2. Check event payload structure 3. Verify user ID is included 4. Review server logs **Possible Causes:** * No active banner campaigns * Bid amounts too low * Banner creative not approved * Auction API errors **Debugging Steps:** 1. Check browser console for errors 2. Verify auction API response 3. Confirm campaigns are active 4. Check creative approval status **Possible Causes:** * Creative URL inaccessible * Image format not supported * CORS issues * Container sizing issues **Debugging Steps:** 1. Check creative URL directly 2. Verify image loads in browser 3. Check network tab for CORS errors 4. Review container CSS **Possible Causes:** * Slow API responses * Blocking auction calls * Large image files * Too many placements **Solutions:** 1. Implement proper timeouts 2. Use async/non-blocking calls 3. Optimize image loading 4. Cache auction responses **Possible Causes:** * Double-counting events * Missing attribution chain * Time zone mismatches * Bot traffic **Investigation:** 1. Compare raw event counts 2. Check for duplicate IDs 3. Verify timezone handling 4. Review user agent filtering ## Best Practices **Internal Coordination:** * Notify engineering team of deployment * Alert customer support of new features * Update sales team on capabilities **External Communication:** * Coordinate with Topsort team * Schedule launch calls * Establish escalation paths **Maintain:** * Deployment runbooks * Rollback procedures * API integration specs * Troubleshooting guides **Keep Updated:** * Configuration changes * Known issues and workarounds * Performance benchmarks **Continuous Improvement:** * Review performance weekly * Optimize slow queries * Refine targeting * Test new placements **A/B Testing:** * Ad placement positions * Number of ads per page * Ad formats and styles * Targeting strategies **Establish:** * On-call rotation * Incident response process * Topsort escalation contacts * SLA expectations **Document:** * Common support scenarios * Resolution procedures * Contact information *** Once you're live, you're ready to start optimizing. Reach out to your Topsort contact for guidance on campaign strategies, attribution tuning, and advanced configurations. # Welcome to Topsort Source: https://docs.topsort.com/en/overview/index Discover Topsort's integration options and core products to launch, scale, and optimize your retail media business with privacy-focused, flexible, and AI-powered solutions
This guide provides information on Topsort's suite of products designed to enhance the growth of your retail media networks. You can choose the module and integration path that best suits your needs. This Integration Guide contains all the details you need to get started with Topsort's offerings. For in-depth explanations of features and concepts, visit the [**Knowledge Base**](/en/knowledge-base/).
Consider this your essential resource for launching, scaling, and optimizing your retail media business. Whether you are new to advertising, upgrading existing systems, or aiming to improve results with AI-powered tools, you will find the necessary technical information here to connect with Topsort's infrastructure.
## What is Topsort's Retail Media Infrastructure
Topsort enables the creation of a unique advertising ecosystem through four core components:
A comprehensive, ready-to-use solution for launching, growing, and activating your advertising business. It includes tools for managing campaigns, viewing reports, tracking results, and integrating ad displays.
Offers powerful APIs for customizing ads and integrating with existing systems and software. This ensures a seamless experience for sellers while allowing them to control ad relevance, audience targeting, and performance improvement.
Provides smart tools and individual components to enhance your ad system, including solutions for forecasting, retrieval, and attribution to address challenges common to large online platforms.
Topsort's DSP for advertising agencies and brands, enabling campaign management across multiple online retailers from a centralized platform with real-time data and AI-powered enhancements.
## Choosing the Right Path
* For those new to retail media, start with the [**Ad Platform's low-code tools**](/en/ad-platform/).
* For building custom logic, explore the [**Ad Server APIs**](/en/ad-server/).
* For programmatic scaling, utilize [**Toppie for demand-side expansion**](/en/toppie/).
* For migrating systems, review [**fallback strategies and A/B testing guidelines**](/en/advanced-integrations/).
Topsort offers state-of-the-art, privacy-focused technology to help retailers build and expand their ad businesses. To accommodate various technical skills and preferences, two main integration methods are available:
* **Low-Code Integration**: Offers a simpler, more direct setup.
* **Full API-First Integration**: Provides maximum flexibility and customization.
Regardless of the chosen integration path, Topsort equips you with the tools to monetize through an omnichannel ad system. Each integration component is designed to assist in managing, understanding, and improving your advertising strategies.
For detailed guides, step-by-step instructions, and personalized support, please contact our technical support team via the [**Support Portal**](https://help.center.topsort.com/servicedesk/customer/portal/1).
We are committed to ensuring a smooth integration process and helping you maximize the potential of your inventory.
# Integration Overview Source: https://docs.topsort.com/en/overview/integration-overview An overview to the integration process There are core elements of a successful Topsort integration. First, gain access to your Topsort sandbox from your Topsort representative. Based on your product access, you will be able to have API keys that will unlock the following key components of a product integration: Obtain API keys (Marketplace for low-code, Advanced for catalog/CRM) from your Topsort dashboard.
Topsort offers two integration approaches to fit your technical requirements and timeline:
* **Low-code integration ([Ad Platform](/en/ad-platform))**: Use our pre-built SDKs, libraries, and plugins for fast implementation and minimal development effort. Perfect for marketplaces that want to launch quickly.
* **API-first integration ([Ad Server](/en/ad-server))**: Leverage our powerful set of public APIs to gain full control of your ad setup. Ideal for enterprises with in-house teams and custom requirements.
| Feature | Ad Platform (Low-Code) | Ad Server (API-First) | | ----------------------- | ------------------------------- | ------------------------------ | | **Setup Time** | Days to weeks | Weeks to months | | **Development Effort** | Minimal | Significant | | **Customization** | Standard features only | Full control over all aspects | | **Target Audience** | Marketplaces, product teams | Enterprises, technical teams | | **Campaign Management** | Pre-built UI and tools | Build your own interface | | **Ad Formats** | Banners, sponsored listings | Any format you design | | **Best For** | Quick launch, standard features | Custom logic, deep integration |
**Choose [Ad Platform](/en/ad-platform) if you:** * Want to launch retail media quickly with minimal development * Prefer pre-built campaign management tools and reporting dashboards * Need standard banner ads and sponsored product listings * Have limited in-house development resources * Want to use platform plugins (VTEX, Salesforce) for easy integration
**Choose [Ad Server](/en/ad-server) if you:** * Need complete control over auction logic and ranking algorithms * Have in-house engineering teams to build custom solutions * Require deep integration with proprietary systems * Want to implement custom ad formats or unique workflows * Need advanced features like custom attribution models or A/B testing frameworks
Use built-in logging and staging environments to monitor requests. Deploy to production and leverage Topsort's analytics for optimization.
# Pick an integration path Source: https://docs.topsort.com/en/overview/pick-an-integration-path Choose between Low Code Integration with SDKs for quick setup, or API-first integration for full customization and control We offer two integration paths, depending on which ad formats you plan on integrating (banners, listings), how much customization you need and how fast you want to go live. If you're going for a simple ad platform integration, we recommend **Low Code Integration** using our SDKs and libraries. The libraries we offer include: * **[Banners.js](/en/ad-platform/banners/bannersjs)**: for rendering banner ads. Can also be injected using [Google Tag Manager](/en/ad-platform/banners/google-tag-manager). * **[Analytics.js](/en/ad-platform/listings/analytics-js)**: for tracking clicks, impressions and purchases. * **[Javascript SDK](/en/ad-platform/sdks/javascript-sdk)**: optional low-code wrapper for auctions and events. * **[Topsort Proxy](/en/ad-platform/listings/topsort-proxy)**: handles injection of auction winners into your catalog or search engine results. If you're going for an ad server integration and ad intelligence, we recommend an **API-first integration path**. APIs offered today: * **[Catalog API](/en/ad-server/catalog)**: keep Topsort up-to-date with your catalog changes. * **[Auctions API](/en/ad-server/auctions/auctions-api)**: request winners for banners or listings. * **[Events API](/en/ad-server/events/events-api)**: track clicks, impressions and purchases. Additional APIs: * **[Invitation API](/en/ad-server/additional-apis/invitation-api)**: invite advertiser users to the platform. * **[User API](/en/ad-server/additional-apis/user-api)**: manage advertiser users. * **[Reporting API](/en/ad-server/additional-apis/reporting-api)**: get granular reporting about your campaigns. * **[Campaign API](/en/ad-server/additional-apis/campaign-api)**: create and update banner and listing campaigns. * **[Segments API](/en/ad-server/additional-apis/segments-api)**: create and manage user segments, for campaign targeting. * **[Webhooks API](/en/ad-server/additional-apis/webhooks-api)**: create and manage webhooks, for personalized campaign events. * **[Billing API](/en/ad-server/additional-apis/billing)**: top-up vendor, create wallets, add and manage billing contacts. * **[Assets API](/en/ad-server/additional-apis/assets-api)**: create and manage assets like images and videos. * **[Offsite API](/en/ad-server/additional-apis/offsite)**: manage advertisers, campaigns and metrics related to offsite campaigns. # Segments API Source: https://docs.topsort.com/en/ad-server/additional-apis/segments-api Integrate with our Segments API Topsort's [Segments API](/en/api-reference/segments-service) allows our clients to create and manage groups of users for targeting purposes. After creating segments on our platform, they can be used as targeting in the campaign creation. ## Uploading Users to a Segment Once a segment is created, users can be uploaded to it using our APIs. Topsort support three actions: * **Add**: Append new users to the existing segment, without making changes to existing ones. * **Remove**: Delete specific users from the segment. * **Replace**: Overwrite the entire segment with a new user list User lists must follow this specification: * File format is .txt * No headers * One Opaque User ID per row, without emails or personal information. ## Use in Campaigns Segments are used as targeting options in campaigns. The same Opaque User ID uploaded to the segments should be used on the auction request, to guarantee the auction engine can match it with the corresponding segment. # User API Source: https://docs.topsort.com/en/ad-server/additional-apis/user-api Integrate with our User API More APIs to customize your exact workflow and build your preferred version of an ad business. Check the complete documentation of our [User API](/en/api-reference/user-api). With this API, you can manage advertisers and vendors user accounts. Create, retrieve, and update users via email. Assign or modify vendor-level permissions. Useful for managing team access and roles. # Webhooks API Source: https://docs.topsort.com/en/ad-server/additional-apis/webhooks-api Integrate with our Webhooks API Topsort's [Webhooks API](/en/api-reference/webhooks-api) allows you to configure webhooks for receiving automated notifications about specific events, such as campaign updates. With this API you can: * Subscribe to platform events (e.g. campaign updates). * Create, update, delete, and retrieve webhook configurations # Fallback and A/B Testing Source: https://docs.topsort.com/en/advanced-integrations/index Run Topsort alongside existing ad servers with fallback logic If the retailer already is running ads using an ad server, it is possible to run it alongside Topsort using a fallback logic. This allows retailers to compare ad servers performance and increase fill-rates. ## Use Cases Use a secondary ad server when Topsort returns no winners, ensuring maximum fill rate Compare ad server performance using audience segments or traffic splits ## How It Works For instance, if the retailer is running banner ads using GAM (Google Ad Manager), they can set Topsort as the primary ad server to make sure their direct sold campaigns have priority over GAM's demand. Ad requests and interactions coming from ads not served by Topsort can be reported to Topsort to see and compare metrics in one place. Set up Topsort as your primary ad server using any of the integration methods (API, SDK, or low-code). Always request an ad from Topsort first in your ad serving logic. If Topsort returns winners, display the Topsort ad. If no winners are returned, request an ad from your secondary ad server. ## Implementation Example ```javascript theme={null} async function displayAd() { try { const response = await fetch("https://api.topsort.com/v2/auctions", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ // Your auction request parameters }), }); const auctionData = await response.json(); if (auctionData?.results?.winners) { console.log("Topsort ad displayed."); return; // Exit early - Topsort ad is displayed } else { console.log("No Topsort ad available."); } } catch (error) { console.error("Error fetching Topsort ad:", error); } // Fallback to secondary network if (secondaryNetwork) { // Render ad from secondary network console.log("Displaying secondary ad."); } else { console.warn("No secondary ad network configured."); } } displayAd(); ``` ## A/B Testing Approach For A/B testing, modify the selection logic using: * **Audience Segments** - Route specific user segments to different ad servers * **Traffic Split** - Randomly assign a percentage of traffic to each ad server Report all ad interactions (including from secondary ad servers) to Topsort to compare metrics in one unified dashboard. # Documentation MCP Server Source: https://docs.topsort.com/en/api/mcp Integrate our MCP server with your agents to become productive in no time The **Model Context Protocol (MCP)** is an open-source standard for connecting AI applications to external systems. Topsort provides an MCP server through Mintlify that gives AI assistants direct access to our complete API documentation, enabling them to provide accurate, up-to-date information about our APIs. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect devices, MCP provides a standardized way to connect AI applications to external data sources like our API documentation. Looking for real-time analytics and campaign insights? Check out our [Analytics MCP Server](/api/mcp-analytics) for direct access to advertising metrics, benchmarks, and visualizations. ## What You Can Do By connecting to Topsort's MCP server, AI assistants can: * **Access complete API documentation** - Query endpoint details, parameters, request/response schemas, and examples * **Get accurate integration guidance** - Receive up-to-date code examples and implementation instructions * **Troubleshoot faster** - Quickly reference error codes, rate limits, and authentication methods * **Stay current** - Always access the latest API documentation without manual updates ## Quick Start Our MCP server is available at: ``` https://docs.topsort.com/mcp ``` The MCP server is publicly accessible and doesn't require authentication. However, you'll need API keys to actually use the Topsort API in your applications. ## Integration Guides Use MCP with GitHub Copilot in Visual Studio Code Connect ChatGPT to access Topsort documentation Configure Claude Desktop for local development Cursor, Windsurf, Continue, and more ## VS Code with GitHub Copilot GitHub Copilot supports MCP servers in both the coding agent and the chat interface. ### Prerequisites * **VS Code** version 1.95.0 or later * **GitHub Copilot** extension installed and activated * **GitHub Copilot Chat** extension installed ### Configuration Press `Cmd+,` (Mac) or `Ctrl+,` (Windows/Linux) to open Settings. Search for "MCP" in the settings search bar, or navigate to **Extensions** > **GitHub Copilot** > **MCP**. Click **Edit in settings.json** and add: ```json theme={null} { "github.copilot.chat.mcp.servers": { "topsort": { "type": "http", "url": "https://docs.topsort.com/mcp" } } } ``` Press `Cmd+Shift+P` (Mac) or `Ctrl+Shift+P` (Windows/Linux), type "Developer: Reload Window" and press Enter. ## ChatGPT ChatGPT supports remote MCP servers for Plus and Team subscribers. Navigate to [chat.openai.com](https://chat.openai.com) and click your profile icon, then select **Settings**. Click on **Connections** or **Integrations** in the settings sidebar. Click **Add Connection** and enter: - **Name**: `Topsort API Documentation` * **Server URL**: `https://docs.topsort.com/mcp` - **Transport Type**: `http` ## Claude Desktop Claude Desktop provides comprehensive local MCP support. ### Prerequisites * **Node.js** installed on your system (required for `mcp-remote`) ### Configuration * **macOS**: Click **Claude** in the menu bar → **Settings** * **Windows**: Click **File** → **Settings** Click on the **Developer** tab in the left sidebar. Click **Edit Config** and add: ```json theme={null} { "mcpServers": { "topsort-docs": { "command": "npx", "args": [ "mcp-remote", "https://docs.topsort.com/mcp" ] } } } ``` Save the configuration and restart Claude Desktop. ## Other MCP Clients ### Cursor Add to your Cursor settings: ```json theme={null} { "mcp": { "servers": { "topsort": { "type": "http", "url": "https://docs.topsort.com/mcp" } } } } ``` ### Windsurf Editor Configure in `~/.codeium/windsurf/mcp_config.json`: ```json theme={null} { "mcpServers": { "topsort-docs": { "command": "npx", "args": [ "mcp-remote", "https://docs.topsort.com/mcp" ] } } } ``` Windsurf requires the `mcp-remote` package to connect to remote MCP servers. Ensure Node.js is installed on your system. ### Continue Add to `~/.continue/config.json`: ```json theme={null} { "mcpServers": { "topsort": { "transport": { "type": "http", "url": "https://docs.topsort.com/mcp" } } } } ``` ### Cline Configure in `~/Documents/Cline/MCP/config.json`: ```json theme={null} { "topsort": { "type": "http", "url": "https://docs.topsort.com/mcp" } } ``` ## Troubleshooting ### Connection Issues * Verify the URL is correct: `https://docs.topsort.com/mcp` * Check your internet connection * Restart your MCP client application * Review client-specific logs for error messages ### Server Not Responding * Verify the transport type is set to `http` * Check if your firewall or VPN is blocking the connection * Check [our status page](https://status.topsort.com) for any service disruptions While the MCP server itself doesn't require authentication, you'll still need valid API keys to actually use the Topsort API in your applications. Never share your API keys in conversations or commit them to version control. ## Learn More * [Model Context Protocol Documentation](https://modelcontextprotocol.io) * [MCP Client List](https://modelcontextprotocol.io/clients) * [Topsort API Documentation](https://api.docs.topsort.com) # Analytics MCP Server Source: https://docs.topsort.com/en/api/mcp-analytics Connect your AI agents to Topsort's advertising platform for real-time analytics and catalog operations The **Model Context Protocol (MCP)** is an open standard for connecting AI applications to external systems—think of it as a USB-C port for AI. Our Analytics MCP server gives your AI assistants direct access to Topsort's advertising analytics and catalog APIs. Looking for documentation access instead? Check out our [Documentation MCP Server](/api/mcp) for AI-assisted API integration guidance. ## What You Can Do By connecting to Topsort's Analytics MCP server, AI assistants can: * **Analyze advertising performance** - Query real-time metrics like CTR, CVR, ROAS, CPC, and ad spend across campaigns or marketplaces * **Monitor campaign health** - Check budget utilization, bidding behavior, quality scores, and pacing in real-time * **Compare performance over time** - Run week-over-week, month-over-month, or custom period comparisons to identify trends and anomalies * **Benchmark against industry** - Compare campaign metrics against category benchmarks (retail, pharmacy, travel, etc.) * **Visualize insights** - Generate line, bar, and pie charts from any analytics data for easy interpretation * **Get Topsort guidance** - Answer questions about API integration, troubleshooting, and platform best practices All queries can be scoped to a specific vendor, ensuring advertisers only access their own data while marketplace operators can view aggregate insights. ## Quick Start Our Analytics MCP server is available at: ``` https://mcp-server.api.topsort.ai/mcp ``` This MCP server requires authentication. Contact your Topsort sales representative to request an API key with MCP Server access. ## Authentication ### Marketplace Authentication All requests must include a valid API key. For MCP clients that use `mcp-remote` (like Claude Desktop), pass the key via the `--header` argument: ```json theme={null} { "mcpServers": { "topsort-analytics": { "command": "npx", "args": [ "mcp-remote", "https://mcp-server.api.topsort.ai/mcp", "--header", "X-API-Key: MPS_xxxx" ] } } } ``` ### Vendor ID Filtering Tool results can be filtered for specific vendors by including the Vendor ID in the request header. This restricts the scope of all tools, preventing data leakage across vendors: ```json theme={null} { "mcpServers": { "topsort-analytics": { "command": "npx", "args": [ "mcp-remote", "https://mcp-server.api.topsort.ai/mcp", "--header", "X-API-Key: MPS_xxxx", "--header", "X-Vendor-Id: 1111-2222-3333-4444-55555" ] } } } ``` ## Tool Filtering Tags enable fine-grained access control over which tools are available to different clients. Each tool can be annotated with one or more tags, and clients are assigned their own set of tags. When retrieving tools, the system filters the list by checking for any overlap between the client's tags and each tool's required tags—a client only needs one matching tag to gain access. ## Integration Guides Connect ChatGPT to Topsort analytics Configure Claude Desktop with authentication Test the MCP server with Postman ## ChatGPT ChatGPT supports remote MCP servers for Plus and Team subscribers. Navigate to [chat.openai.com](https://chat.openai.com) and click your profile icon, then select **Settings**. Click on **Connections** or **Integrations** in the settings sidebar. Click **Add Connection** and enter: * **Name**: `Topsort Analytics` * **Server URL**: `https://mcp-server.api.topsort.ai/mcp` * **Transport Type**: `http` * **Headers**: Add `X-API-Key` with your API key ## Claude Desktop Claude Desktop provides comprehensive local MCP support. ### Prerequisites * **Node.js** installed on your system (required for `mcp-remote`) ### Configuration * **macOS**: Click **Claude** in the menu bar → **Settings** * **Windows**: Click **File** → **Settings** Click on the **Developer** tab in the left sidebar. Click **Edit Config** and add: ```json theme={null} { "mcpServers": { "topsort-analytics": { "command": "npx", "args": [ "mcp-remote", "https://mcp-server.api.topsort.ai/mcp", "--header", "X-API-Key: MPS_xxxx" ] } } } ``` Replace `MPS_xxxx` with your actual API key. For vendor-scoped access, add an additional `--header` argument: ```json theme={null} { "mcpServers": { "topsort-analytics": { "command": "npx", "args": [ "mcp-remote", "https://mcp-server.api.topsort.ai/mcp", "--header", "X-API-Key: MPS_xxxx", "--header", "X-Vendor-Id: 1111-2222-3333-4444-55555" ] } } } ``` Save the configuration and restart Claude Desktop. ## Postman You can test the Analytics MCP server using Postman's MCP support. Launch Postman and navigate to **Settings** → **MCP Servers**. Click **Add Server** and configure: * **Name**: `Topsort Analytics` * **URL**: `https://mcp-server.api.topsort.ai/mcp` Add the required headers: * `X-API-Key`: Your Topsort API key * `X-Vendor-Id`: (Optional) Vendor ID for scoped access Click **Test Connection** to verify the server is responding correctly. ## Troubleshooting ### Connection Issues * Verify the URL is correct: `https://mcp-server.api.topsort.ai/mcp` * Ensure your API key is valid and has MCP Server access * Check your internet connection * Restart your MCP client application ### Authentication Errors * Confirm your API key starts with `MPS_` * Verify the `X-API-Key` header is correctly formatted * Contact your Topsort sales representative if your key is rejected ### Server Not Responding * Verify the transport type is set to `http` * Check if your firewall or VPN is blocking the connection * Check [our status page](https://status.topsort.com) for any service disruptions ## Learn More * [Model Context Protocol Documentation](https://modelcontextprotocol.io) * [MCP Client List](https://modelcontextprotocol.io/clients) * [Topsort API Documentation](/api-reference) * [Documentation MCP Server](/api/mcp) - For AI-assisted API integration # Ad Format Configuration Source: https://docs.topsort.com/en/knowledge-base/ad-platform/ad-format-configuration Configure charge types, self-service access, and view campaigns for each ad format
Each ad format in Topsort has a dedicated configuration page in the **Admin Dashboard** where marketplace operators can view campaigns, set charge types, and control self-service vendor access — all without needing to contact an account manager.
## Overview
Ad Format pages are available under **Ad Formats** in the Admin Dashboard sidebar. Each page shows every campaign running for that ad format and provides controls for charge type and self-service access.
View all campaigns for a given ad format in one place — active, paused, and completed. Choose how advertisers are charged: CPC, CPM, or CPA depending on the ad format. Control whether vendors can create campaigns for an ad format on their own, or restrict access at the marketplace or vendor level. Make configuration changes instantly, directly from the dashboard. ## Ad Format Pages ### Sponsored Listings
Sponsored Listings promote individual products within search results and category pages. The configuration page supports the widest range of charge types.
| Setting | Options | | ----------------------- | ---------------------------------- | | **Charge type** | CPC, CPM, or CPA | | **Self-service access** | Enabled by default for all vendors | ### Banners
Banner ads are display creatives placed in dedicated slots across the marketplace. Marketplace operators can restrict which vendors are allowed to create banner campaigns through self-service.
| Setting | Options | | ----------------------- | ----------------------------------------------------------- | | **Charge type** | CPC or CPM | | **Self-service access** | Restrict for the entire marketplace or by individual vendor | ### Brands
Sponsored Brands campaigns feature brand-level creatives with multiple products. Self-service access can be restricted at the marketplace or vendor level.
| Setting | Options | | ----------------------- | ----------------------------------------------------------- | | **Charge type** | CPC or CPM | | **Self-service access** | Restrict for the entire marketplace or by individual vendor | ### Videos
Video ads allow vendors to run video creatives in designated placements. Access controls work the same as Banners and Brands.
| Setting | Options | | ----------------------- | ----------------------------------------------------------- | | **Charge type** | CPC or CPM | | **Self-service access** | Restrict for the entire marketplace or by individual vendor | ## How to Configure an Ad Format In the Admin Dashboard sidebar, go to **Ad Formats** and select the format you want to configure (Sponsored Listings, Banners, Brands, or Videos). The page displays all campaigns for that ad format. Use this to understand current campaign activity before making changes. Select the charge type that fits your monetization strategy. Available options depend on the ad format. For Banners, Brands, and Videos, choose whether to allow all vendors to create campaigns via self-service, restrict access for the entire marketplace, or restrict access for specific vendors. Sponsored Listings are enabled for self-service by default for all vendors. ## Charge Type Reference | Charge Type | Description | | ------------------------- | --------------------------------------------------------------------------------- | | **CPC** (Cost Per Click) | Advertisers are charged each time a user clicks on the ad | | **CPM** (Cost Per Mille) | Advertisers are charged per 1,000 impressions | | **CPA** (Cost Per Action) | Advertisers are charged when a conversion is attributed (Sponsored Listings only) | ## Self-Service Access Reference | Ad Format | Default | Restriction Options | | ---------------------- | ----------------------- | ------------------------------- | | **Sponsored Listings** | Enabled for all vendors | Not restrictable | | **Banners** | Configurable | Entire marketplace or by vendor | | **Brands** | Configurable | Entire marketplace or by vendor | | **Videos** | Configurable | Entire marketplace or by vendor | *** # Using Assets Source: https://docs.topsort.com/en/knowledge-base/ad-platform/assets/index Managing assets
Topsort supports many types of assets that can be used in campaigns. See below for supported asset types.
## How It Works ### Uploading Assets
While creating a campaign, you can upload assets to banner or sponsored brand campaigns. These assets can be images, videos, html or externally hosted files (a url). These assets will be returned as part of a winning auction and suitable for inclusion in the ad creative.
You can also use our [Assets API](/en/api-reference/assets-api), to create and manage assets without necessarily using them in campaigns.
### Supported Asset Types
We support the following asset types:
* **Images**: PNG, JPEG, GIF and WEBP. * **Video**: MP4, WEBM, MOV. * **External URL** (can be anything you want to use from a third party service) * **HTML**: HTML code that can be used to render a custom creative. We return the link to said HTML file which you can include via an `