Website Cards

Note: card_uri is replacing preview_url. This moves associating a card with a Tweet from the Tweet text to a Tweet parameter. To associate a card with a Tweet, use the card_uri parameter with either the POST accounts/:account_id/tweet, POST statuses/update, or POST accounts/:account_id/scheduled_tweets endpoints. This allows users to use more characters in their Tweets.

GET accounts/:account_id/cards/website

Retrieve details for some or all website cards associated with the current account.

Resource URL

https://ads-api.twitter.com/4/accounts/:account_id/cards/website

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: 18ce54d4x5t

card_ids
optional

Scope the response to just the desired website cards by specifying a comma-separated list of identifiers. Up to 200 IDs may be provided.

Type: string

Example: 59wh0

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: 8x7v00oow

q
optional

An optional query to scope cards by name. Omit this parameter to retrieve all. Maximum length: 80 characters.

Type: string

Example: shuttle

sort_by
optional

Sorts by supported attribute in ascending or descending order. See Sorting for more information.

Type: string

Example: created_at-asc

with_deleted
optional

Include deleted results in your request.

Type: boolean

Default: false
Possible values: true, false
with_total_count
optional

Include the total_count response attribute.

Note: This parameter will be ignored if cursor is specified.

Note: Requests which include total_count will have lower rate limits, currently set at 200 per 15 minutes.

Type: boolean

Default: false
Possible values: true, false

Example Request

GET https://ads-api.twitter.com/4/accounts/18ce54d4x5t/cards/website?card_ids=59wh0

Example Response

{
  "request": {
    "params": {
      "card_type": "website",
      "card_ids": [
        "59wh0"
      ],
      "account_id": "18ce54d4x5t"
    }
  },
  "next_cursor": null,
  "data": [
    {
      "name": "website card",
      "website_shortened_url": "https://t.co/zadeUSVD18",
      "image_display_height": "418",
      "image": "https://pbs.twimg.com/media/DUKjmp8V4AAhrrB.jpg",
      "preview_url": null,
      "website_display_url": "developer.twitter.com",
      "id": "59wh0",
      "account_id": "18ce54d4x5t",
      "website_dest_url": "https://developer.twitter.com",
      "created_at": "2018-01-27T00:15:19Z",
      "image_display_width": "800",
      "website_title": "Twitter Developers",
      "card_uri": "card://957044309437526017",
      "website_url": "https://developer.twitter.com",
      "updated_at": "2018-01-27T00:15:19Z",
      "deleted": false,
      "card_type": "WEBSITE"
    }
  ]
}

GET accounts/:account_id/cards/website/:card_id

Retrieve a specific website card associated with the current account.

Resource URL

https://ads-api.twitter.com/4/accounts/:account_id/cards/website/:card_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: 18ce54d4x5t

card_id
required

A reference to the website card you are operating with in the request.

Type: string

Example: 59wh0

with_deleted
optional

Include deleted results in your request.

Type: boolean

Default: false
Possible values: true, false

Example Request

GET https://ads-api.twitter.com/4/accounts/18ce54d4x5t/cards/website/59wh0

Example Response

{
  "request": {
    "params": {
      "card_type": "website",
      "card_id": "59wh0",
      "account_id": "18ce54d4x5t"
    }
  },
  "data": {
    "name": "website card",
    "website_shortened_url": "https://t.co/zadeUSVD18",
    "image_display_height": "418",
    "image": "https://pbs.twimg.com/media/DUKjmp8V4AAhrrB.jpg",
    "preview_url": null,
    "website_display_url": "developer.twitter.com",
    "id": "59wh0",
    "account_id": "18ce54d4x5t",
    "website_dest_url": "https://developer.twitter.com",
    "created_at": "2018-01-27T00:15:19Z",
    "image_display_width": "800",
    "website_title": "Twitter Developers",
    "card_uri": "card://957044309437526017",
    "website_url": "https://developer.twitter.com",
    "updated_at": "2018-01-27T00:15:19Z",
    "deleted": false,
    "card_type": "WEBSITE"
  }
}

POST accounts/:account_id/cards/website

Create a new website card associated with the current account.

Resource URL

https://ads-api.twitter.com/4/accounts/:account_id/cards/website

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: 18ce54d4x5t

name
required

The name for the card.

Type: string

Example: website card

website_title
required

The title for the card.

Type: string

Example: Twitter Developers

website_url
required

The URL of the website to redirect a user to.

Type: string

Example: https://developer.twitter.com

image_media_id
sometimes required

A media_id of an image which will be used in this card.

This is a write-only field. In the response, the API will provide a Twitter URL for this image.

Note: Required if image_media_key is not specified.

Note: A minimum image width of 800px and a width:height aspect ratio of either 1:1 or 1.91:1 is required.

Type: long

Example: 883567557378154496

image_media_key
sometimes required

The media_key of a media library image which will be used in this card.

This is a write-only field. In the response, the API will provide a Twitter URL for this image.

Note: The image must be in the account's media library.

Note: Required if image_media_id is not specified.

