Imgur post
One public Imgur post: title, description, date, views, upvotes, downvotes, points, score, virality, comment and favourite counts, tags, author, and every image or video in it (URL, type, size, dimensions, duration, sound). Posts marked mature answer 403. Pass include=comments for the comment threads.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
idrequired | string | Imgur post id or a gallery/album URL (url is accepted too). Example: 0LVYtsP |
include | comments | comments: also return the post's comments in comment_list (text, author, points, up and down votes, date, and the replies nested under each, up to 200 top-level comments). Costs one more upstream request. |
comments_sort | best | top | new | Order of comment_list: best (default), top or new. |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/imgur/v1/post?id=0LVYtsP" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/imgur/v1/post",
params={"id": "0LVYtsP"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/imgur/v1/post");
url.searchParams.set("id", "0LVYtsP");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).