facebook-graph-apifacebook-marketing-api

Facebook Insights API fails with "The start date of the time range cannot be beyond 37 months from the current date" but it is today


Look at this error in Meta Marketing API AdAccount Insights. It says start date cannot be beyond 37 month, but if you look at the date in bold, the date is yesterday. How can this happen?

Based on the error message, the params provided should work.

Message: Call was not successful
  Method:  GET
  Path:    https://graph.facebook.com/v18.0/act_********/insights
  Params:  {'level': 'campaign', 'limit': '1000', 'time_ranges': '[{"since": "**11-16-23**", "until": "**11-17-23**"},]', 'increment': 1, 'fields': 'account_id,campaign_id,campaign_name,spend,impressions,reach,cpc,clicks,actions,conversions'}
  Status:  400
  Response:
    {
      "error": {
        "message": "(#3018) **The start date of the time range cannot be beyond 37 months from the current date**",
        "type": "OAuthException",
        "code": 3018,
        "fbtrace_id": "Ag-P22y80OSEXM4qsGk2T9P"
      }
    }

Solution

  • According to Meta Marketing Ad Account Insights API, the since and until date fields should be in the format of "YYYY-MM-DD".