{"_id":"59778bba32f043002002f5e5","category":{"_id":"59778bb932f043002002f5d4","version":"59778bb932f043002002f5d3","project":"5425e663ffd4411c319a65b4","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-09-26T23:22:58.179Z","from_sync":false,"order":0,"slug":"getting-started","title":"Getting Started"},"project":"5425e663ffd4411c319a65b4","user":"5425e31affd4411c319a65b1","version":{"_id":"59778bb932f043002002f5d3","project":"5425e663ffd4411c319a65b4","__v":1,"createdAt":"2017-07-25T18:19:37.272Z","releaseDate":"2017-07-25T18:19:37.272Z","categories":["59778bb932f043002002f5d4","59778bb932f043002002f5d5"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.5.0","version":"2.5"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-09-29T19:41:41.761Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"never","params":[],"url":""},"isReference":false,"order":4,"body":"When something is wrong with a request, the API will respond with a non-```200``` status code. \n\nTo help you better understand the problem, where possible, the API overloads a number of different HTTP error codes. Additional information is provided by way of subcodes and cause strings, so your application logic has as much visibility as possible into what has gone wrong.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"An invalid request\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Here's an example response to a request with an invalid API key.\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -i -X GET \\\"https://onfleet.com/api/v2/auth/test\\\" \\\\\\n       -u \\\"thisIsNotAValidAPIKey:\\\"\",\n      \"language\": \"shell\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/1.1 401 Unauthorized\\n\\n{\\n  \\\"code\\\": \\\"InvalidCredentials\\\",\\n  \\\"message\\\": {\\n    \\\"error\\\": 1102,\\n    \\\"message\\\": \\\"The API key provided is invalid.\\\",\\n    \\\"request\\\": \\\"ec76efd0-b8c0-484a-ad5f-725c5bbee869\\\",\\n    \\\"cause\\\": \\\"This key does not exist or is no longer active.\\\"\\n  }\\n}\",\n      \"language\": \"http\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\nFor a more detailed look at the various error subcodes, their meaning and parent HTTP status codes, check out [this Gist](https://gist.github.com/euskode/8a34b2152cb35ddeb659), which will be frequently updated as the API's error handling evolves.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Getting help with errors\",\n  \"body\": \"If you run into any errors that you do not understand, take note of the request ID included in ```message.request``` and send this along to our support team for assistance.\"\n}\n[/block]","excerpt":"","slug":"errors","type":"basic","title":"Errors"}
When something is wrong with a request, the API will respond with a non-```200``` status code. To help you better understand the problem, where possible, the API overloads a number of different HTTP error codes. Additional information is provided by way of subcodes and cause strings, so your application logic has as much visibility as possible into what has gone wrong. [block:api-header] { "type": "basic", "title": "An invalid request", "sidebar": true } [/block] [block:textarea] { "text": "Here's an example response to a request with an invalid API key.", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "$ curl -i -X GET \"https://onfleet.com/api/v2/auth/test\" \\\n -u \"thisIsNotAValidAPIKey:\"", "language": "shell" } ], "sidebar": true } [/block] [block:code] { "codes": [ { "code": "HTTP/1.1 401 Unauthorized\n\n{\n \"code\": \"InvalidCredentials\",\n \"message\": {\n \"error\": 1102,\n \"message\": \"The API key provided is invalid.\",\n \"request\": \"ec76efd0-b8c0-484a-ad5f-725c5bbee869\",\n \"cause\": \"This key does not exist or is no longer active.\"\n }\n}", "language": "http" } ], "sidebar": true } [/block] For a more detailed look at the various error subcodes, their meaning and parent HTTP status codes, check out [this Gist](https://gist.github.com/euskode/8a34b2152cb35ddeb659), which will be frequently updated as the API's error handling evolves. [block:callout] { "type": "info", "title": "Getting help with errors", "body": "If you run into any errors that you do not understand, take note of the request ID included in ```message.request``` and send this along to our support team for assistance." } [/block]