{
  "openapi": "3.1.0",
  "info": {
    "title": "FetchLayer Reddit API — Discover",
    "version": "1.0.0",
    "description": "Trending content and community exploration."
  },
  "servers": [
    {
      "url": "https://api.fetchlayer.dev/reddit"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Send your FetchLayer key as Authorization: Bearer ss-your-key. No Reddit OAuth credentials are required."
      }
    }
  },
  "paths": {
    "/popular": {
      "post": {
        "operationId": "popular",
        "tags": [
          "Discover"
        ],
        "summary": "r/popular — trending posts across Reddit right now",
        "description": "Get the current r/popular feed. See what's trending across all of Reddit in real time.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "number",
                    "description": "Maximum number of posts to return.",
                    "example": "25"
                  },
                  "pages": {
                    "type": "number",
                    "description": "Maximum number of pages to scrape. Each page holds 25 results. If omitted, results continue until `limit` is reached (or the 45s time budget ends, returning partial results with `incompleteReason: \"scrape_timeout\"`), billed as `ceil(items returned / 25)`. If passed, results are capped at that many pages and billed per page actually returned (see `pagesScraped` in the response)."
                  }
                },
                "additionalProperties": false
              },
              "examples": {
                "default": {
                  "value": {
                    "limit": 10
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "blocked": {
                      "type": "boolean",
                      "description": "Whether Reddit returned a block or verification page."
                    },
                    "blockReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Machine-readable block reason when blocked is true; otherwise omitted."
                    },
                    "blockedBodyText": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Diagnostic block-page text when blocked is true; otherwise omitted."
                    },
                    "pageTitle": {
                      "type": "string",
                      "description": "Title of the scraped Reddit page."
                    },
                    "requestedUrl": {
                      "type": "string",
                      "description": "Reddit URL requested by the scraper."
                    },
                    "fetchUrl": {
                      "type": "string",
                      "description": "Normalized Reddit URL fetched by the scraper."
                    },
                    "finalUrl": {
                      "type": "string",
                      "description": "Final URL after redirects."
                    },
                    "responseStatus": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "HTTP status returned by Reddit, or null when unavailable."
                    },
                    "listingType": {
                      "type": "string",
                      "description": "Always popular for a successful response."
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Reddit post ID without the t3_ prefix."
                          },
                          "fullname": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Reddit post fullname, including the t3_ prefix."
                          },
                          "subreddit": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Subreddit name without the r/ prefix."
                          },
                          "subredditPrefixed": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Subreddit name with the r/ prefix."
                          },
                          "author": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Author username."
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Post title."
                          },
                          "permalink": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Absolute URL of the Reddit comments page."
                          },
                          "shortlink": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Short redd.it URL for the post."
                          },
                          "url": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Absolute post content URL."
                          },
                          "domain": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Hostname or Reddit domain associated with the post."
                          },
                          "createdAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "ISO 8601 creation timestamp."
                          },
                          "flair": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Post flair text, or null when absent."
                          },
                          "score": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Post score."
                          },
                          "scoreText": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Score text as displayed by Reddit."
                          },
                          "commentCount": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Comment count."
                          },
                          "commentCountText": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Comment count text as displayed by Reddit."
                          },
                          "previewText": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Text preview for self posts, or null when unavailable."
                          },
                          "thumbnailUrl": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Post thumbnail URL, or null when unavailable."
                          },
                          "nsfw": {
                            "type": "boolean",
                            "description": "Whether the post is marked NSFW."
                          },
                          "spoiler": {
                            "type": "boolean",
                            "description": "Whether the post is marked as a spoiler."
                          },
                          "locked": {
                            "type": "boolean",
                            "description": "Whether the post is locked."
                          },
                          "stickied": {
                            "type": "boolean",
                            "description": "Whether the post is stickied."
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "listingTitle": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Display title of the listing, or null when unavailable."
                    },
                    "itemCount": {
                      "type": "number",
                      "description": "Number of entries returned in items."
                    },
                    "nextPageUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Next-page URL when available, otherwise null."
                    },
                    "prevPageUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Previous-page URL when available, otherwise null."
                    },
                    "pagesRequested": {
                      "type": "number",
                      "description": "Number of pages requested."
                    },
                    "pagesScraped": {
                      "type": "number",
                      "description": "Number of pages successfully scraped. This is what the request is billed at: 1 credit per page actually scraped, never per page requested."
                    },
                    "scrapedAt": {
                      "type": "string",
                      "description": "ISO 8601 timestamp for the scrape."
                    },
                    "transport": {
                      "type": "string",
                      "description": "Reddit page transport used for extraction."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "blocked": false,
                      "listingType": "popular",
                      "items": [
                        {
                          "id": "xyz",
                          "title": "Trending post",
                          "subreddit": "popular",
                          "author": "user123",
                          "score": 10000,
                          "commentCount": 2000,
                          "permalink": "https://www.reddit.com/r/popular/comments/xyz/",
                          "createdAt": "2026-08-13T03:00:00.000Z",
                          "nsfw": false,
                          "spoiler": false,
                          "locked": false,
                          "stickied": false
                        }
                      ],
                      "itemCount": 1,
                      "pagesRequested": 1,
                      "pagesScraped": 1,
                      "transport": "old-reddit-html"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/leaderboard": {
      "post": {
        "operationId": "leaderboard",
        "tags": [
          "Discover"
        ],
        "summary": "Popular communities leaderboard",
        "description": "Get Reddit’s popular-community listing with names, descriptions, URLs, metadata text, and NSFW status.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "number",
                    "description": "Number of communities.",
                    "example": "25"
                  },
                  "pages": {
                    "type": "number",
                    "description": "Maximum number of pages to scrape. Each page is fetched as a separate call and billed as one, so the credits a request costs equal the pages it actually scrapes (see `pagesScraped` in the response).",
                    "example": "1"
                  }
                },
                "additionalProperties": false
              },
              "examples": {
                "default": {
                  "value": {
                    "limit": 10
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "blocked": {
                      "type": "boolean",
                      "description": "Whether Reddit returned a block or verification page."
                    },
                    "blockReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Machine-readable block reason when blocked is true; otherwise omitted."
                    },
                    "blockedBodyText": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Diagnostic block-page text when blocked is true; otherwise omitted."
                    },
                    "pageTitle": {
                      "type": "string",
                      "description": "Title of the scraped Reddit page."
                    },
                    "requestedUrl": {
                      "type": "string",
                      "description": "Reddit URL requested by the scraper."
                    },
                    "fetchUrl": {
                      "type": "string",
                      "description": "Normalized Reddit URL fetched by the scraper."
                    },
                    "finalUrl": {
                      "type": "string",
                      "description": "Final URL after redirects."
                    },
                    "responseStatus": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "HTTP status returned by Reddit, or null when unavailable."
                    },
                    "listingType": {
                      "type": "string",
                      "description": "Always leaderboard for a successful response."
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "subreddit": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Subreddit name without the r/ prefix."
                          },
                          "subredditPrefixed": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Subreddit name with the r/ prefix."
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Community display title."
                          },
                          "descriptionText": {
                            "type": "string",
                            "description": "Plain-text community description."
                          },
                          "descriptionHtml": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "HTML community description when available."
                          },
                          "url": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Absolute subreddit URL."
                          },
                          "metaText": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Metadata text displayed by Reddit."
                          },
                          "nsfw": {
                            "type": "boolean",
                            "description": "Whether the community marks itself as 18+ (NSFW)."
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "listingTitle": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Display title of the listing, or null when unavailable."
                    },
                    "itemCount": {
                      "type": "number",
                      "description": "Number of entries returned in items."
                    },
                    "nextPageUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Next-page URL when available, otherwise null."
                    },
                    "prevPageUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Previous-page URL when available, otherwise null."
                    },
                    "pagesRequested": {
                      "type": "number",
                      "description": "Number of pages requested."
                    },
                    "pagesScraped": {
                      "type": "number",
                      "description": "Number of pages successfully scraped. This is what the request is billed at: 1 credit per page actually scraped, never per page requested."
                    },
                    "scrapedAt": {
                      "type": "string",
                      "description": "ISO 8601 timestamp for the scrape."
                    },
                    "transport": {
                      "type": "string",
                      "description": "Reddit page transport used for extraction."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "blocked": false,
                      "listingType": "leaderboard",
                      "items": [
                        {
                          "subreddit": "programming",
                          "subredditPrefixed": "r/programming",
                          "title": "Programming",
                          "descriptionText": "Computer Programming",
                          "url": "https://www.reddit.com/r/programming/",
                          "metaText": "Popular community",
                          "nsfw": false
                        }
                      ],
                      "itemCount": 1,
                      "pagesRequested": 1,
                      "pagesScraped": 1,
                      "transport": "old-reddit-html"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/explore": {
      "post": {
        "operationId": "explore",
        "tags": [
          "Discover"
        ],
        "summary": "Browse communities grouped by topic",
        "description": "Explore subreddits organized by topic/category. Returns a curated list of communities across different interests.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "topic": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Optional Reddit explore topic filter."
                  }
                },
                "additionalProperties": false
              },
              "examples": {
                "default": {
                  "value": {
                    "topic": "technology"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "blocked": {
                      "type": "boolean",
                      "description": "Whether Reddit returned a block or verification page."
                    },
                    "blockReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Machine-readable block reason when blocked is true; otherwise omitted."
                    },
                    "blockedBodyText": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Diagnostic block-page text when blocked is true; otherwise omitted."
                    },
                    "pageTitle": {
                      "type": "string",
                      "description": "Title of the scraped Reddit page."
                    },
                    "requestedUrl": {
                      "type": "string",
                      "description": "Reddit URL requested by the scraper."
                    },
                    "fetchUrl": {
                      "type": "string",
                      "description": "Normalized Reddit URL fetched by the scraper."
                    },
                    "finalUrl": {
                      "type": "string",
                      "description": "Final URL after redirects."
                    },
                    "responseStatus": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "HTTP status returned by Reddit, or null when unavailable."
                    },
                    "listingType": {
                      "type": "string",
                      "description": "Always explore for a successful response."
                    },
                    "sections": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "heading": {
                            "type": "string",
                            "description": "Explore section heading."
                          },
                          "items": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "subreddit": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "Subreddit name without the r/ prefix."
                                },
                                "subredditPrefixed": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "Subreddit name with the r/ prefix."
                                },
                                "subredditId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "Reddit subreddit ID."
                                },
                                "title": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "Community title."
                                },
                                "descriptionText": {
                                  "type": "string",
                                  "description": "Plain-text community description."
                                },
                                "iconUrl": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "Community icon URL."
                                },
                                "url": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "Absolute subreddit URL."
                                },
                                "weeklyVisitorsText": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "Weekly visitors text displayed by Reddit."
                                }
                              },
                              "additionalProperties": false
                            }
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "allItems": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "subreddit": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Subreddit name without the r/ prefix."
                          },
                          "subredditPrefixed": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Subreddit name with the r/ prefix."
                          },
                          "subredditId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Reddit subreddit ID."
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Community title."
                          },
                          "descriptionText": {
                            "type": "string",
                            "description": "Plain-text community description."
                          },
                          "iconUrl": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Community icon URL."
                          },
                          "url": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Absolute subreddit URL."
                          },
                          "weeklyVisitorsText": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Weekly visitors text displayed by Reddit."
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "totalItemCount": {
                      "type": "number",
                      "description": "Total number of communities in allItems."
                    },
                    "topics": {
                      "type": "array",
                      "description": "Available explore topic filters.",
                      "items": {
                        "type": "string"
                      }
                    },
                    "scrapedAt": {
                      "type": "string",
                      "description": "ISO 8601 timestamp for the scrape."
                    },
                    "transport": {
                      "type": "string",
                      "description": "Reddit page transport used for extraction."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "blocked": false,
                      "listingType": "explore",
                      "sections": [
                        {
                          "heading": "Technology",
                          "items": [
                            {
                              "subreddit": "programming",
                              "subredditPrefixed": "r/programming",
                              "subredditId": "t5_2fwo",
                              "title": "Programming",
                              "descriptionText": "Computer Programming",
                              "url": "https://www.reddit.com/r/programming/"
                            }
                          ]
                        }
                      ],
                      "allItems": [],
                      "totalItemCount": 1,
                      "topics": [
                        "Technology"
                      ],
                      "transport": "new-reddit-html"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    }
  }
}