Note: A minimum image width of 800px and a width:height aspect ratio of either 1:1 or 1.91:1 is required.

Type: string

Example: 3_955505955445268480

Example Request

POST https://ads-api.twitter.com/4/accounts/18ce54d4x5t/cards/website?image_media_key=3_955505955445268480&name=website card&website_title=Twitter Developers&website_url=https://developer.twitter.com

Example Response

{
  "data": {
    "name": "website card",
    "website_shortened_url": "https://t.co/zadeUSVD18",
    "image_display_height": "418",
    "image": "https://pbs.twimg.com/media/DUKjmp8V4AAhrrB.jpg",
    "preview_url": null,
    "website_display_url": "developer.twitter.com",
    "id": "59wh0",
    "account_id": "18ce54d4x5t",
    "website_dest_url": "https://developer.twitter.com",
    "created_at": "2018-01-27T00:15:19Z",
    "image_display_width": "800",
    "website_title": "Twitter Developers",
    "card_uri": "card://957044309437526017",
    "website_url": "https://developer.twitter.com",
    "updated_at": "2018-01-27T00:15:19Z",
    "deleted": false,
    "card_type": "WEBSITE"
  },
  "request": {
    "params": {
      "name": "website card",
      "website_shortened_url": "https://t.co/zadeUSVD18",
      "image_display_height": "418",
      "image": "https://pbs.twimg.com/media/DUKjmp8V4AAhrrB.jpg",
      "image_media_key": "3_955505955445268480",
      "website_display_url": "developer.twitter.com",
      "account_id": "18ce54d4x5t",
      "website_dest_url": "https://developer.twitter.com",
      "image_display_width": "800",
      "website_title": "Twitter Developers",
      "website_url": "https://developer.twitter.com",
      "card_type": "WEBSITE"
    }
  }
}

PUT accounts/:account_id/cards/website/:card_id

Update the specified website card belonging to the current account.

Resource URL

https://ads-api.twitter.com/4/accounts/:account_id/cards/website/:card_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: 18ce54d4x5t

card_id
required

A reference to the website card you are operating with in the request.

Type: string

Example: 4i91t

image_media_id
optional

A media_id of an image which will be used in this card.

This is a write-only field. In the response, the API will provide a Twitter URL for this image.

Note: A minimum image width of 800px and a width:height aspect ratio of either 1:1 or 1.91:1 is required.

Type: long

Example: 883567557378154496

image_media_key
optional

The media_key of a media library image which will be used in this card.

This is a write-only field. In the response, the API will provide a Twitter URL for this image.

Note: The image must be in the account's media library.

Note: A minimum image width of 800px and a width:height aspect ratio of either 1:1 or 1.91:1 is required.

Type: string

Example: 3_955505955445268480

name
optional

The name for the card.

Type: string

Example: coffee card

website_title
optional

The title for the card.

Type: string

Example: Twitter Developers

website_url
optional

The URL of the website to redirect a user to.

Type: string

Example: https://twittercommunity.com/c/advertiser-api

Example Request

PUT https://ads-api.twitter.com/4/accounts/18ce54d4x5t/cards/website/59w2c?name=coffee card

Example Response

{
  "data": {
    "name": "coffee card",
    "website_shortened_url": "https://t.co/TvmIOd0wXq",
    "image_display_height": "418",
    "image": "https://pbs.twimg.com/media/DUKjmp8V4AAhrrB.jpg",
    "preview_url": null,
    "website_display_url": "developer.twitter.com",
    "id": "59w2c",
    "account_id": "18ce54d4x5t",
    "website_dest_url": "https://developer.twitter.com/",
    "created_at": "2018-01-26T21:11:48Z",
    "image_display_width": "800",
    "website_title": "Twitter Developers",
    "card_uri": "card://956998127856177153",
    "website_url": "https://developer.twitter.com/",
    "updated_at": "2018-01-27T00:20:18Z",
    "deleted": false,
    "card_type": "WEBSITE"
  },
  "request": {
    "params": {
      "account_id": "18ce54d4x5t",
      "card_type": "WEBSITE",
      "card_id": "59w2c",
      "name": "coffee card"
    }
  }
}

DELETE accounts/:account_id/cards/website/:card_id

Permanently delete the specified website card belonging to the current account.

Note: This is a hard delete. As a result, it is not possible to retrieve deleted cards.

Resource URL

DELETE accounts/:account_id/cards/website/:card_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: 18ce54d4x5t

card_id
required

A reference to the website card you are operating with in the request.

Type: string

Example: 4i91t

Example Request

DELETE https://ads-api.twitter.com/4/accounts/18ce54d4x5t/cards/website/4i91t

Example Response

{
  "data": {
    "name": "website card",
    "id": "4i91t",
    "account_id": "18ce54d4x5t",
    "created_at": "2017-07-08T06:05:17Z",
    "updated_at": "2017-08-23T13:33:50Z",
    "deleted": true,
    "card_type": "WEBSITE"
  },
  "request": {
    "params": {
      "card_id": "4i91t",
      "card_type": "website",
      "account_id": "18ce54d4x5t"
    }
  }
}