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

other request like
are executing.

UNAUTHORIZED_ACCESS This request is not properly authenticated

Please let me know is there any correction in this URL?


The URL is structured properly, but there seems to be an issue with the authentication credentials being used. I recommend making the same request using twurl (https://github.com/twitter/twurl) to verify the validity of your request and then confirming your authentication credentials. I’ve also linked two URLs below that can help provide further guidance:
Verify Authentication Credentials
Resolved authentication thread


Thank you.
I am using “scribejava” for Outh and passing ConsumerSecret,ConsumerKey,AccessToken,AccessTokenSecret.
We need to pass any other parameters??


You are correct, Consumer Key, Consumer Secret, Access Token and Access Token secret are the four required parameters that must be included when using the API. Please know our Advertising API requires the use of both OAuth 1.0A and HTTPS.

In order to rule out an issue with your authentication credentials, can you try making the same request using Twurl (https://github.com/twitter/twurl1)? Additionally, have you looked at Twitter4J or any other Java libraries as alternatives?


@rajivsud ,
i am using scribejava liberary for OAuth but still getting same error.
Will u please tell how to authorized request in java using OAuth?


To guide you setting up OAuth using ScribeJava, here are several resources that may help:

Also, I was able to validate a response from our API using Twurl:

twurl -H ads-api.twitter.com "/1/stats/accounts/18ce548hnmt?entity_ids=8335v&entity=CAMPAIGN&start_time=2017-04-15T18:00:00Z&end_time=2017-04-18T18:00:00Z&granularity=TOTAL&metric_groups=ENGAGEMENT,BILLING&placement=ALL_ON_TWITTER" | jq
  "data_type": "stats",
  "time_series_length": 1,
  "data": [
      "id": "8335v",
      "id_data": [
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "billed_charge_local_micro": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "replies": null,
            "url_clicks": null,
            "billed_engagements": null,
            "carousel_swipes": null
  "request": {
    "params": {
      "start_time": "2017-04-15T18:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
      "end_time": "2017-04-18T18:00:00Z",
      "country": null,
      "placement": "ALL_ON_TWITTER",
      "granularity": "TOTAL",
      "entity": "CAMPAIGN",
      "platform": null,
      "metric_groups": [

This leads me to believe there is an issue with your authentication credentials. Have you tried using Twurl to validate your credentials?


why we are getting matrices response as null like impression,clicks,likes and engagement???
Using twitter4j-ads i got only impression count using stats example,
Please guide me
Thank you.


I have same problem ,I am also getting null values in response?As there is another way to get response?


To help debug, can you try making the same calls with twurl and ensure that you pass in the ‘-t’ option to get the entire trace of the API call, and post the entire request and response bodies?


@BSDarandale1111, @Waghade_Amol: All null values means that there was no data for the specified time period. In other words, the entity did not serve. Please see this post for additional details.