validate

Validate Social Posts and JSON

Required a Premium or Business Plan.

The following endpoints validate social posts and a JSON objects.

Validate a Post

POST https://app.ayrshare.com/api/validate/post

Useful for pre-validating a post before publishing.

Instead of publishing a post with the /post endpoint, use the /validate/post endpoint to verify the content and parameters are correct. Validate by sending the exact same JSON you normally send to the /post endpoint.

Validation tests based on Ayrshare's own internal algorithms.

Posts are not sent to the social networks.

Posts may still return an error by the social networks even with a passed validation.

Please see the /post endpoint for sending a post.

Headers

NameTypeDescription

Authorization*

string

Format: Authorization: Bearer API_KEY. See Overview for more information.

Request Body

NameTypeDescription

String

{
    "status": "success",
    "message": "No validation issues were found with this post. This is only an Ayrshare validation test and the post may still return an error by the social networks.",
}

Validate JSON

POST https://app.ayrshare.com/api/validate/json

Send JSON to validate if correctly formatted. You can validate your JSON by using either an online linter, such as https://jsonlint.com/ or using Postman.

If you use no-code tool such as Bubble or Make or receive a 500 "Bad Request" response, this endpoint is useful to debug the JSON request.

Headers

NameTypeDescription

Authorization*

string

Format: Authorization: Bearer API_KEY. See Overview for more information.

{
    "status": "success",
    "message": "Valid JSON. Nice Job!"
}
  • Send data as text. If using Postman, please be sure to select "Text" as the type.

  • Set the "Content-Type": "text/plain".

Example Request

An example of invalid JSON using Postman. Can you spot it? A missing comma at the end on the second parameter platforms.

Be sure to set the Content-Type in the header as text/plain and select "Text" when sending.


Check Post Length

POST https://app.ayrshare.com/api/validate/postLength

Calculate the weighted length, or character count, of a post string for Facebook, Google Business Profile, Instagram, LinkedIn, Pinterest, Reddit, TikTok, X/Twitter, and YouTube. Checks if the post length is valid and returns the maximum length allowed for each social network.

Special characters, such as ü, ø, or 😊, have a higher character count value (unicode).

Note: this check is automatically done with the /post endpoint.

Headers

NameTypeDescription

Authorization*

string

Format: Authorization: Bearer API_KEY See Overview for more information.

Request Body

NameTypeDescription

post*

string

Post string to calculated the length.

{
    "twitterWeightedLength": 1630,
    "instagramWeightedLength": 1630,
    "tikTokWeightedLength": 1630,
    "twitterValid": false,
    "facebookValid": true,
    "gmbValid": false,
    "instagramValid": true,
    "linkedInValid": true,
    "pinterestValid": false,
    "redditValid": true,
    "tikTokValid": true,
    "youtubeValid": true,
    "maxCharLimits": {
        "facebook": 63206,
        "gmb": 1500,
        "instagram": 2200,
        "linkedin": 3000,
        "pinterest": 500,
        "reddit": 10000,
        "tiktok": 2200,
        "twitter": 280,
        "youtube": 5000
    }
}

Request Examples

curl \
-H "Authorization: Bearer API Key" \
-H 'Content-Type: application/json' \
-d '{"post": "🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩"}' \
-X POST https://app.ayrshare.com/api/post/checkPostWeight

Last updated