Ayrshare Error Codes
Ayrshare specific returned error codes.
The REST API will include a response with a list of errors if applicable.
Errors have a returned status code of 400, 401, 403, 404, 429, or 500. Success has a returned status code 200. See here for details.
Each API call can return different errors depending on the specific request and any issues encountered at the social network. The error response will contain details about what went wrong during the API call.
For example, a post that is considered a duplicate by Twitter and Facebook would return the following response.
Please note:
The
errors
field contains the array of errors, one per social network that had an error.- The
action
refers to the type of error returned. The top-level
status
field will be “error” if the API call failed. For example, for a /post call if all social network posting were successful thestatus
field will be “success”, else the status field will be “error”.- The
code
field contains the Ayrshare reference error code. - The
message
field is the specific details of the error.
Handling Errors
You should handle any error responses and take the appropriate action. An error occurred if:
- The response return code is not
200
- The JSON response status is
error
For example, if Facebook link was removed by your user - they changed their password or removed Ayrshare’s access - the following response would occur when posting with a 400 Bad Request
response code.
An action might be to notify your user via your dashboard, text or email.
Another example is if the posted Instagram image is the wrong dimensions or ratio with a 400 Bad Request
response code:
An action might be resending the images with the correct ratio.
Retry Available
Sometimes the social networks have a unrecoverable error, such as their are having server issues, and the call ultimately fails even after numerous retries.
In those cases, our system will determine if the error is retryable and if so, the retryAvailable
field will be true
.
You can then retry the call with the same payload. If it is a post you can use the retry post endpoint.
Error Message Translation
Error messages can be automatically translated to the language of your choice. This is useful if you want to display the error directly to your user in their preferred language.
In the header include:
Where the Language_Code
is one of the available language codes.
For example, the following will translate the error to French.
Our system will automatically detect the error message language.