API Documentation

Reddit Search API

Search public Reddit posts, comments, communities, or media by keyword. Filter by time range or subreddit. Empty results and failures are free. Page size uses the service default.

Test API

Query public data using explicit parameters and saved real response examples.

Open the product page and test
POST https://api.goanyapi.com/api/v1/reddit/search

Request and authentication

Synchronous POST JSON endpoint; no task creation or polling. Authenticate with Authorization: Bearer YOUR_API_KEY. There are no Path or Query parameters.

Input parameters

Parameter Location Type Required Default Constraints and meaning
Authorization Header string Yes — Bearer YOUR_API_KEY
Content-Type Header string Yes application/json application/json
query JSON body string Yes — Search keywords. maxLength: 2048
sort JSON body string No relevance Result ordering. Values are case-sensitive. enum: "relevance", "hot", "top", "new", "comments" maxLength: 2048
type JSON body string No posts Search result type. posts returns data.result.posts, comments returns data.result.comments, communities returns data.result.communities, media returns data.result.posts. Only lists returned for the request appear. enum: "posts", "comments", "communities", "media"
time JSON body string No all Time range for the search. Keep this value unchanged when paging. enum: "hour", "day", "week", "month", "year", "all"
subreddit JSON body string No — Optional single-subreddit filter. Supply a name, r/name, or a full HTTPS Reddit subreddit or post URL. Keep the filter unchanged when paging. maxLength: 2048
cursor JSON body string No — Omit on the first request. Use data.result.next_cursor from the previous response unchanged; never invent a cursor. maxLength: 16384
feedLength JSON body integer No 0 Cumulative number of records returned on earlier pages, initially 0. This is not a page size. minimum: 0 maximum: 1000000

Each request returns one page. The number of records may vary with the filters.

sort

Value Default
"relevance" Yes
"hot" —
"top" —
"new" —
"comments" —

type

Value Default
"posts" Yes
"comments" —
"communities" —
"media" —

time

Value Default
"hour" —
"day" —
"week" —
"month" —
"year" —
"all" Yes

Request example

POST /api/v1/reddit/search
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "query": "united airlines",
  "sort": "relevance",
  "feedLength": 0
}

type = "posts"

POST /api/v1/reddit/search
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "query": "united airlines",
  "sort": "relevance",
  "feedLength": 0,
  "type": "posts",
  "time": "week",
  "subreddit": "r/unitedairlines"
}

type = "comments"

POST /api/v1/reddit/search
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "query": "united airlines",
  "sort": "relevance",
  "feedLength": 0,
  "type": "comments",
  "time": "week",
  "subreddit": "r/unitedairlines"
}

type = "communities"

POST /api/v1/reddit/search
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "query": "united airlines",
  "sort": "relevance",
  "feedLength": 0,
  "type": "communities",
  "time": "week"
}

type = "media"

POST /api/v1/reddit/search
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "query": "united airlines",
  "sort": "relevance",
  "feedLength": 0,
  "type": "media",
  "time": "week",
  "subreddit": "r/unitedairlines"
}

Result types

The requested type determines the result list. Omitting it searches posts. Lists that are not returned are omitted.

type Response list
posts data.result.posts
comments data.result.comments
communities data.result.communities
media data.result.posts

Output fields

Success returns HTTP 200 with business data in data.result. Null, empty strings, empty arrays and missing fields are preserved without fabricated data. False and zero are valid business values, not empty results.

