Search Media
Image and video posts matching a query, about 7 a page.
GET
apiKeyheader
AuthorizationBearer <token>An API key from the dashboard: Authorization: Bearer sapi_….
query*stringWhat to search for.
sort?stringrelevance (the default), hot, top, new or comments.
Value in
"relevance""hot""top""new""comments"time?stringhour, day, week, month, year or all (the default).
Value in
"hour""day""week""month""year""all"cursor?stringnextCursor of the previous page.
maxAge?integerHow old a cached answer may be, in seconds; 0 always fetches. Default and most: the endpoint's cache lifetime.
Format
int64Range
0 <= valueThe answer.
application/json- response
A page of a list, as every list endpoint answers: { "data": [...], "pagination": … }.
data*array<>pagination*import { SocialAPI } from "@socialapihq/sdk";const client = new SocialAPI({ apiKey: process.env.SOCIALAPI_API_KEY });const { data, pagination } = await client.reddit.searchMedia({ query: "espresso" });Example Response
{ "data": [ { "id": "1xoogji", "url": "https://www.reddit.com/r/espresso/comments/1xoogji/finally_happy_with_a_home_espresso_setup_under_600/", "text": null, "createdAt": null, "author": { "id": "1w5q10h42h", "username": "Tall_Lie_7683", "displayName": null, "avatarUrl": null, "verified": false, "url": "https://www.reddit.com/user/Tall_Lie_7683/" }, "stats": { "views": null, "likes": null, "comments": null, "shares": null, "saves": null, "engagementRate": null }, "media": [], "hashtags": [], "mentions": [], "ext": { "title": "Finally happy with a home espresso setup. (Under $600)", "kind": "text", "subreddit": "espresso", "score": null, "upvoteRatio": null, "link": null, "domain": null, "flair": null, "nsfw": false, "spoiler": false, "locked": false, "stickied": false, "crossposts": null, "crosspostOf": null, "awards": null, "editedAt": null, "snippet": null } }, { "id": "upk2me", "url": "https://www.reddit.com/r/espresso/comments/upk2me/respresso_starter_pack/", "text": null, "createdAt": null, "author": { "id": "76nqkhwa", "username": "Icy_Ad4208", "displayName": null, "avatarUrl": null, "verified": false, "url": "https://www.reddit.com/user/Icy_Ad4208/" }, "stats": { "views": null, "likes": null, "comments": null, "shares": null, "saves": null, "engagementRate": null }, "media": [], "hashtags": [], "mentions": [], "ext": { "title": "r/Espresso starter pack", "kind": "text", "subreddit": "espresso", "score": null, "upvoteRatio": null, "link": null, "domain": null, "flair": null, "nsfw": false, "spoiler": false, "locked": false, "stickied": false, "crossposts": null, "crosspostOf": null, "awards": null, "editedAt": null, "snippet": null } } ], "pagination": { "nextCursor": "L3N2Yy9zaHJlZGRpdC9zZWFyY2gvP3E9ZXNwcmVzc28mdHlwZT1tZWRpYSZzb3J0PXJlbGV2YW5jZSZ0PWFsbCZjdXJzb3I9ZXlKallXNWthV1JoZEdWelgzSmxkSFZ5Ym1Wa0lqb2llMXdpYzJWamRHbHZibDh4WDNCcGNHVnNhVzVsWHpCZloyeHZZbUZzWDIxdlpHbG1hV1Z5YzF3aU9sd2lNVndpTEZ3aWMyVmpkR2x2Ymw4eFgzQnBjR1ZzYVc1bFh6RmZiRzlqWVd4ZmJXOWthV1pwWlhKelhDSTZYQ0l5WENJc1hDSnpaV04wYVc5dVh6SmZjR2x3Wld4cGJtVmZNbDl3YjNOMFgzTmxZWEpqYUZ3aU9sd2lOMXdpZlNJc0ltVjRjR1Z5…", "hasMore": true }}