Reddit

Options for posting via the API to Reddit

Reddit API Endpoints

Overview

The following are required body parameters for posting to Reddit. Please be sure the subreddit allows automated posting.

{
    "post": "Reddit post",                // required
    "platforms": ["reddit"],              // required
    "redditOptions": {
        "title": "Reddit Post Title",     // required
        "subreddit": "test",              // required (no "/r/" needed)
        "link": "https://www.website.com", // optional: post a link 
    } 
}
  • title (required): The title of the post on Reddit.

  • subreddit (required): The subreddit to send the post. Please be sure to follow the subreddit's posting guidelines. A good subreddit to use for testing is /r/test/ and can be viewed at: https://www.reddit.com/r/test/

  • link (optional): If posting to Reddit and you want to post a link instead of text to the subreddit. While the post parameter text is still required, it is not included in the post since Reddit links can't have a text body.

Always check the rules of the subreddit before posting. Some subreddits have a karma threshold, require membership for a time period, limit the frequency of posting, don't allow images, or require flair to be added. Also, most subreddits have specific rules on spam and self-promotion. Not following these rules can result in being banned by the subreddit or Reddit.

Posting an Image to Reddit

Post an image to Reddit either by including the image URL in the mediaUrl parameter or the link parameter of redditOptions. Images posted as a link will resolve to the full image.

The post parameter text is ignored, but is still required to successfully submit the post. Reddit restricts posting images and text together to their online "fancy pants" editor. This means either an image or text can be posted, but not both at the same time.

{
    "post": "Reddit post",                // required, but not added to the post
    "platforms": ["reddit"],              // required
    "mediaUrls": "https://my-media-url.com", 
    "redditOptions": {
        "title": "Reddit Post Title",     // required
        "subreddit": "test",              // required (no "/r/" needed)
    } 
} 

Add Reddit Flair

Some subreddits require flair. Subreddit moderators pre-define the flair and each flair has a unique ID. In the Reddit post to Ayrshare add the flair ID and an optional flair text if the text can be overridden.

"redditOptions": {
        "flairId": "jM8nH92enjswas",        // Id of the flair
        "flairText": "My New Flair text",   // Override the flair text if allowed by flair
 } 

You can find the flair ID of a subreddit by calling the /post/redditFlair endpoint.

Retrieve Subreddit Flair

GET https://app.ayrshare.com/api/post/redditFlair/:subreddit

Some subreddits require flair to be added to posts. Retrieve the flair id for a subreddit to be used with a Reddit post.

Path Parameters

Headers

