Status Codes
Here are explanations of various status codes you may receive on API responses.
status code | response body | cause (description) |
---|---|---|
200 | { "data":"...", "usage": {"credits": 10} } | The status code 200 means OK or Successfully and your response is ready. |
201 | { "data": {"request_id": "abcd-1234"}, "usage": {"credits": 10} } | The first time you send a request, you will get a response like this that stores the request_id for your request. you have to use this request_id in your next request until get the service response (Learn more) |
400 | {"message": "Your request is invalid. request body should be a valid json."} | 400 - Bad Request: A reason that may cause this status code, is sending a request with an invalid request body (JSON). For example, if you forget a comma symbol, or do not close curly braces etc. they lead to a response with this status code. |
401 | {"message": "Authentication Failed."} | 401 - Unauthorized: The status code 401 means you are not authorized correctly by api-key on request headers. There are different reasons the MagicalAPI API Gateway may send a response with this 401 status code : 1. Forgetting to set api-key in the request's headers, and makes this response message. 2. If you set an invalid api-key also leads to this status code. |
Updated 6 days ago