Ayrshare Error Codes
Ayrshare specific returned error codes.
The REST API will include a response with a list of errors if applicable.
Error have a returned status code of 400, 401, 403, 404, 429, or 500. Success has a returned status code 200. See here for details.
Errors are often dynamic and specific to the API call made.
For example, a post that is considered a duplicate by Twitter and Facebook would return the following response.
1
{
2
"status": "error",
3
"errors": [
4
{
5
"action": "post",
6
"status": "error",
7
"code": 110,
8
"message": "Status is a duplicate.",
9
"post": "Today is a great day",
10
"platform": "twitter"
11
},
12
{
13
"action": "post",
14
"status": "error",
15
"code": 107,
16
"message": "Facebook Error: This status update is identical to the last one you posted. Try posting something different, or delete your previous update.",
17
"platform": "facebook"
18
}
19
],
20
"postIds": [],
21
"id": "6APU4qqI7XO7JM3BOy6B"
22
}
Copied!
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 the status 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.
1
{
2
"status": "error",
3
"errors": [
4
{
5
"action": "post",
6
"status": "error",
7
"code": 161,
8
"message": "Facebook authorization error. This can occur if your Facebook security changes. Try unlinking and re-linking Facebook or contact us for assistance.",
9
"platform": "facebook"
10
}
11
],
12
"postIds": [],
13
"id": "gh7SyTpeD2CQAMxWk3oh",
14
"post": "A great Facebook Posts"
15
}
Copied!
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:
1
{
2
"status": "error",
3
"errors": [
4
{
5
"action": "post",
6
"status": "error",
7
"code": 138,
8
"message": "Instagram Error: There was an issue posting to Instagram. The submitted image with aspect ratio ('1440/2158',) cannot be published. Please submit an image with a valid aspect ratio.",
9
"platform": "instagram"
10
}
11
],
12
"postIds": [],
13
"id": "Jxe2nMM3FmEvMXFSY3g4",
14
"post": "Is this a good image?"
15
}
Copied!
An action might be resending the images with the correct ratio.
Copy link