Errors and Exceptions

Below is a list of Errors and Exceptions that may be returned by the API. Use them and the potentials solutions provided as a guide to solve the issues encountered. We have tried to make the list exhaustive, but if you encounter errors not listed here, please reach out to [email protected].

Invalid Authentication Credentials

{
  "message": "Invalid authentication credentials"
}

Solution: Check the SafeGraph Shop to ensure you are using the correct API key

No API Key

{
    "message": "No API key found in request"
}

Solution: Please enter the API key found in your SafeGraph Shop Account

Invalid Field

{
  "errors": [
    {
      "message": "Cannot query field 'abc' on type 'Patterns'. (line 18, column 7):\n      abc\n      ^",
      "locations": [
        {
          "line": 18,
          "column": 7
        }
      ]
    }
  ]
}

Solution: This typically means that one of the field names is incorrect or is listed in the incorrect dataset. For example, you can't look for visitor counts in the Core dataset (it's in Patterns). Reference the SafeGraph Response Datasets to check for accuracy of potential outputs.

Syntax Error

{
  "syntaxError": "Syntax error while parsing GraphQL query. Invalid input \"\"US\"\\n\\t\\t}) { \\n\\t\\tplacekey \\n\\t\\tsafegraph_patterns {\\n      location_name\\n      brands {\\n        brand_id\\n        brand_name\\n      } \\n      raw_visit_counts\\n      visits_by_day  \\n      \\n    \\n\\t}\\n}\\n\", expected Value, ObjectField, Argument, Directives or SelectionSet (line 7, column 22):\n\t\t\tiso_country_code: \"US\"\n                     ^",
  "locations": [
    {
      "line": 7,
      "column": 22
    }
  ]
}

Solution: This typically means that your GraphQL syntax is not consistent with requirements. The error message will attempt to pinpoint the part of the query that is causing issues. You can also reference our example code snippets for help with syntax. Be sure to check for any missing brackets, parens or commas.

Invalid endpoint URL

{"timestamp":1629000421996,"status":404,"error":"Not Found","message":"","path":"/places_api/v1/queryas"}

Solution: Check that the endpoint URL has been entered correctly.

Invalid Input values

If you enter invalid values for an input field, the query will simply not return any data. For example, searching for a brand_id that doesn't exist, adding an incorrect city or state name, etc.

{
  "data": {
    "place": null
  },
  "extensions": {
    "row_count": 0,
    "version_date": ""
  }
}

Solution : Review input parameters for errors and attempt again.