I am getting an 401 error when trying to pull from stats/accounts/:account_id/campaigns/:id while other endpoints such as accounts/:id are working as expected



Previously, our app had to be given specific access to the campaign endpoint. Having tested via curl and the oAuth tool it doesn’t seem like an issue with our process (specially since other endpoints are functioning).

Any pointers would be helpful.



Sorry to hear you’re having issues, datayak.

A couple questions for debugging:

  1. Would you post the full API request you made and the full API
    response received?
  2. Is twurl also set up on the
    machine you’re making the request from?


Yes, twurl is setup on my machine.

Here’s a sample request:


Headers: { Authorization: OAuth oauth_consumer_key="RnXQp7UxfVrHcsgW6rIawcN8T",oauth_nonce="3a3a985ep4i9akrf",oauth_signature="pd3D8mTLiGjdwegVBOWCgew2W8o%3D",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1436207016",oauth_token="70769495-RPsj532pQSRTL7qj8znkdwqYuSChIq63jzIZkdZAR",oauth_version="1.0"

Here’s the response we get:

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


Would you check that the consumer key you are using to make the request is the same as the API key that was granted access to the Ads API?

This information can be found in your confirmation email for the whitelisted app ID.

If that matches, would you confirm that the default profile in your .twurlrc file is the one with correct consumer key?


Yes @emmolam, the Api keys are for the same app that was granted access. The default account used it also the same app.


We revisited how the OAuth tokens are generated and found that our spec-based implementation was different than that required by Twitter. We reworked it and with the new tokens, we’re able to make calls to the stat endpoint.

Thanks for your help @emmolam!


Glad you guys have it sorted out @datayak! And thanks for letting us know.