First, read through our API introduction article for info on how to work with our API playground and make API calls.
Next, make an API call with the following GraphQL query:
mutation createRedditPost(
$redditUsername: String!
$title: String!
$content: String
$link: String
$mediaName: String
$comment: String
$submissions: [SubmissionInput]!
$sendRepliesToInbox: Boolean
$nsfw: Boolean
) {
createRedditPost(
redditUsername: $redditUsername
title: $title
content: $content
link: $link
mediaName: $mediaName
comment: $comment
submissions: $submissions
sendRepliesToInbox: $sendRepliesToInbox
nsfw: $nsfw
) {
success
errors
validationErrors {
code
message
}
}
}
Pass the following variables to the query:
{
"redditUsername": "YOUR_USERNAME",
"title": "This is a post",
"content": "",
"link": "https://google.com",
"mediaName": "",
"comment": "",
"submissions": [
{
"subreddit": "python",
"postAt": "2024-10-05T14:30",
"flairId": ""
},
{
"subreddit": "webdev",
"postAt": "2024-10-05T14:30",
"flairId": ""
}
],
"sendRepliesToInbox": true,
"nsfw": false
}