General
Versions
For the most up to date information on historical versions of the Twitter Ads API, please reference the information below.
Version | Path | Introduction Date | Deprecated Date | End of Life Date |
4.0 | /4/ |
August 28, 2018 | ||
3.0 | /3/ |
February 1, 2018 | August 28, 2018 |
February 28, 2019 |
2.0 | /2/ |
July 10, 2017 |
February 1, 2018 | August 1, 2018 |
1.0 | /1/ |
March 31, 2016 |
July 7, 2017 | January 10, 2018 |
0.0 | /0/ |
February 21, 2013 |
N/A | October 31, 2016 |
Overview
Every month, we make changes and roll out several new features on the Twitter Ads API. These changes are nearly always backwards compatible, however we do tend to have a handful of breaking changes each year. We’ve received feedback from developers on the challenges that our fast cadence of changes in the Ads API has on their development cycles when it comes to implementing new features, handling deprecations and testing changes. We want to improve the developer experience using our Ads platform, which is why we introduced the concept of versioning our endpoints.
A few definitions of some of the concepts that we talk about:
Version: This refers to the version number found in the URL path of any Ads API request, for example: GET /{version_number}/accounts. This style of versioning is known as URI versioning.
Breaking Changes: Breaking changes are any changes that require developer resources to maintain existing functionality. This includes resources used for investigation into the changes that need to be made, determination of features/endpoints being deprecated and final implementation of all these changes. A list of breaking changes are things like:
Removing a param from the API request/response
Modifying the name for any params or endpoints
Change in the representation of values (preview_url → card_uri)
Change in behavior of endpoints (e.g., async vs sync stats)
Adding/changing optional or required params (e.g., making name a required field in the request)
Deprecation: Deprecated versions or products will be unsupported and it is recommended that developers cease to use these APIs.
Sunset: Once a product or API is sunset, the corresponding set of endpoints will no longer be accessible via the API.
Versioning Strategy
The main principles of the strategy are:
All breaking changes will be bundled into a new version
Deprecations for existing versions whenever a new version is announced is 6 months
At any given time, the API will allow requests from two versions simultaneously, however the older of the two will be unsupported
In order to provide quicker adoption of new products, these will be released on on ongoing basis (outside of the versioning cadence)
All API responses will contain a
x-current-api-version
which will be set to the current version of the API in addition to anx-api-warn
header when calling any deprecated API endpoints.
Should there be any fundamental product requirement changes that require an API breaking change (e.g. deprecating multiple age bucket targeting), we will send out a 90-day notice to announce this breaking change, and after at least 90 days after the notice is released, the breaking change will be deployed
v4
Version 4 of the Ads API is launching today, August 28, 2018.
This release includes improvements to our Audiences product, including a new API interface powered by a more robust audience processing backend. Version 4 also includes a set of endpoints for managing user, account, and tax settings. In addition, the accounts/:account_id/videos endpoints are being deprecated. This release also includes a few minor parameter and and response name changes.
As with version 3, we are providing a 6 month transition period. On 2019-02-28, version 3 of the Ads API will no longer be available. We encourage all partners to migrate to the latest version of the API as soon as possible to avoid any service disruptions. See our Versions page for details on our versioning strategy.
New
Audience API
The new Audiences API is built on our new audience processing backend that provides enhanced robustness and reliability. This new endpoint will allow partners to provide multiple user identifier types for a single user, which means that we are able to use additional signals for matching. Reference documentation for the new Audience endpoint can be found here. We plan to continue to release updates and improvements to this product throughout the rest of year.
The following endpoints will no longer be available in v4 due to redundant functionality (they will still work in v3 and will be fully sunset when v3 is no longer available):
- TON Upload:
- GET accounts/:account_id/tailored_audience_changes
- GET accounts/:account_id/tailored_audience_changes/:tailored_audience_change_id
- POST accounts/:account_id/tailored_audience_changes
- PUT accounts/:accounti_d/tailored_audiences/global_opt_out
- Real Time Audiences:
- POST tailored_audience_memberships
Finally, the list_type
parameter will be removed from the request and response on all Tailored Audiences endpoints in version 4.
Settings Endpoints
We now provide the ability for account administrators to set and update user, account, and tax settings. User settings correspond to the user-specific contact preferences for a given ads account. Using the PUT accounts/:account_id endpoint, advertisers can now update their account name and industry type. Finally, the tax settings endpoints allow advertisers in countries where a value added tax (VAT) is charged to update information such as the company name, address, VAT ID, and whether the account is owned by the advertiser or by an agency advertising on behalf of an advertiser.
Changed
Universal Lookalike Renames
We’re updating the enum values for the lookalike_expansion
parameter on the POST accounts/:account_id/line_items and PUT accounts/:accountit/line_items/:line_item_id endpoints.
v3 | v4 |
---|---|
NARROW |
DEFINED |
BALANCED |
EXPANDED |
Using country_code
everywhere
As part of a larger effort around consistency on the Ads API, we’re renaming the parameters on the following endpoints from app_country_code
to country_code
.
- POST accounts/:account_id/cards/image_app_download
- PUT accounts/:account_id/cards/image_app_download/:card_id
- POST accounts/:account_id/cards/video_app_download
- PUT accounts/:account_id/cards/video_app_download/:card_id
This does not impact the behavior or accepted values for these parameters and is purely a naming change.
preview_url
always null
As promised in the v3 announcement, all existing cards now have a card_uri
. As a result, the preview_url
value will always be null
.
As a reminder, associate a card with a Tweet using its card_uri
value. See the following example request.
$ twurl -X POST -H ads-api.twitter.com "/4/accounts/18ce54d4x5t/tweet?text=Version 4&card_uri=card://958225772740714496"
Removed
Video endpoints
The accounts/:account_id/videos endpoints will no longer be available in v4. This endpoint has been made obsolete by the introduction of the Media Library endpoints. See the following usage comparison.
# v3 videos endpoint
$ twurl -H ads-api.twitter.com "/3/accounts/18ce54d4x5t/videos"
# v4 media library endpoint for videos
$ twurl -H ads-api.twitter.com "/4/accounts/18ce54d4x5t/media_library?media_type=VIDEO"
The Media Library endpoints are in full parity with the videos endpoints and also support additional functionality such as the ability to handle images and GIFs. Partners are requested to use the Media Library exclusively for any media management.
as_user_id
in Tweet View
The as_user_id
parameter available on the GET accounts/:account_id/tweet/preview/:tweet_id endpoint will no longer be accepted. The preview will always be rendered as the Tweet’s author.
v3
Version 3 of the Ads API launched on February 1, 2018. Version 2 of the Ads API will reach its end of life on August 1, 2018.
This release includes our new Audience Intelligence product, access to the Media Library, and improved card workflows. We are also announcing the deprecation of the PUT accounts/:account_id/targeting_criteria endpoint. Finally, version 3 includes a few minor parameter and response changes and a lower batch size limit.
As with version 2, we are giving partners 6 months to transition. On 2018-08-01, v2 of the Ads API will be shut off. We encourage all partners and developers to migrate to v3 as soon as possible.
Audience Intelligence
Audience Intelligence delivers real-time insights into the top hashtags,@handles, and events most relevant to a given Twitter audience. For example, enter Male 18-34 in the US and you’ll see#nintendoswitch,#cardinal, and@ricegumtrending amongst this audience.
The Audience Intelligence endpoints will provide the following functionality:
- Given an input audience, retrieve the top relevant hashtags,@handlesand events.
- Given an input audience, retrieve key demographic information (such as age, gender, and household income).
- Given a keyword, retrieve the Tweet volume time series
Media Library
The Media Library provides the ability to manage images, GIFs, and videos for ads accounts. These media objects can be used in Tweets and to create cards. They can also be reused in multiple creatives, eliminating the need to upload the same asset multiple times.
Objects in the library are identified by amedia_key. Media keys are string values in the following format:13_875943225764098048, for example. In the Ads API, we are moving toward using media keys for all media.
Improved card workflow
All of our cards endpoints now support media keys. This enables objects in the Media Library to be used to create or update cards.
In addition, we’re introducing two new endpoints for retrieving card details. These endpoints can be used to look up cards used in Tweets or Scheduled Tweets, for example, by specifying either thecard_uriorid. Previously, this was not possible.
Other changes
In addition to these new features, we’re including the following changes to version 3.
New
- The GET insights/keywords/search endpoint response now includes a related_keywords attribute with 30 terms related to the input keywords.
Changed
- The maximum targeting criteria batch size is now 500.
- Thecard_uriandpreview_urlresponse attributes are now mutually exclusive. When a card has acard_urithepreview_urlwill benull. When a card does not have acard_uri, only thepreview_urlwill be returned.
- All cards created as of 2018-01-29 will have acard_uri.
- By version 4, all existing cards will have acard_uri.
- It is no longer possible to create cards with 5:2 images. While existing 5:2 image-based cards will still work, we encourage partners to switch to using the higher-performing 1.91:1 or 1:1 aspect ratios (where supported)
Removed
- The PUT accounts/:account_id/targeting_criteria endpoint is no longer available. We’ve decided to make this change because the replace behavior with this endpoint caused advertiser confusion and it was not consistent with our other PUT endpoints that update a single resource at a time. Instead, partners should use the POST batch/accounts/:account_id/targeting_criteria endpoint, which provides greater flexibility including the ability to both add and remove targeting in a single request.
- The paused response attribute is no longer returned for funding instruments. Instead, look to the entity_status response attribute to determine whether or not a funding instrument is paused. In addition, because paused and cancelled correspond to the same value, cancelled is no longer returned in the response, either.
- We have removed the card_id parameter from the GET accounts/:account_id/tweet/preview endpoint.
- Because it is not possible to retrieve deleted Scheduled Tweets, the with_deleted parameter is no longer supported.
- The draft_only parameter has been removed from the following endpoints as these entities can never be in a draft state:
Note
Both Video Website Cards and Scheduled Tweets are now out of beta. See this thread for the changes we’ve made to Scheduled Tweets since launch. This includes the ability to generate HTML previews for Scheduled Tweets.
Deprecated
v2
Version 2 of the Ads API launched on July 10, 2017. Version 1 of the Ads API will reach its end of life on January 10, 2018.
Breaking Changes/Deprecations¶
total_count
is now an optional response attribute. It will only be available ifwith_total_count
is set totrue
paused
anddraft_only
fields online_items
andcampaigns
request and response objects are replaced by a singleentity_status
parameter- The
status
parameter has been renamed totext
on the POST accounts/:account_id/tweet and GET accounts/:account_id/tweet/preview endpoints - The GET targeting_criteria/locations endpoint’s
location_type
enums are now plural.COUNTRY
is nowCOUNTRIES
,REGION
is nowREGIONS
, and so on. The one exception is that, in v2,CITY
is nowMETROS
, to correctly reflect the fact that the location type refers to Designated Marker Areas (DMAs) or “metros”. display_properties
on the PUT accounts/:account_id/promoted_tweets endpoints. This value will also no longer be returned as part of the response- As a result of the previous point, it is no longer possible to update (PUT) promoted_tweets entities
- The
line_item_id
parameter on the GET accounts/:account_id/promoted_tweets endpoint has been removed
- It will no longer be possible to create 5:2 Website Cards on the v2 endpoints
data_type
response attribute is no longer returned
New Features¶
- Cards v2
- Draft campaigns/line item creations and activations
- Scheduled Tweets
- Async Job Summaries
Cards v2¶
- The
card_uri
request parameter should be used in favor of appending thepreview_url
to the Tweet text when associating a card with a Tweet - If the
card_uri
param is not returned in the response (during the card creation step) then use thepreview_url
- All new card formats will be natively availabe on the API, taking advantage of the
card_uri
parameter.
New Card Formats:¶
Draft Campaigns¶
Draft Camapiangs have been available to view via the GET accounts/:account_id/camapaigns endpoint. With v2, it is now possible to create/activate draft campaigns via the API.
- The
entity_status
parameter value on the POST accounts/:account_id/line_items and POST accounts/:account_id/campaigns endpoints can be set toDRAFT
in order create any new draft campaigns or line items. - The set of required parameters for a newly created draft:
Draft Campaign | Draft Line Item |
---|---|
funding_instrument_id |
campaign_id |
name |
objective |
start_time |
product_type |
placements |
Notes¶
- Draft line items or campaigns may only be converted from a
entity_status
ofDRAFT
toPAUSED
orACTIVE
- In order to activate an entire campaign (with multiple line items), each line item under the campaign, as well as the campaign itself must be set to an
entity_status
ofACTIVE
. - In order to change the
entity_status
of any campaign or line item, use the corresponding PUT endpoint.
Scheduled Tweets¶
Scheduled Tweets consist of the following new endpoints
- Newly scheduled Tweets can be scheduled for any date in the future
- Currently, there is no ability to preview a scheduled tweet
- Only Scheduled Tweets in the
SCHEDULED
state may be edited/deleted - Scheduled Tweets are not propogated to the Gnip Firehose, or any other data API until the
scheduled_at
date/time.
Unsupported
v1
Version 1 of the Ads API launched on March 31, 2016 and will reach its end of life on January 10, 2018.
Changes in version 1:¶
- Versioning support
CUSTOM
objective is no longer supported- Batch endpoints are now generally available
- Reach estimate changes:
- To provide better reach estimation, the endpoint is now budget aware. The following parameters are now required:
- [new]
campaign_daily_budget_amount_local_micro
currency
bid
objective
- [new]
- The response object has changed, and now returns ranges for response values.
infinite_count
has been renamedinfinite_bid_count
to avoid confusion on its purpose- In addition to
count
andinfinite_bid_count
, these new data points will now be returned:impressions
engagements
estimated_daily_spend_local_micro
- Data type change for tailored audiences
- The
data_type
for Tailored Audiences has been changed fromtailored_audiences
totailored_audience
in all of our resposnes. - Shared Tailored Audiences are now available as an API-only beta. Shared tailored audiences allow for a single audience to be used across multiple ads accounts. Use the POST accounts/:account_id/tailored_audiences/:tailored_audience_id/permissions (and related) endpoint to manage permissions of a tailored audience you would like to share across ads accounts.
- Significant improvements in how you collect performance analytics for advertiser accounts:
- To align with our best practices, we will now only allow data to be pulled for up to 7 days of data for the synchronous stats endpoints.
- To simplify pulling metrics, we have replaced the
metrics
parameter with a newmetric_groups
parameter. Developers simply must request which groups of metrics they would like returned for a given request.- Any request for metrics that are not appropriate for a given entity will be excluded from the response and represented as
null
values. These metrics will not count against your analytics cost limit.
- Any request for metrics that are not appropriate for a given entity will be excluded from the response and represented as
- The response has been significantly simplified, and will now align more closely with how metrics are exposed in our UI.
- Previously we exposed a separate metric for each placement location (Promoted Tweets in Search, Promoted Tweets in Timelines, Promoted Tweets in Profiles & Tweet Details, Twitter Audience Platform). We will now return a standardized set of metrics for each (instead of
promoted_tweet_timeline_impressions
,promoted_tweet_search_impressions
,promoted_tweets_profile_impressions
,promoted_tweets_tpn_impressions
), these will now be exposed when requested in one of the following categories as a single metric,impressions
(this applies to all metrics): ALL_ON_TWITTER
PUBLISHER_NETWORK
- When you make a request you’ll get a single
impressions
metric to make matching values in our UI simplier. - You must make two queries to get both
ALL_ON_TWITTER
andPUBLISHER_NETWORK
data, as these cannot be combined.
- Previously we exposed a separate metric for each placement location (Promoted Tweets in Search, Promoted Tweets in Timelines, Promoted Tweets in Profiles & Tweet Details, Twitter Audience Platform). We will now return a standardized set of metrics for each (instead of
- Asynchronous stats endpoints are now available, based on feedback from our developers!
- A new set of endpoints to request stats asynchronously, for data you don’t need immediately or for historic data pulls.
- Queue a stats job using a new single endpoint. We’ll pull the data you have requested as resources allow.
- You can query a job status endpoint to determine if the data is available.
- Once the data is available, we’ll provide a pick-up ID for you to download the JSON response, which will mirror the response from the synchronous endpoint.
- Query up to 90 days of data on up to 20 entities in a single job.
- Take a look at our analytics v1 migration guide, which includes mapping of v0 metrics to v1 metrics
- Sandbox improvements * You may now create multiple test ads accounts in the Sandbox environment. * You may now create multiple funding instruments for a test ads account in the Sandbox environment only. This allows you to test on all of our funding instrument types. Previously only a
CREDIT_CARD
funding source was available to test with. * Want to test a beta feature? You can now toggle features on/off for an account in the Sandbox environment to accommodate your testing needs.
v0
Version 0 of the Ads API was officially launched on February 21, 2013 and was supported until October 31, 2016.
All version 0 analytics endpoints are deprecated and will no longer exist after October 31, 2016. These endpoints have been replaced with 3 analytics endpoints in version 1.
The reach estimation endpoint has new behavior in version 1.