Skip to main content

Engage External ID API V2

Overview​

This API describes the interfaces for interacting with the Teads Engage Reports product. More information about Engage can be found on the website: https://www.outbrain.com/engage

The API is RESTful and is structured into the following core entities:

  • Publisher: A publisher account
  • Report: A variety of analytics entities to retrieve metrics

The following operations may be performed via this API:

EntityFunction
PublishersRead
WidgetsRead
Report - External IdRead

Note: Report refers to External Id Report V2 per hour.

HTTP Methods​

HTTP MethodAction
GETRetrieve a resource or a list of resources

HTTP Status Code Replies​

HTTP Status CodeMeaningDescription
200OKThe request was successful
400Bad RequestThe request could not be understood or was missing required parameters
401UnauthorizedAuthentication failed or user doesn't have permissions for requested operation
403ForbiddenAccess denied
404Not FoundResource was not found
429Too Many RequestsRequest exceeded rate limits
504Gateway TimeoutRequest timeout

API URL​

The base URL for all API endpoints is: https://api.outbrain.com/engage/v2

What's New in V2?​

V2 features enhanced security by protecting your publisher ID, making it a hashed string (both for Request and Response). Please contact your Teads account manager to acquire this ID.

Migration Example (V1 → V2)​

V1: api.outbrain.com/engage/v1/reports/externalId/publishers/publisherId..
V2: api.outbrain.com/engage/v2/reports/externalId?entityId=extPublisherId..

Authentication​

Overview​

You must include a token in all API requests using the HTTP header OB-TOKEN-V1. Tokens are valid for 30 days. You cannot access the Engage API using an expired token. You can generate as many tokens as you wish, and generating a new token does not invalidate older tokens.

When a user password or email is changed, all tokens generated prior to the change are revoked and a new token must be generated.

Obtaining a Token​

The /login endpoint is the only API transaction in which you need to supply your Teads credentials using Basic Authentication.

The HTTP Request should include the following header:

  • Header Name: Authorization
  • Value: BASIC BASE-64-ENC(YOUR_OUTBRAIN_USER_NAME:YOUR_OUTBRAIN_PASSWORD)

All communication to the Engage API is HTTPS, so your credentials are safe.

cURL Example​

curl -u YOUR_OUTBRAIN_USER_NAME:YOUR_OUTBRAIN_PASSWORD https://api.outbrain.com/engage/v2/login

To see the Authorization HTTP header, add the -v flag:

curl -v -u YOUR_OUTBRAIN_USER_NAME:YOUR_OUTBRAIN_PASSWORD https://api.outbrain.com/engage/v2/login

Token Management​

Given the limitation on /login requests (see Rate Limits section), the recommended way to manage tokens is to:

  1. Store an active token to be used in all requests
  2. Periodically update it
  3. Since each token is valid for 30 days, the update period should be 30 days or less

Rate Limits​

The following rate limits are enforced at different levels of the API:

  • Authentication requests (/login): Limited to 2 requests per hour per user
  • Publisher reporting: Each publisher is limited to 30 requests per minute for the entire reporting API
  • Unique variants: The API supports up to 100,000 (100K) unique variants per hour

In any case of rate limit violation, the response status will be 429 (Too Many Requests).

Users​

Users represent a single person's access to Teads services and the site my.outbrain.com. Users have permissions to one or more Publisher accounts.

Note: Users cannot be managed via this API and must be created with the help of your Teads contact.

Setup​

External ID Injection​

As a first step, populate your variants/external IDs in the platform. You can inject your variant using one of the following two methods:

Method 1: Global Variables​

  • OB_extId - for externalId
  • OB_extIdSecondary - for externalSecondaryId

Method 2: HTML Attributes​

  • data-external-id - for externalId
  • data-external-secondary-id - for externalSecondaryId

AMP Pages Example​

External ID setup is currently supported on web pages and AMP pages. Here's an example for AMP pages:

<amp-embed
width="100"
height="100"
type="outbrain"
data-widgetids="AMP_1"
data-external-id="555"
data-external-secondary-id="444">
</amp-embed>

Data Availability​

After 48 hours, you can start pulling this data using the API.

Publisher Lookups​

Note: Publishers cannot be created via the API and must be created via a Teads Account Manager.

Publishers Collection​

Retrieve all Publishers associated with the current user (as identified by the token in the OB-TOKEN-V1 HTTP header).

Widgets Collection​

Retrieve all Widgets associated with the publisher with EXTERNAL ID {id} (as identified by the token in the OB-TOKEN-V1 HTTP header).

Reports​

Overview​

Report endpoints allow you to retrieve metrics at various levels of granularity.

Note: Performance reports have a 2-4 hours delay; therefore, performance metrics for the current day are partial.

Response Structure​

All reporting endpoints share a common response structure:

PropertyTypeSemanticComments
itemsArrayMetrics of the entities returned—
totalItemsNumberCount of the total results after filtering—
metricsSumsMetricsAggregated metrics for the set of data returned in this response after filteringSee report-specific metrics

Filter Parameters​

The following table describes the basic filter operators:

Operator TypeOperatorDescriptionExample
Numeric:eq:EqualexternalId?filter=revenue:eq:2000
:gt:Greater thanexternalId?filter=organicClicks:gt:300
:lt:Less thanexternalId?filter=paidClicks:lt:890
:between:BetweenexternalId?filter=organicListings:between:20,900
List:in:InexternalId?filter=widget:in:2089,84984,38984
:not_in:Not inexternalId?filter=widget:not_in:2089,8466
String:contains:ContainsexternalId?filter=externalId:contains:ar
:not_contains:Not containsexternalId?filter=externalId:not_contains:ar

You can chain filters with ;, for example: filter=revenue:gt:2000;widget:in:234,657

Note: Nesting of Boolean operators is not supported currently.

External Id Report V2 Response Structure​

PropertyTypeSemanticComments
itemsArrayExternalIdReportItems of the entities returned—
totalItemsNumberCount of the total results after filtering—
metricsSumsExternalIdReportItemsAggregated metrics for the set of data returned in this response after filtering—

ExternalIdReportItems Fields​

PropertyTypeSemanticComments
externalIdStringExternal ID valueMaximum length: 110 characters
widgetWidgetWidget entityOptional breakdown
externalSecondaryIdStringSecondary external IDMaximum length: 110 characters
totalReqsNumberTotal number of widget requests—
paidReqsNumberNumber of paid requests—
organicReqsNumberNumber of organic requests—
totalClicksNumberTotal number of clicks—
paidClicksNumberTotal number of paid clicks—
organicClicksNumberTotal number of organic clicks—
reqsTotalCtrNumberAverage CTR (Click Through Rate): (Total clicks / totalReqs) * 100—
reqsPaidCtrNumberAverage CTR (Click Through Rate): (Paid clicks / paidReqs) * 100—
reqsOrganicCtrNumberAverage CTR (Click Through Rate): (Organic clicks / organicReqs) * 100—
revenueNumberTotal revenue—
reqsRpmNumberRevenue per thousand requests—
videoRevenueNumberNet revenue generated from Video—
widgetViewableImpressionsNumberTotal number of in-view impressions—
organicWidgetViewableImpressionsNumberTotal number of organic in-view impressions—
paidWidgetViewableImpressionsNumberTotal number of paid in-view impressions—

Request Structure / Parameters​

ParameterTypeSemanticDetails
entityIdStringExternal ID of the entity (publisher/group)Required. Contact your Teads account manager for your publisher external ID
fromDateStringStart date-time of resultsRequired. Format: yyyyMMddHH or yyyyMMdd (alias for 00 hour). Maximum range with toDate: 24 hours
toDateStringEnd date-time of resultsRequired. Format: yyyyMMddHH or yyyyMMdd (alias for 00 hour of next date). Maximum range with fromDate: 24 hours
limitNumberMaximal number of results to returnOptional. Default: 500, Maximum: 5000
offsetNumberOrdinal number of the first result to retrieveOptional. Default: 0
sortStringSorting field (metric or entity) of resultsOptional. Default: revenue
orderStringSorting order of resultsOptional. Allowed values: asc or desc. Default: descending
filterStringFilter based on filtering guidelinesOptional
breakdownsArray of StringsAggregation entities of resultsOptional. Default: externalId
currencyCodeStringRevenue currency codeOptional. Default: USD

Breakdowns​

The following table describes the aggregation options (report breakdowns):

OperatorDescriptionExample
externalIdExternal ID breakdown/v2/reports/externalId?breakdowns=externalId&entityId={entityId}
widgetWidget entity breakdown/v2/reports/externalId?breakdowns=widget&entityId={entityId}
externalSecondaryIdSecondary external ID breakdown/v2/reports/externalId?breakdowns=externalSecondaryId&entityId={entityId}

You can chain breakdowns with ,, for example: breakdowns=externalId,widget

Note: ExternalId is included as the first breakdown by default. To make it a different position, indicate it explicitly: breakdowns=widget,externalId

Error Handling​

When the API returns a status code indicating an error (400, 401, 403, 404, 429), it will also include JSON describing the error.

Error Response Example​

{
"moreInfo": "getWidgets",
"errorMessage": "access denied"
}

Troubleshooting​

If you're experiencing any issues or difficulties, please post a new topic in the Google group:

https://groups.google.com/forum/#!forum/engageapi

When reporting issues, please attach the x-traceid header from the returned response. This header allows the support team to identify your unique request and helps them to reply quicker and more efficiently.

For questions, feature requests, or announcements about new features, please join the Google group:

https://groups.google.com/forum/#!forum/engageapi