Unable to access Ads API



I am having an issue when trying to list our ad accounts using Twitter Ads API. I would appreciate any help on this matter.

This how I am getting the access token:

POST https://api.twitter.com/oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Authorization: Basic BASE64(clientId + “:” + clientSecret)

Host: api.twitter.com
Content-Length: 29
Expect: 100-continue
Connection: Keep-Alive


HTTP/1.1 200 OK
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
content-disposition: attachment; filename=json.json
content-length: 157
content-type: application/json;charset=utf-8
date: Wed, 12 Aug 2015 22:25:51 GMT
expires: Tue, 31 Mar 1981 05:00:00 GMT
last-modified: Wed, 12 Aug 2015 22:25:51 GMT
ml: S
pragma: no-cache
server: tsa_a
set-cookie: guest_id=v1%3A143941835164356661; Domain=.twitter.com; Path=/; Expires=Fri, 11-Aug-2017 22:25:51 UTC
status: 200 OK
strict-transport-security: max-age=631138519
x-connection-hash: 7d7d3c36221c5dca56dadeef98834901
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-response-time: 26
x-transaction: e0003f3b3642f302
x-tsa-request-body-time: 0
x-twitter-response-tags: BouncerCompliant
x-ua-compatible: IE=edge,chrome=1
x-xss-protection: 1; mode=block


Getting accounts using this token fails:

GET https://ads-api.twitter.com/0/accounts HTTP/1.1
Authorization: Bearer TOKEN_HERE
Host: ads-api.twitter.com

HTTP/1.1 401 Authorization Required
content-disposition: attachment; filename=json.json
content-length: 122
content-type: application/json;charset=utf-8
date: Mon, 03 Aug 2015 22:51:21 GMT
server: tsa_a
set-cookie: guest_id=v1%3A143864228185439045; Domain=.twitter.com; Path=/; Expires=Wed, 02-Aug-2017 22:51:21 UTC
strict-transport-security: max-age=631138519
x-access-level: read
x-connection-hash: 1031c114eed7f9290cc53861ac44c469
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-rate-limit-limit: 2000
x-rate-limit-remaining: 1998
x-rate-limit-reset: 1438642912
x-response-time: 10
x-runtime: 2.4E-5
x-transaction: 99648e85d2c29dc1
x-xss-protection: 1; mode=block

{“errors”:[{“code”:“UNAUTHORIZED_ACCESS”,“message”:“This request is not properly authenticated”}],“request”:{“params”:{}}}

Accessing the https://api.twitter.com/1.1/statuses/user_timeline.json?count=100&screen_name=HowStuffWorks with the same token returns results.


@DKrulerInsp we recommend you use twurl.

I strongly encourage you to read through our Getting started docs and more specifically the HTTP & OAuth section. Please note that you should be using OAuth1.0A.


@DKrulerInsp the key part of @andrs response is the fact that the Advertiser API is OAuth 1.0a.


This topic was automatically closed after 24 hours. New replies are no longer allowed.