{
    "flairs": [
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "General",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "General"
                }
            ],
            "backgroundColor": "#24a0ed",
            "id": "835693e2-f4c6-11e8-9b68-0ef1d31d47f4"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Vehicles - Model S",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Vehicles - Model S"
                }
            ],
            "backgroundColor": "#ff5c52",
            "id": "d65a3bf8-2e3f-11ea-b1df-0e48b758f1d1"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Vehicles - Model 3",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Vehicles - Model 3"
                }
            ],
            "backgroundColor": "#ff5c52",
            "id": "dcd4dfba-2e3f-11ea-ae0a-0e08fd0921a5"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Vehicles - Model X",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Vehicles - Model X"
                }
            ],
            "backgroundColor": "#ff5c52",
            "id": "e3b80334-2e3f-11ea-9319-0ef0666f4955"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Vehicles - Model Y",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Vehicles - Model Y"
                }
            ],
            "backgroundColor": "#ff5c52",
            "id": "e8d3c3e4-2e3f-11ea-8503-0e7d8ba95ee7"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Vehicles - Roadster",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Vehicles - Roadster"
                }
            ],
            "backgroundColor": "#ff5c52",
            "id": "9b5a153c-2fe8-11ea-84b3-0e3dc676291d"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Vehicles - Cybertruck",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Vehicles - Cybertruck"
                }
            ],
            "backgroundColor": "#ff5c52",
            "id": "f7bd2d96-2e3f-11ea-8af4-0e84bb2efd99"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Vehicles - Semi",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Vehicles - Semi"
                }
            ],
            "backgroundColor": "#ff5c52",
            "id": "08e0e25c-2e40-11ea-8503-0e7d8ba95ee7"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Energy - General",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Energy - General"
                }
            ],
            "backgroundColor": "#349e48",
            "id": "300915fc-2e40-11ea-bf20-0e5f8d7121e9"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Energy - Charging",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Energy - Charging"
                }
            ],
            "backgroundColor": "#349e48",
            "id": "26c0bde0-4ada-11ea-a6c2-0e37bd75c65b"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Energy - Residential",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Energy - Residential"
                }
            ],
            "backgroundColor": "#349e48",
            "id": "3c552d28-2e40-11ea-91af-0efac8321a7d"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Energy - Commercial",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Energy - Commercial"
                }
            ],
            "backgroundColor": "#349e48",
            "id": "6c3da4e4-3f71-11ed-bf3a-e2b38500a359"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "$TSLA Investing - Financials/Earnings",
            "maxEmojis": 10,
            "textColor": "dark",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "$TSLA Investing - Financials/Earnings"
                }
            ],
            "backgroundColor": "#94e044",
            "id": "260deb6a-fb68-11ed-b8f9-fe172b851044"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "$TSLA Investing - Bullish",
            "maxEmojis": 10,
            "textColor": "dark",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "$TSLA Investing - Bullish"
                }
            ],
            "backgroundColor": "#94e044",
            "id": "35318c0a-fb68-11ed-ac39-ae5f0d523a9a"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "$TSLA Investing - Bearish",
            "maxEmojis": 10,
            "textColor": "dark",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "$TSLA Investing - Bearish"
                }
            ],
            "backgroundColor": "#94e044",
            "id": "4739d7ea-fb68-11ed-825c-dee75c150cc6"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Factories - General",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Factories - General"
                }
            ],
            "backgroundColor": "#646d73",
            "id": "971ac264-3f71-11ed-a80d-be048f065daa"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Factories - Fremont, California",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Factories - Fremont, California"
                }
            ],
            "backgroundColor": "#646d73",
            "id": "9f03fc98-3f71-11ed-a464-22492ba9dd17"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Factories - Austin, Texas",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Factories - Austin, Texas"
                }
            ],
            "backgroundColor": "#646d73",
            "id": "a3cfad80-3f71-11ed-a86b-b6b3d0e0d7bd"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Factories - Buffalo, New York",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Factories - Buffalo, New York"
                }
            ],
            "backgroundColor": "#646d73",
            "id": "a941fe4e-3f71-11ed-8f4f-6ef3febda094"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Factories - Sparks, Nevada",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Factories - Sparks, Nevada"
                }
            ],
            "backgroundColor": "#646d73",
            "id": "aeabb0d2-3f71-11ed-97b0-22ecff9f5113"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Factories - Shanghai, China",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Factories - Shanghai, China"
                }
            ],
            "backgroundColor": "#646d73",
            "id": "b65cf386-3f71-11ed-a39c-c293bd1546c0"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Factories - Berlin, Germany",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Factories - Berlin, Germany"
                }
            ],
            "backgroundColor": "#646d73",
            "id": "155d7b10-578e-11ed-a0d2-d2bc46bf7da2"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Factories - Lathrop, California",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Factories - Lathrop, California"
                }
            ],
            "backgroundColor": "#646d73",
            "id": "f15c7f0a-8874-11ed-ab66-96069cfc53e3"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Factories - Monterrey, Mexico",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Factories - Monterrey, Mexico"
                }
            ],
            "backgroundColor": "#646d73",
            "id": "097e95ca-b9d3-11ed-94a1-7a457264f9ca"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Software - General",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Software - General"
                }
            ],
            "backgroundColor": "#0079d3",
            "id": "e1df8ffa-3f71-11ed-bc64-2aaa808ece5c"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Software - Tesla App",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Software - Tesla App"
                }
            ],
            "backgroundColor": "#0079d3",
            "id": "f5d33e68-2197-11ee-97e0-9e68d8ed8435"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Software - Autopilot",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Software - Autopilot"
                }
            ],
            "backgroundColor": "#0079d3",
            "id": "e71da20e-3f71-11ed-a4ea-d2f3dc1b4cf7"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Software - Full Self-Driving",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Software - Full Self-Driving"
                }
            ],
            "backgroundColor": "#0079d3",
            "id": "fa5e9a58-3f71-11ed-b0e0-1a8e6d6659f3"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Software - AI / Optimus / Dojo",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Software - AI / Optimus / Dojo"
                }
            ],
            "backgroundColor": "#0079d3",
            "id": "00b3b44c-3f72-11ed-911c-ea0c960aabdf"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Hardware - General",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Hardware - General"
                }
            ],
            "backgroundColor": "#005ba1",
            "id": "4d9ddd0a-3f72-11ed-9dcb-362c5016d5b6"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Hardware - Autopilot",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Hardware - Autopilot"
                }
            ],
            "backgroundColor": "#005ba1",
            "id": "56876012-3f72-11ed-a892-2271fd05c94a"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Hardware - Full Self-Driving",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Hardware - Full Self-Driving"
                }
            ],
            "backgroundColor": "#005ba1",
            "id": "5c26f334-3f72-11ed-a350-7acd016cd487"
        },
        {
            "type": "richtext",
            "textEditable": false,
            "allowableContent": "all",
            "text": "Hardware - AI / Optimus / Dojo",
            "maxEmojis": 10,
            "textColor": "light",
            "modOnly": false,
            "cssClass": "",
            "richtext": [
                {
                    "e": "text",
                    "t": "Hardware - AI / Optimus / Dojo"
                }
            ],
            "backgroundColor": "#005ba1",
            "id": "70f05e86-3f72-11ed-8307-d25f6730a03f"
        }
    ],
    "lastUpdated": "2023-11-06T21:35:11.119Z",
    "nextUpdate": "2023-11-06T21:46:11.119Z"
}

For example here is the call to retrieve the flair for the subreddit teslamotors:

GET https://app.ayrshare.com/api/post/redditFlair/teslamotors

FAQ

How do I add rich text formatting to Reddit posts?

If you want to add bold, italic, or superscript text to a Reddit post, use Reddit-flavored Markdown.

{
    "post": "For example, this can be *italic* or **bold** or ^super ",
    "platforms": [
        "reddit"
    ],
    "redditOptions": {
        "title": "Rich Text Post",
        "subreddit": "test"
    }
}

Last updated