Line Items
GET accounts/:account_id/line_items¶
Retrieve details for some or all line items associated with the current account.
Resource URL¶
https://ads-api.x.com/12/accounts/:account_id/line_items
Parameters¶
Name | Description |
---|---|
account_id required |
The identifier for the leveraged account. Appears within the resource's path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example:
|
campaign_ids optional |
Scope the response to just the line items under specific campaigns by specifying a comma-separated list of identifiers. Up to 200 IDs may be provided. Type: string Example:
|
count optional |
Specifies the number of records to try and retrieve per distinct request. Type: int Default:
200 Min, Max: 1 ,
1000 |
cursor optional |
Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example:
|
funding_instrument_ids optional |
Scope the response to just the line items under specific funding instruments by specifying a comma-separated list of identifiers. Up to 200 IDs may be provided. Type: string Example:
|
line_item_ids optional |
Scope the response to just the desired line items by specifying a comma-separated list of identifiers. Up to 200 IDs may be provided. Type: string Example: |
q optional |
An optional query to scope resource by
Type: string Min,
Max length: 1 , 255 |
sort_by optional |
Sorts by supported attribute in ascending or descending order. See Sorting for more information. Type: string Example:
|
with_deleted optional |
Include deleted results in your request. Type: boolean Default:
false Possible values: true ,
false |
with_draft optional |
Include draft campaigns results in your request. Type: boolean Default:
false Possible values: true ,
false |
with_total_count optional |
Include the Note: This parameter and
Note: Requests
which include Type: boolean Default:
false Possible values: true ,
false |
Example Request¶
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/line_items?line_item_ids=itttx
Example Response¶
{
"request": {
"params": {
"account_id": "18ce54d4x5t",
"line_item_ids": [
"itttx"
]
}
},
"next_cursor": null,
"data": [
{
"advertiser_user_id": "756201191646691328",
"name": "li-18",
"placements": [
"ALL_ON_TWITTER"
],
"start_time": "2021-02-16T00:00:00Z",
"bid_amount_local_micro": 320000,
"advertiser_domain": null,
"target_cpa_local_micro": null,
"primary_web_event_tag": null,
"goal": "ENGAGEMENT",
"daily_budget_amount_local_micro": null,
"product_type": "PROMOTED_TWEETS",
"end_time": null,
"funding_instrument_id": "lygyi",
"bid_strategy": "MAX",
"duration_in_days": null,
"standard_delivery": null,
"total_budget_amount_local_micro": null,
"objective": "ENGAGEMENTS",
"id": "itttx",
"entity_status": "PAUSED",
"automatic_tweet_promotion": null,
"frequency_cap": null,
"android_app_store_identifier": null,
"categories": [],
"currency": "USD",
"pay_by": "ENGAGEMENT",
"created_at": "2021-02-23T23:37:54Z",
"ios_app_store_identifier": null,
"updated_at": "2022-06-01T02:01:18Z",
"campaign_id": "f4z6x",
"creative_source": "MANUAL",
"deleted": false
}
]
}
GET accounts/:account_id/line_items/:line_item_id¶
Retrieve a specific line item associated with the current account.
Resource URL¶
https://ads-api.x.com/12/accounts/:account_id/line_items/:line_item_id
Parameters¶
Name | Description |
---|---|
account_id required |
The identifier for the leveraged account. Appears within the resource's path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example:
|
line_item_id required |
A reference to the line item you are operating with in the request. Type: string Example: |
with_deleted optional |
Include deleted results in your request. Type: boolean Default:
false Possible values: true ,
false |
Example Request¶
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/line_items/itttx
Example Response¶
{
"request": {
"params": {
"line_item_id": "itttx",
"account_id": "18ce54d4x5t"
}
},
"data": {
"advertiser_user_id": "756201191646691328",
"name": "li-18",
"placements": [
"ALL_ON_TWITTER"
],
"start_time": "2021-02-16T00:00:00Z",
"bid_amount_local_micro": 320000,
"advertiser_domain": null,
"target_cpa_local_micro": null,
"primary_web_event_tag": null,
"goal": "ENGAGEMENT",
"daily_budget_amount_local_micro": null,
"product_type": "PROMOTED_TWEETS",
"end_time": null,
"funding_instrument_id": "lygyi",
"bid_strategy": "MAX",
"duration_in_days": null,
"standard_delivery": null,
"total_budget_amount_local_micro": null,
"objective": "ENGAGEMENTS",
"id": "itttx",
"entity_status": "PAUSED",
"automatic_tweet_promotion": null,
"frequency_cap": null,
"android_app_store_identifier": null,
"categories": [],
"currency": "USD",
"pay_by": "ENGAGEMENT",
"created_at": "2021-02-23T23:37:54Z",
"ios_app_store_identifier": null,
"updated_at": "2022-06-01T02:01:18Z",
"campaign_id": "f4z6x",
"creative_source": "MANUAL",
"deleted": false
}
}
POST accounts/:account_id/line_items¶
Create a line item associated with the specified campaign belonging to the current account.
All line items within a campaign must be of the same
product_type
and objective
.
When using the PROMOTED_ACCOUNT
product type,
associating a Tweet with the line_item
will add timeline
placements on mobile in addition to the standard
PROMOTED_ACCOUNT
placement.
Setting either android_app_store_identifier
or
ios_app_store_identifier
will automatically add the
targeting criteria for the line item matching the mobile app being
promoted; for example, passing in ios_app_store_identifier
would add PLATFORM
targeting
criteria for iOS
.
Note: There is a limit of 100 line items per campaign and 256 active line items across all campaigns.
Resource URL¶
https://ads-api.x.com/12/accounts/:account_id/line_items
Parameters¶
Name | Description |
---|---|
account_id required |
The identifier for the leveraged account. Appears within the resource's path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example:
|
campaign_id required |
The identifier for the campaign to create the line item under. Type: string Example: |
end_time required |
The time, expressed in ISO 8601, that the line item will stop serving. Type: string Example:
|
objective required |
The campaign objective for this line item. Type: enum Possible values: |
placements required |
The placement location(s) for this line item to display in. Specify a comma-separated list of placement values. Type: enum Possible values: |
product_type required |
The type of promoted product that this line item will contain. Type: enum Possible values: |
start_time required |
The time, expressed in ISO 8601, that the line item will begin serving. Type: string Example:
|
advertiser_domain sometimes required |
The website domain for this advertiser, without the protocol specification. Note: Required when the line
item's placement is set to Type: string Example: |
android_app_store_identifier sometimes required |
The Google App Store identifier for promoted applications. Note: Type: string Example:
|
bid_amount_local_micro sometimes required |
The bid amount to be associated with this line item. The currency associated with the specified funding instrument will be used. For USD, $5.50 is represented as 5500000. Note: Required
if Note: Only values greater than zero are accepted. Type: long Example:
|
categories sometimes required |
The relevant IAB categories for this advertiser. See GET iab_categories. Note: Required when the line
item's placement is set to Type: string Example: |
ios_app_store_identifier sometimes required |
The numeric portion of the Apple App Store identifier for promoted applications. Note:
Type: string Example:
|
primary_web_event_tag sometimes required |
The identifier of the primary web event tag. Allows more accurate tracking of engagements for the campaign pertaining to this line item. Note: Required when the line item's goal is
set to Type: string Example: |
advertiser_user_id optional |
The Twitter user identifier for the handle promoting a
Type: string Example:
|
audience_expansion optional |
Used to expand the reach of campaigns by targeting users similar to those already targeted. Note: By default, no expansion will be applied. Type: enum Possible values:
|
bid_strategy optional |
The bidding mechanism.
Note: If set to
Note: Default based on objective. Type: enum Possible values: |
duration_in_days optional |
The time period within which the Type: int Possible values: |
entity_status optional |
The line item status. Type: enum Default:
ACTIVE Possible values: ACTIVE ,
DRAFT , PAUSED |
frequency_cap optional |
The maximum number of times an ad could be delivered to a user. Note: Only supported for
Type: int Example: |
goal optional |
The optimization setting to use with this line item. The
The Note: Default based on objective. Type: enum Possible values:
APP_CLICKS , APP_INSTALLS ,
APP_PURCHASES ,ENGAGEMENT ,
FOLLOWERS , LINK_CLICKS ,
MAX_REACH , PREROLL ,
PREROLL_STARTS , REACH_WITH_ENGAGEMENT ,
SITE_VISITS , VIDEO_VIEW ,
VIEW_3S_100PCT , VIEW_6S ,
VIEW_15S , WEBSITE_CONVERSIONS |
name optional |
The name for the line item. Type: string Example:
Min, Max length:
1 , 255 |
pay_by optional |
The unit to charge this line item by. This setting can only be
modified for line items using the Note: The default The The
The Type: enum Possible
values: |
standard_delivery optional |
Enable standard or accelerated delivery. See Budget
Pacing for more information on standard versus accelerated delivery.
Only available when Type: boolean Default:
true Possible values: true ,
false |
total_budget_amount_local_micro optional |
The total budget amount to be allocated to the line item. The currency associated with the specified funding instrument will be used. For USD, $37.50 is represented as 37500000. Type: long Example: |
daily_budget_amount_local_micro sometimes required |
The daily budget amount to be allocated to the campaign. The
currency associated with the specified funding instrument will be used.
For USD, $5.50 is represented as 5500000. When not provided the campaign
will spend evenly based upon total budget and for duration of campaign
flight time. Only available when Note: This should be less than or equal to the
Type: long Example: |
Example Request¶
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/line_items?campaign_id=hwtq0&objective=ENGAGEMENTS&product_type=PROMOTED_TWEETS&placements=ALL_ON_TWITTER&bid_amount_local_micro=3210000&entity_status=PAUSED&daily_budget_amount_local_micro=1000000&start_time=2022-06-15
Example Response¶
{
"request": {
"params": {
"placements": [
"ALL_ON_TWITTER"
],
"start_time": "2022-06-15T00:00:00Z",
"bid_amount_local_micro": 3210000,
"daily_budget_amount_local_micro": 1000000,
"product_type": "PROMOTED_TWEETS",
"objective": "ENGAGEMENTS",
"entity_status": "PAUSED",
"account_id": "18ce54d4x5t",
"campaign_id": "hwtq0"
}
},
"data": {
"advertiser_user_id": "756201191646691328",
"name": null,
"placements": [
"ALL_ON_TWITTER"
],
"start_time": "2022-06-15T00:00:00Z",
"bid_amount_local_micro": 3210000,
"advertiser_domain": null,
"target_cpa_local_micro": null,
"primary_web_event_tag": null,
"goal": "ENGAGEMENT",
"daily_budget_amount_local_micro": 1000000,
"product_type": "PROMOTED_TWEETS",
"end_time": null,
"bid_strategy": "MAX",
"duration_in_days": null,
"standard_delivery": true,
"total_budget_amount_local_micro": null,
"objective": "ENGAGEMENTS",
"id": "ml5vs",
"entity_status": "PAUSED",
"automatic_tweet_promotion": null,
"frequency_cap": null,
"android_app_store_identifier": null,
"categories": [],
"currency": "USD",
"pay_by": "ENGAGEMENT",
"created_at": "2022-06-03T23:47:20Z",
"ios_app_store_identifier": null,
"updated_at": "2022-06-03T23:47:20Z",
"campaign_id": "hwtq0",
"creative_source": "MANUAL",
"deleted": false
}
}
POST batch/accounts/:account_id/line_items¶
Allows the batch creation of new line items with a single request.
Batch Requests
- The current maximum batch size is 40.
- All parameters are sent in the request body and a
Content-Type
ofapplication/json
is 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.
Batch Responses
Batch API responses return an ordered collection of items. Otherwise, they are identical in structure to their corresponding single-item endpoints.
Batch Errors
- Request-level errors (eg. max batch size exceeded) are shown in the
response under the
errors
object. - Item-level errors (eg. missing required line item parameter) are
shown in the response under the
operation_errors
object.
Resource URL¶
https://ads-api.x.com/12/batch/accounts/:account_id/line_items
Parameters¶
Name | Description |
---|---|
operation_type required |
The per item operation type being performed. Type: enum Possible values: |
params required |
A JSON object containing all the parameters for the line item objects. For a list of required and optional line item parameters, see here. |
Example Request¶
POST 'Content-Type: application/json' https://ads-api.x.com/12/batch/accounts/18ce54d4x5t/line_items
[
{
"operation_type":"Create",
"params":{
"campaign_id":"8yn7m",
"objective":"ENGAGEMENTS",
"product_type":"PROMOTED_TWEETS",
"placements":"ALL_ON_TWITTER",
"bid_amount_local_micro":3210000,
"entity_status":"PAUSED"
}
}
]
Example Response¶
{
"data": [
{
"advertiser_user_id": "756201191646691328",
"name": null,
"placements": [
"ALL_ON_TWITTER"
],
"start_time": null,
"bid_amount_local_micro": 3210000,
"advertiser_domain": null,
"target_cpa_local_micro": null,
"primary_web_event_tag": null,
"goal": "ENGAGEMENT",
"daily_budget_amount_local_micro": null,
"product_type": "PROMOTED_TWEETS",
"end_time": null,
"funding_instrument_id": "lygyi",
"bid_strategy": "MAX",
"duration_in_days": null,
"standard_delivery": null,
"total_budget_amount_local_micro": null,
"objective": "ENGAGEMENTS",
"id": "9cqi0",
"entity_status": "PAUSED",
"automatic_tweet_promotion": null,
"frequency_cap": null,
"android_app_store_identifier": null,
"categories": [],
"currency": "USD",
"pay_by": "ENGAGEMENT",
"created_at": "2017-07-07T17:42:20Z",
"ios_app_store_identifier": null,
"updated_at": "2017-07-07T17:42:20Z",
"campaign_id": "8yn7m",
"creative_source": "MANUAL",
"deleted": false
}
],
"request": [
{
"params": {
"placements": [
"ALL_ON_TWITTER"
],
"bid_amount_local_micro": 3210000,
"product_type": "PROMOTED_TWEETS",
"objective": "ENGAGEMENTS",
"entity_status": "PAUSED",
"account_id": "18ce54d4x5t",
"campaign_id": "8yn7m"
},
"operation_type": "Create"
}
]
}
PUT accounts/:account_id/line_items/:line_item_id¶
Update the specified line item associated with the current account.
Resource URL¶
https://ads-api.x.com/12/accounts/:account_id/line_items/:line_item_id
Parameters¶
Name | Description |
---|---|
account_id required |
The identifier for the leveraged account. Appears within the resource's path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example:
|
line_item_id required |
A reference to the line item you are operating with in the request. Type: string Example: |
advertiser_domain optional |
The website domain for this advertiser, without the protocol specification. Note: Required when the line
item's placement is set to Type: string Example: |
advertiser_user_id optional |
The Twitter user identifier for the handle promoting a
Type: string Example:
|
android_app_store_identifier optional |
The Google App Store identifier for the promoted application. Note: Type: string Example:
|
audience_expansion optional |
Used to expand the reach of campaigns by targeting users similar to those already targeted. Type: enum Possible values:
|
bid_amount_local_micro optional |
The bid amount to be associated with this line item. The currency associated with the specified funding instrument will be used. For USD, $5.50 is represented as 5500000. Note: Required
if Note: Only values greater than zero are accepted. Type: long Example:
|
bid_strategy optional |
The bidding mechanism.
Note: If set to
Note: Default based on objective. Type: enum Possible values: |
categories optional |
The relevant IAB categories for this advertiser. See GET iab_categories. Note: Required when the line
item's placement is set to Type: string Example: |
duration_in_days optional |
The time period within which the Type: int Possible values: |
entity_status optional |
The line item status. Type: enum Possible values:
|
end_time optional |
The time, expressed in ISO 8601, that the line item will stop serving. Type: string Example:
|
frequency_cap optional |
The maximum number of times an ad could be delivered to a user. Note: Only supported for
Type: int Example: |
goal optional |
The optimization setting to use with this line item. The
Note: Default based on objective. Type: enum Possible values:
APP_CLICKS , APP_INSTALLS ,
APP_PURCHASES , ENGAGEMENT ,
FOLLOWERS , LINK_CLICKS ,
MAX_REACH , PREROLL ,
PREROLL_STARTS , REACH_WITH_ENGAGEMENT ,
VIDEO_VIEW , VIEW_3S_100PCT ,
VIEW_6S , VIEW_15S ,
WEBSITE_CONVERSIONS |
ios_app_store_identifier optional |
The numeric portion of the Apple App Store identifier for promoted applications. Note:
Type: string Example:
|
name optional |
The name for the line item. Type: string Example:
|
pay_by optional |
The unit to charge this line item by. This setting can only be
modified for line items using the Note: The default The The
The Type: enum Possible
values: |
start_time optional |
The time, expressed in ISO 8601, that the line item will begin serving. Type: string Example:
|
total_budget_amount_local_micro optional |
The total budget amount to be allocated to the line item. The currency associated with the specified funding instrument will be used. For USD, $37.50 is represented as 37500000. Type: long Example: |
daily_budget_amount_local_micro optional |
The daily budget amount to be allocated to the campaign. The
currency associated with the specified funding instrument will be used.
For USD, $5.50 is represented as 5500000. When not provided the campaign
will spend evenly based upon total budget and for duration of campaign
flight time. Only available when Note: This should be less than or equal to the
Type: long Example: |
Example Request¶
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/line_items/9cqi0?bid_amount_local_micro=140000
Example Response¶
{
"request": {
"params": {
"line_item_id": "9cqi0",
"bid_amount_local_micro": 140000,
"account_id": "18ce54d4x5t"
}
},
"data": {
"advertiser_user_id": "756201191646691328",
"name": null,
"placements": [
"ALL_ON_TWITTER"
],
"start_time": "2017-07-10T00:00:00Z",
"bid_amount_local_micro": 140000,
"advertiser_domain": null,
"target_cpa_local_micro": null,
"primary_web_event_tag": null,
"goal": "ENGAGEMENT",
"daily_budget_amount_local_micro": null,
"product_type": "PROMOTED_TWEETS",
"end_time": null,
"bid_strategy": "MAX",
"duration_in_days": null,
"standard_delivery": null,
"total_budget_amount_local_micro": null,
"objective": "ENGAGEMENTS",
"id": "9cqi0",
"entity_status": "PAUSED",
"automatic_tweet_promotion": null,
"frequency_cap": null,
"android_app_store_identifier": null,
"categories": [],
"currency": "USD",
"pay_by": "ENGAGEMENT",
"created_at": "2017-07-07T17:42:20Z",
"ios_app_store_identifier": null,
"updated_at": "2022-06-03T23:51:36Z",
"campaign_id": "8yn7m",
"creative_source": "MANUAL",
"deleted": false
}
}
DELETE accounts/:account_id/line_items/:line_item_id¶
Delete the specified line item belonging to the current account.
Note: Deleting a line item is not reversible and subsequent attempts to delete the resource will return HTTP 404.
Note: When a line item is deleted, its child
promoted_tweets are only returned in the GET
accounts/:account_id/promoted_tweets and GET
accounts/:account_id/promoted_tweets/:promoted_tweet_id endpoints if
with_deleted=true
is specified in the request. These
promoted_tweets are not actually deleted, though
("deleted": false
in the response). We do not cascade
deletes.
Resource URL¶
https://ads-api.x.com/12/accounts/:account_id/line_items/:line_item_id
Parameters¶
Name | Description |
---|---|
account_id required |
The identifier for the leveraged account. Appears within the resource's path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example:
|
line_item_id required |
A reference to the line item you are operating with in the request. Type: string Exampple: |
Example Request¶
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/line_items/9f2ix
Example Response¶
{
"data": {
"bid_strategy": "MAX",
"advertiser_user_id": "756201191646691328",
"name": "Untitled",
"placements": [],
"start_time": null,
"bid_amount_local_micro": 100000,
"advertiser_domain": null,
"target_cpa_local_micro": null,
"primary_web_event_tag": null,
"pay_by": "ENGAGEMENT",
"product_type": "PROMOTED_TWEETS",
"end_time": "2017-07-21T00:00:00Z",
"duration_in_days": 1,
"total_budget_amount_local_micro": null,
"objective": "ENGAGEMENTS",
"id": "9f2ix",
"entity_status": "ACTIVE",
"goal": "ENGAGEMENT",
"frequency_cap": 5,
"categories": [],
"currency": "USD",
"created_at": "2017-07-14T00:01:50Z",
"updated_at": "2017-08-09T07:41:08Z",
"campaign_id": "90r8n",
"creative_source": "MANUAL",
"deleted": true
},
"request": {
"params": {
"line_item_id": "9f2ix",
"account_id": "18ce54d4x5t"
}
}
}