Field Type Meaning
code string ok on success; public error code on failure
message string Request status message
data.result object / null Public result; may be empty or null
data.creditsUsed integer Actual credits charged; zero for empty results, database-configured rate otherwise
data.remainingCredits number Account credit balance after settlement
data.result.count integer Record count for this page, not the total across all pages
data.result.has_more boolean Whether more results may exist; no invented pagination without a usable cursor
data.result.next_cursor string / null Opaque next-page cursor; reuse unchanged only when nonempty, different and continuation is allowed
data.result.posts array Public business field; null, empty and missing values are preserved
data.result.posts[].author string / null Public business field; null, empty and missing values are preserved
data.result.posts[].authorId string / null Public business field; null, empty and missing values are preserved
data.result.posts[].awardCount number / null Public business field; null, empty and missing values are preserved
data.result.posts[].commentCount number / null Public business field; null, empty and missing values are preserved
data.result.posts[].contentUrl string / null Public business field; null, empty and missing values are preserved
data.result.posts[].createdAt string / null Public business field; null, empty and missing values are preserved
data.result.posts[].domain string / null Public business field; null, empty and missing values are preserved
data.result.posts[].id string Public business field; null, empty and missing values are preserved
data.result.posts[].images array Public business field; null, empty and missing values are preserved
data.result.posts[].language string / null Public business field; null, empty and missing values are preserved
data.result.posts[].score number / null Public business field; null, empty and missing values are preserved
data.result.posts[].state string / null Public business field; null, empty and missing values are preserved
data.result.posts[].subreddit string / null Public business field; null, empty and missing values are preserved
data.result.posts[].subredditId string / null Public business field; null, empty and missing values are preserved
data.result.posts[].text string / null Public business field; null, empty and missing values are preserved
data.result.posts[].title string / null Public business field; null, empty and missing values are preserved
data.result.posts[].type string / null Public business field; null, empty and missing values are preserved
data.result.posts[].upvoteRatio number / null Public business field; null, empty and missing values are preserved
data.result.posts[].url string / null Public business field; null, empty and missing values are preserved
data.result.posts[].video object / null Available video metadata; media URLs may expire
data.result.posts[].video.url string Public business field; null, empty and missing values are preserved
data.result.posts[].video.mimeType string Public business field; null, empty and missing values are preserved
data.result.posts[].video.hlsUrl string / null Public business field; null, empty and missing values are preserved
data.result.posts[].video.dashUrl string / null Public business field; null, empty and missing values are preserved
data.result.posts[].video.duration number / null Video duration in seconds
data.result.posts[].video.width number / null Public business field; null, empty and missing values are preserved
data.result.posts[].video.height number / null Public business field; null, empty and missing values are preserved
data.result.posts[].video.poster string / null Public business field; null, empty and missing values are preserved
data.result.posts[].video.captionUrl string / null Public business field; null, empty and missing values are preserved
data.result.posts[].video.variants array Public business field; null, empty and missing values are preserved
data.result.posts[].video.variants[].url string Public business field; null, empty and missing values are preserved
data.result.posts[].video.variants[].mimeType string Public business field; null, empty and missing values are preserved
data.result.posts[].video.variants[].width number / null Public business field; null, empty and missing values are preserved
data.result.posts[].video.variants[].height number / null Public business field; null, empty and missing values are preserved
data.result.posts[].video.variants[].bitrate number / null Public business field; null, empty and missing values are preserved
data.result.posts[].video.variants[].codec string / null Public business field; null, empty and missing values are preserved
data.result.comments array Public business field; null, empty and missing values are preserved
data.result.comments[].id string / null Public business field; null, empty and missing values are preserved
data.result.comments[].parentId string / null Public business field; null, empty and missing values are preserved
data.result.comments[].postId string / null Public business field; null, empty and missing values are preserved
data.result.comments[].postTitle string / null Public business field; null, empty and missing values are preserved
data.result.comments[].author string / null Public business field; null, empty and missing values are preserved
data.result.comments[].score number / null Public business field; null, empty and missing values are preserved
data.result.comments[].commentCount number / null Public business field; null, empty and missing values are preserved
data.result.comments[].depth number / null Public business field; null, empty and missing values are preserved
data.result.comments[].createdAt string / null Public business field; null, empty and missing values are preserved
data.result.comments[].url string / null Public business field; null, empty and missing values are preserved
data.result.comments[].text string / null Public business field; null, empty and missing values are preserved
data.result.comments[].subreddit string / null Public business field; null, empty and missing values are preserved
data.result.comments[].subredditId string / null Public business field; null, empty and missing values are preserved
data.result.comments[].nsfw boolean / null Public business field; null, empty and missing values are preserved
data.result.comments[].spoiler boolean / null Public business field; null, empty and missing values are preserved
data.result.communities array Public business field; null, empty and missing values are preserved
data.result.communities[].id string / null Public business field; null, empty and missing values are preserved
data.result.communities[].name string / null Public business field; null, empty and missing values are preserved
data.result.communities[].displayName string / null Public business field; null, empty and missing values are preserved
data.result.communities[].url string / null Public business field; null, empty and missing values are preserved
data.result.communities[].description string / null Public business field; null, empty and missing values are preserved
data.result.communities[].avatar string / null Public business field; null, empty and missing values are preserved
data.result.communities[].weeklyVisitors number / null Public business field; null, empty and missing values are preserved
data.result.communities[].weeklyContributions number / null Public business field; null, empty and missing values are preserved
data.result.communities[].nsfw boolean / null Public business field; null, empty and missing values are preserved
data.result.communities[].quarantined boolean / null Public business field; null, empty and missing values are preserved

Pagination and result boundaries

Omit cursor initially. For the next page, keep filters unchanged and pass data.result.next_cursor unchanged as cursor. Each page is a separate request; only nonempty successful results are charged. Stop when has_more is false or the cursor is empty or unchanged. Never invent a cursor.

feedLength is the cumulative number of records returned before this page, initially zero. Add the actual previous page list length when continuing. count describes only the current page, not an overall total.

