Handle request errors
Stay organized with collections
Save and categorize content based on your preferences.
European Economic Area (EEA) developers
The Routes API returns error messages as part of the
response to a method call. For example, if you omit the API key from the
request, the method returns:
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"
}
}
If you omit a required body parameter, such as origin
, the method
returns:
{
"error": {
"code": 400,
"message": "Origin and destination must be set.",
"status": "INVALID_ARGUMENT"
}
}
For more information on errors and error handling, see
Errors.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-28 UTC.
[null,null,["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThe Routes API provides error messages within its responses to indicate issues with the request.\u003c/p\u003e\n"],["\u003cp\u003eErrors are returned as JSON objects containing an \u003ccode\u003eerror\u003c/code\u003e field with details about the issue, such as a code, message, and status.\u003c/p\u003e\n"],["\u003cp\u003eMissing API keys result in a \u003ccode\u003ePERMISSION_DENIED\u003c/code\u003e error with a 403 code.\u003c/p\u003e\n"],["\u003cp\u003eOmitting required parameters like \u003ccode\u003eorigin\u003c/code\u003e leads to an \u003ccode\u003eINVALID_ARGUMENT\u003c/code\u003e error with a 400 code.\u003c/p\u003e\n"],["\u003cp\u003eFurther details on errors and their handling can be found in the Google Cloud API Design Guide on Errors.\u003c/p\u003e\n"]]],[],null,["# Handle request errors\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nThe Routes API returns error messages as part of the\nresponse to a method call. For example, if you omit the API key from the\nrequest, the method returns: \n\n```json\n{\n \"error\": {\n \"code\": 403,\n \"message\": \"The request is missing a valid API key.\",\n \"status\": \"PERMISSION_DENIED\"\n }\n}\n```\n\nIf you omit a required body parameter, such as `origin`, the method\nreturns: \n\n```json\n{\n \"error\": {\n \"code\": 400,\n \"message\": \"Origin and destination must be set.\",\n \"status\": \"INVALID_ARGUMENT\"\n }\n}\n```\n\nFor more information on errors and error handling, see\n[Errors](https://cloud.google.com/apis/design/errors)."]]