API Reference
Keyword Insights
GET insights/keywords/search
Given a group of keywords, get the associated Tweet volume as well as a set of 30 related keywords. The Tweet volume corresponds to the input keywords only, not the related keywords. A maximum time range (end_time - start_time) of 7 days is allowed.
Please note that results are scoped by a single geo (country).
Resource URL
https://ads-api.x.com/12/insights/keywords/search
Parameters
Example Request
Tailored Audience Permissions
GET accounts/:account_id/tailored_audiences/:tailored_audience_id/permissions
Retrieve details for some or all permissions associated with the specified tailored audience. Resource URLhttps://ads-api.x.com/5/accounts/:account_id/tailored_audiences/:tailored_audience_id/permissions
Parameters
Example Request
GET https://ads-api.x.com/5/accounts/18ce54d4x5t/tailored_audiences/1nmth/permissions
Example Response
POST accounts/:account_id/tailored_audiences/:tailored_audience_id/permissions
Create a new permission object allowing the specified audience to be shared with a given account. Note: Creating or modifying permissions for a tailored audience requires that the audience be owned by the account attempting to modify permissions. You can check the ownership of a tailored audience by looking at theis_owner response attribute in the response for a given audience.
Note: Audiences can only be shared between ads accounts under the same business or if the ads account that owns the audience has the SHARE_AUDIENCE_OUTSIDE_BUSINESS account feature.
Resource URL
https://ads-api.x.com/5/accounts/:account_id/tailored_audiences/:tailored_audience_id/permissions
Parameters
Example Request
POST https://ads-api.x.com/5/accounts/18ce54d4x5t/tailored_audiences/2906h/permissions?granted_account_id=18ce54aymz3&permission_level=READ_ONLY
Example Response
DELETE accounts/:account_id/tailored_audiences/:tailored_audience_id/permissions/:tailored_audience_permission_id
Revoke the specified Tailored Audience sharing permission. Note: Creating or modifying permissions for a tailored audience requires that the audience be owned by the account attempting to modify permissions. You can check the ownership of a tailored audience by looking at theis_owner response attribute in the response for a given audience.
When revoked, we guarantee that the granted account (granted_account_id) will not be able to target the audience in future campaigns. Existing campaigns will continue to run with the shared audiences; campaigns do not stop and the audience does not get removed from the campaign. It is not possible to copy this campaign after the audience sharing permission has been revoked.
Resource URL
https://ads-api.x.com/5/accounts/:account_id/tailored_audiences/:tailored_audience_id/permissions/:tailored_audience_permission_id
Parameters
Example Request
DELETE https://ads-api.x.com/5/accounts/18ce54d4x5t/tailored_audiences/1nmth/permissions/ri
Example Response
Targeted Audiences
GET accounts/:account_id/custom_audiences/:custom_audience_id/targeted
Retrieve a list of active or all line items and campaigns that target a givencustom_audience_id
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/custom_audiences/2906h/targeted
Example Response
Custom Audiences Users
POST accounts/:account_id/custom_audiences/:custom_audience_id/users
This endpoint will allow partners to add, update and remove users from a givencustom_audience_id. The endpoint will also accept multiple user identifier types per user as well.
All data being provided in the users field of the request except partner_user_id must be hashed using SHA256 and normalized.
Batch Requests
- The current maximum batch size is
2500for this endpoint. The batch size is determined by the number of operations (Update/Delete) per request. For example, over 2500 operation objects ({"operation_type": "Update/Delete", [..] }) in one array result in an error. - The max request POST body size this endpoint can accept is
5,000,000bytes. - The rate limits for this endpoint are 1500 per 1 minute window
- All parameters are sent in the request body and a
Content-Typeofapplication/jsonis required. - Batch requests fail or succeed together as a group and all API responses for both error and success preserve the item order of the initial request.
success_count and a total_count. These values must always be equal, and they are a count of the number of records in the request that have been processed by the backend. A situation where the number of records sent in the request body is not equal the success_count and total_count should be treated as an error condition, requiring a retry.
Batch Errors
- Request-level errors (eg. max batch size exceeded) are shown in the response under the
errorsobject. - Item-level errors (eg. missing required parameters) are show in the response under the
operation_errorsobject. - The index of the error in the
operation_errorsrefers to the index in the input item, with the corresponding error message
Resource URL
https://ads-api.x.com/12/accounts/:account_id/custom_audiences/:custom_audience_id/users
Parameters
Given the mutil-key approach to the
users object, each element of this object is documented below:
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/custom_audiences/1nmth/users
Example Response
Custom Audience Permissions
GET accounts/:account_id/custom_audiences/:custom_audience_id/permissions
Retrieve details for some or all permissions associated with the specified custom audience. Resource URLhttps://ads-api.x.com/12/accounts/:account_id/custom_audiences/:custom_audience_id/permissions
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/custom_audiences/1nmth/permissions
Example Response
POST accounts/:account_id/custom_audiences/:custom_audience_id/permissions
Create a new permission object allowing the specified audience to be shared with a given account. Note: Creating or modifying permissions for a custom audience requires that the audience be owned by the account attempting to modify permissions. You can check the ownership of a custom audience by looking at theis_owner response attribute in the response for a given audience.
Note: Audiences can only be shared between ads accounts under the same business or if the ads account that owns the audience has the SHARE_AUDIENCE_OUTSIDE_BUSINESS account feature.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/custom_audiences/:custom_audience_id/permissions
Parameters
Example Request
DELETE accounts/:account_id/custom_audiences/:custom_audience_id/permissions/:custom_audience_permission_id
Revoke the specified Custom Audience sharing permission. Note: Creating or modifying permissions for a custom audience requires that the audience be owned by the account attempting to modify permissions. You can check the ownership of a custom audience by looking at theis_owner response attribute in the response for a given audience.
When revoked, we guarantee that the granted account (granted_account_id) will not be able to target the audience in future campaigns. Existing campaigns will continue to run with the shared audiences; campaigns do not stop and the audience does not get removed from the campaign. It is not possible to copy this campaign after the audience sharing permission has been revoked.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/custom_audiences/:custom_audience_id/permissions/:custom_audience_permission_id
Parameters
Example Request
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/custom_audiences/1nmth/permissions/ri
Example Response
Custom Audiences
GET accounts/:account_id/custom_audiences
Retrieve details for some or all Custom Audiences associated with the current account. Resource URLhttps://ads-api.x.com/12/accounts/:account_id/custom_audiences
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/custom_audiences?custom_audience_ids=1nmth
Example Response
GET accounts/:account_id/custom_audiences/:custom_audience_id
Retrieve specific Custom Audiences associated with the current account. Resource URLhttps://ads-api.x.com/12/accounts/:account_id/custom_audiences/:custom_audience_id
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/custom_audiences/2906h
Example Response
POST accounts/:account_id/custom_audiences
Create a new placeholder Custom Audience associated with the current account. Resource URLhttps://ads-api.x.com/12/accounts/:account_id/custom_audiences
Parameters
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/custom_audiences?name=developers
Example Response
PUT accounts/:account_id/custom_audiences/:custom_audience_id
Update the specific Custom Audience associated with the current account. Resource URLhttps://ads-api.x.com/12/accounts/:account_id/custom_audiences/:custom_audience_id
Parameters
Example Request
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/custom_audiences/2906h?name=developers_changed
Example Response
POST batch/accounts/:account_id/custom_audiences
Allows for batch creation of Custom Audiences. See the Custom Audiences Overview page for information on audiences. Note: This batch endpoint is currently in closed beta and available to select advertisers. During this beta period, only Flexible Audiences based on mobile custom audiences can be created. Batch Requests- The current maximum batch size is 10.
- All parameters are sent in the request body and a
Content-Typeofapplication/jsonis required. - Batch requests fail or succeed together as a group and all API responses for both error and success preserve the item order of the initial request.
- Request-level errors (eg. max batch size exceeded) are shown in the response under the
errorsobject. - Item-level errors (eg. missing required parameter) are shown in the response under the
operation_errorsobject.
- Flexible Audiences are immutable once created.
- Custom Audiences are passed in a tree structure with boolean logic combinations to create Flexible Audiences
- A maximum of 10 Custom Audiences leaf nodes can be used to create a Flexible Audience.
https://ads-api.x.com/12/batch/accounts/:account_id/custom_audiences
Parameters
Example Request
POST https://ads-api.x.com/12/batch/accounts/18ce54d4x5t/custom_audiences
DELETE accounts/:account_id/custom_audiences/:custom_audience_id
Delete the specified Custom Audience belonging to the current account. Resource URLhttps://ads-api.x.com/12/accounts/:account_id/custom_audiences/:custom_audience_id
Parameters
Example Request
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/custom_audiences/2906h
Example Response
Do Not Reach Lists
GET accounts/:account_id/do_not_reach_lists
Retrieve details for some or all Do Not Reach List associated with the current account. Note: Anaccount_id can only have at most one Do Not Reach List
Resource URL
https://ads-api.x.com/12/accounts/:account_id/do_not_reach_lists
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54bgxky/do_not_reach_lists
Example Response
POST accounts/:account_id/do_not_reach_lists
Create a new Do Not Reach List associated with the current account. Note: Anaccount_id can only have at most one Do Not Reach List
Resource URL
https://ads-api.x.com/12/accounts/:account_id/do_not_reach_lists
Parameters
Example Request
POST https://ads-api.x.com/12/accounts/18ce54bgxky/do_not_reach_lists?description=A list of users to exclude
Example Response
POST batch/accounts/:account_id/do_not_reach_lists/:do_not_reach_list_id/users
This endpoint allows users to be added, updated and removed from a givendo_not_reach_list_id. This endpoint only accepts emails as the valid user identifier type.
All data being provided in the emails field of the request must be hashed using SHA256 and normalized.
Notes
- An
account_idcan only have at most one Do Not Reach List - Users added to this list must have an
expires_attimestamp set to less than 13 months from the current timestamp - Do Not Reach List API does not accept an
effective_attimestamp and defaults to the current timestamp - Do Not Reach List does not remove users from any or all custom audiences in the account but acts as exclusion targeting for all campaigns served for the account
- The current maximum batch size is
2500for this endpoint. The batch size is determined by the number of operations (Update/Delete) per request. For example, over 2500 operation objects ({"operation_type": "Update/Delete", [..] }) in one array result in an error. - The max request POST body size this endpoint can accept is
5,000,000bytes. - The rate limits for this endpoint are 1500 per 1 minute window
- All parameters are sent in the request body and a
Content-Typeofapplication/jsonis required. - Batch requests fail or succeed together as a group and all API responses for both error and success preserve the item order of the initial request.
success_count and a total_count. These values must always be equal, and they are a count of the number of records in the request that have been processed by the backend. A situation where the number of records sent in the request body is not equal the success_count and total_count should be treated as an error condition, requiring a retry.
Batch Errors
- Request-level errors (eg. max batch size exceeded) are shown in the response under the
errorsobject. - Item-level errors (eg. missing required parameters) are show in the response under the
operation_errorsobject. - The index of the error in the
operation_errorsrefers to the index in the input item, with the corresponding error message
https://ads-api.x.com/12/batch/accounts/:account_id/do_not_reach_lists/:do_not_reach_list_id/users
Parameters
Given the mutil-key approach to the
users object, each element of this object is documented below:
Example Request
DELETE accounts/:account_id/do_not_reach_lists/:do_not_reach_list_id
Delete the specified Do Not Reach List belonging to the current account. Resource URLhttps://ads-api.x.com/12/accounts/:account_id/do_not_reach_lists/:do_not_reach_list_id
Parameters
None
Example Request
DELETE https://ads-api.x.com/12/accounts/18ce54bgxky/do_not_reach_lists/4ofrp
Example Response