Real response example

Captured at: 2026-11-18T09:31:47Z

This example uses the default post search mode (type = posts).

Saved from a real successful request, preserving all public result records. data.creditsUsed and data.remainingCredits are omitted; live responses include the current configured charge and balance. Displaying saved examples sends no query or charge; media URLs may expire.

{
  "code": "ok",
  "message": "ok",
  "data": {
    "result": {
      "posts": [
        {
          "id": "t3_1xy37z4",
          "title": "United Airlines says it is working to fix ‘widespread’ system outage",
          "author": "NW3",
          "authorId": "t2_f9u54",
          "score": null,
          "upvoteRatio": null,
          "commentCount": null,
          "createdAt": null,
          "type": null,
          "domain": null,
          "contentUrl": null,
          "url": "https://www.reddit.com/r/unitedairlines/comments/1xy37z4/united_airlines_says_it_is_working_to_fix/",
          "subreddit": "r/unitedairlines",
          "subredditId": "t5_2vmjq",
          "awardCount": null,
          "language": null,
          "state": null,
          "text": null,
          "images": [
            "https://styles.redditmedia.com/t5_2vmjq/styles/communityIcon_qcnp5rk9z28a1.png?width=64&frame=1&auto=webp&s=db812ffbdd668566f6dfd4f85a92ad2c14d3b609"
          ],
          "video": null
        },
        {
          "id": "t3_1xy3x8s",
          "title": "United Airlines just reported ANOTHER systemwide outage. First NVIDIA, then Microsoft, then the FAA ground stop, then banking apps and now United. What's your leading theory on all of this?",
          "author": "snowscovered",
          "authorId": "t2_z590g4jkw",
          "score": null,
          "upvoteRatio": null,
          "commentCount": null,
          "createdAt": null,
          "type": null,
          "domain": null,
          "contentUrl": null,
          "url": "https://www.reddit.com/r/AskReddit/comments/1xy3x8s/united_airlines_just_reported_another_systemwide/",
          "subreddit": "r/AskReddit",
          "subredditId": "t5_2qh1i",
          "awardCount": null,
          "language": null,
          "state": null,
          "text": null,
          "images": [
            "https://styles.redditmedia.com/t5_2qh1i/styles/communityIcon_p6kb2m6b185b1.png?width=64&frame=1&auto=webp&s=8e8d7fabcc18322bde1c5a388488f19477ed60ed"
          ],
          "video": null
        },
        {
          "id": "t3_1xy3659",
          "title": "United Airlines says it has a widespread system outage just days after nationwide ground stop",
          "author": "UBC145",
          "authorId": "t2_6p70ej85",
          "score": null,
          "upvoteRatio": null,
          "commentCount": null,
          "createdAt": null,
          "type": null,
          "domain": null,
          "contentUrl": null,
          "url": "https://www.reddit.com/r/news/comments/1xy3659/united_airlines_says_it_has_a_widespread_system/",
          "subreddit": "r/news",
          "subredditId": "t5_2qh3l",
          "awardCount": null,
          "language": null,
          "state": null,
          "text": null,
          "images": [
            "https://styles.redditmedia.com/t5_2qh3l/styles/communityIcon_fmygcobc22z81.png?width=64&frame=1&auto=webp&s=15e4415eb5a845375cc91d8125012005374f153c"
          ],
          "video": null
        },
        {
          "id": "t3_1xw9opa",
          "title": "UNACCEPTABLE Treatment of a LOYAL flyer. NEVER AGAIN",
          "author": "Alternative_Salad_83",
          "authorId": "t2_737mv2h1",
          "score": null,
          "upvoteRatio": null,
          "commentCount": null,
          "createdAt": null,
          "type": null,
          "domain": null,
          "contentUrl": null,
          "url": "https://www.reddit.com/r/unitedairlines/comments/1xw9opa/unacceptable_treatment_of_a_loyal_flyer_never/",
          "subreddit": "r/unitedairlines",
          "subredditId": "t5_2vmjq",
          "awardCount": null,
          "language": null,
          "state": null,
          "text": null,
          "images": [
            "https://styles.redditmedia.com/t5_2vmjq/styles/communityIcon_qcnp5rk9z28a1.png?width=64&frame=1&auto=webp&s=db812ffbdd668566f6dfd4f85a92ad2c14d3b609"
          ],
          "video": null
        },
        {
          "id": "t3_1xy34m2",
          "title": "United Airlines says it has a widespread system outage just days after nationwide ground stop",
          "author": "thatfreshjive",
          "authorId": "t2_exr56",
          "score": null,
          "upvoteRatio": null,
          "commentCount": null,
          "createdAt": null,
          "type": null,
          "domain": null,
          "contentUrl": null,
          "url": "https://www.reddit.com/r/technology/comments/1xy34m2/united_airlines_says_it_has_a_widespread_system/",
          "subreddit": "r/technology",
          "subredditId": "t5_2qh16",
          "awardCount": null,
          "language": null,
          "state": null,
          "text": null,
          "images": [
            "https://b.thumbs.redditmedia.com/J_fCwTYJkoM-way-eaOHv8AOHoF_jNXNqOvPrQ7bINY.png"
          ],
          "video": null
        },
        {
          "id": "t3_1xxvjrc",
          "title": "For $400 an hour, yes, I'll kick myself off the flight.",
          "author": "The_Chieftain_WG",
          "authorId": "t2_8za88",
          "score": null,
          "upvoteRatio": null,
          "commentCount": null,
          "createdAt": null,
          "type": null,
          "domain": null,
          "contentUrl": null,
          "url": "https://www.reddit.com/r/unitedairlines/comments/1xxvjrc/for_400_an_hour_yes_ill_kick_myself_off_the_flight/",
          "subreddit": "r/unitedairlines",
          "subredditId": "t5_2vmjq",
          "awardCount": null,
          "language": null,
          "state": null,
          "text": null,
          "images": [
            "https://styles.redditmedia.com/t5_2vmjq/styles/communityIcon_qcnp5rk9z28a1.png?width=64&frame=1&auto=webp&s=db812ffbdd668566f6dfd4f85a92ad2c14d3b609"
          ],
          "video": null
        },
        {
          "id": "t3_1xy376b",
          "title": "United Airlines experiencing a widespread system outage, airline says",
          "author": "Stock412",
          "authorId": "t2_6ucns",
          "score": null,
          "upvoteRatio": null,
          "commentCount": null,
          "createdAt": null,
          "type": null,
          "domain": null,
          "contentUrl": null,
          "url": "https://www.reddit.com/r/sysadmin/comments/1xy376b/united_airlines_experiencing_a_widespread_system/",
          "subreddit": "r/sysadmin",
          "subredditId": "t5_2qnp7",
          "awardCount": null,
          "language": null,
          "state": null,
          "text": null,
          "images": [
            "https://styles.redditmedia.com/t5_2qnp7/styles/communityIcon_gcx9bz62dbg01.png?width=64&frame=1&auto=webp&s=a28cc248064bce907c57266cb1a2ada1375d5e1c"
          ],
          "video": null
        }
      ],
      "count": 7,
      "next_cursor": "eyJjYW5kaWRhdGVzX3JldHVybmVkIjoie1wic2VjdGlvbl8xX3BpcGVsaW5lXzBfZ2xvYmFsX21vZGlmaWVyc1wiOlwiMVwiLFwic2VjdGlvbl8xX3BpcGVsaW5lXzFfbG9jYWxfbW9kaWZpZXJzXCI6XCIyXCIsXCJzZWN0aW9uXzJfcGlwZWxpbmVfMTBfcXVlcnlfc3VnZ2VzdGlvbnNcIjpcIjZcIixcInNlY3Rpb25fMl9waXBlbGluZV84X2R5bmFtaWNfNF9hbnN3ZXJzX3ByZXZpZXdcIjpcIjBcIixcInNlY3Rpb25fMl9waXBlbGluZV84X2R5bmFtaWNfNV9wb3N0X3NlYXJjaFwiOlwiN1wiLFwic2VjdGlvbl8zX3BpcGVsaW5lXzBfZHluYW1pY18wX3N1YnJlZGRpdF9zZWFyY2hcIjpcIjVcIixcInNlY3Rpb25fM19waXBlbGluZV8wX2R5bmFtaWNfMV9hdXRob3Jfc2VhcmNoXCI6XCIxXCJ9IiwiZHluYW1pY19hbGxfcmFua2VyIjoibGVnYWN5X2Fuc3dlcnMiLCJleHBlcmllbmNlX3NlbGVjdGlvbiI6ImR5bmFtaWNfYWxsIiwiZXhwZXJpZW5jZV92ZXJzaW9uIjoiZGVza3RvcCIsInNlY3Rpb25fMl9waXBlbGluZV84X2R5bmFtaWNfNV9wb3N0X3NlYXJjaCI6IjcifQ==",
      "has_more": true
    }
  }
}

Billing

…

Only nonempty successful results are charged at the current database-configured rate. Empty results and failures are free; internal identifier handling has no additional charge. Each page settles separately. Valid false and zero results are not treated as empty.

Status codes

HTTP Meaning
200 Success, including free empty results
400 Invalid JSON, parameters or resource URL
401 Authentication required or invalid credentials
402 Insufficient credits
429 Rate limited; follow Retry-After
502 Data request failed
503 API or pricing is not configured