### GET //.json Source: https://github.com/4chan/4chan-api/blob/master/pages/Endpoints_and_domains.md Retrieves a list of threads and their preview replies from a specified index page on a board. Index pages start at 1. ```APIDOC ## GET //.json ### Description Retrieves a list of threads and their preview replies from a specified index page. Index pages start at `1`. The maximum number of pages may vary depending on the board. ### Method GET ### Endpoint https://a.4cdn.org//.json ### Parameters #### Path Parameters - **board** (string) - Required - The acronym of the board (e.g., 'po' for Politically Incorrect). - **page#** (integer) - Required - The index page number (starts at 1). #### Query Parameters None ### Request Example ```json { "example": "GET https://a.4cdn.org/po/3.json" } ``` ### Response #### Success Response (200) - **threads** (array) - An array of thread objects, each containing thread ID, OP details, and preview replies. #### Response Example ```json { "example": "{\n \"threads\": [\n {\n \"no\": 570368,\n \"lastmod\": 1678886400,\n \"replies\": 150,\n \"images\": 75,\n \"semantic_url\": \"example-thread-title\",\n \"last_replies\": [\n {\n \"no\": 570369,\n \"name\": \"Anonymous\",\n \"com\": \"Example reply content...\",\n \"time\": 1678886401\n }\n // ... more replies ]\n }\n // ... more threads ]\n}" } ``` ``` -------------------------------- ### GET /boards Source: https://github.com/4chan/4chan-api/blob/master/pages/Catalog.md Retrieves a list of all available 4chan boards. ```APIDOC ## GET /boards ### Description Retrieves a list of all available 4chan boards, including their names, descriptions, and other relevant metadata. ### Method GET ### Endpoint /boards ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number to retrieve. ### Request Example ```json { "example": "GET /boards" } ``` ### Response #### Success Response (200) - **boards** (array) - An array of board objects, each containing: - **board** (string) - The board's short name. - **name** (string) - The full name of the board. - **threads** (integer) - The number of active threads on the board. - **posts** (integer) - The total number of posts on the board. - **is_default** (boolean) - Whether this is a default board. #### Response Example ```json { "example": "{\n \"boards\": [\n {\n \"board\": \"b\",\n \"name\": \"Random\",\n \"threads\": 1000,\n \"posts\": 50000,\n \"is_default\": true\n },\n {\n \"board\": \"a\",\n \"name\": \"Anime & Manga\",\n \"threads\": 500,\n \"posts\": 25000,\n \"is_default\": false\n }\n ]\n}" } ``` ``` -------------------------------- ### GET /boards Source: https://github.com/4chan/4chan-api/blob/master/pages/Boards.md Retrieves a list of all available 4chan boards with their respective settings and metadata. ```APIDOC ## GET /boards ### Description Retrieves a list of all available 4chan boards. Each board object contains details such as its ID, title, posting limits, cooldowns, and other configuration settings. ### Method GET ### Endpoint /boards ### Parameters #### Query Parameters None ### Request Example ``` GET /boards ``` ### Response #### Success Response (200) - **boards** (array) - An array of board objects. - **board** (string) - The short ID of the board. - **title** (string) - The full title of the board. - **ws_board** (integer) - Indicates if the board supports WebSocket functionality. - **per_page** (integer) - The number of threads displayed per page. - **pages** (integer) - The total number of pages for the board. - **max_filesize** (integer) - Maximum allowed file size in bytes. - **max_webm_filesize** (integer) - Maximum allowed WebM file size in bytes. - **max_comment_chars** (integer) - Maximum characters allowed in a comment. - **max_webm_duration** (integer) - Maximum duration for WebM videos in seconds. - **bump_limit** (integer) - The number of replies before a thread is bumped. - **image_limit** (integer) - The number of images allowed before a post is restricted. - **cooldowns** (object) - Posting cooldown periods in seconds. - **threads** (integer) - Cooldown for new threads. - **replies** (integer) - Cooldown for replies. - **images** (integer) - Cooldown for image posts. - **meta_description** (string) - A brief description of the board. - **spoilers** (integer) - Indicates if spoiler images are supported. - **custom_spoilers** (integer) - Indicates if custom spoiler images are supported. - **is_archived** (integer) - Indicates if the board is archived. - **forced_anon** (integer) - Indicates if all posts are anonymous. - **board_flags** (object) - Custom flags for the board. #### Response Example ```json { "boards": [ { "board": "a", "title": "Anime \u0026 Manga", "ws_board": 1, "per_page": 15, "pages": 10, "max_filesize": 4194304, "max_webm_filesize": 3145728, "max_comment_chars": 2000, "max_webm_duration": 120, "bump_limit": 500, "image_limit": 300, "cooldowns": { "threads": 600, "replies": 60, "images": 60 }, "meta_description": "\u0026quot;\/a\/ - Anime \u0026amp; Manga\u0026quot; is 4chan's imageboard dedicated to the discussion of Japanese animation and manga.", "spoilers": 1, "custom_spoilers": 1, "is_archived": 1 }, { "board": "b", "title": "Random", "ws_board": 0, "per_page": 15, "pages": 10, "max_filesize": 2097152, "max_webm_filesize": 2097152, "max_comment_chars": 2000, "max_webm_duration": 120, "bump_limit": 300, "image_limit": 150, "cooldowns": { "threads": 60, "replies": 15, "images": 15 }, "meta_description": "\u0026quot;\/b\/ - Random\u0026quot; is the birthplace of Anonymous, and where people go to discuss random topics and create memes on 4chan.", "forced_anon": 1, "board_flags": { "AB": "Flag Name AB", "XY": "Flag Name XY" } } ] } ``` ``` -------------------------------- ### GET //catalog.json Source: https://github.com/4chan/4chan-api/blob/master/pages/Endpoints_and_domains.md Retrieves a JSON representation of a board's catalog, including all original posts (OPs) and their preview replies. ```APIDOC ## GET //catalog.json ### Description Retrieves a JSON representation of a board's catalog, including all OPs and their preview replies. ### Method GET ### Endpoint https://a.4cdn.org//catalog.json ### Parameters #### Path Parameters - **board** (string) - Required - The acronym of the board (e.g., 'po' for Politically Incorrect). #### Query Parameters None ### Request Example ```json { "example": "GET https://a.4cdn.org/po/catalog.json" } ``` ### Response #### Success Response (200) - **catalog** (array) - An array of thread objects, each representing an OP and containing their post details and a preview of replies. #### Response Example ```json { "example": "{\n \"catalog\": [\n {\n \"no\": 570368,\n \"lastmod\": 1678886400,\n \"replies\": 150,\n \"images\": 75,\n \"semantic_url\": \"example-thread-title\",\n \"last_replies\": [\n {\n \"no\": 570369,\n \"name\": \"Anonymous\",\n \"com\": \"Example reply content...\",\n \"time\": 1678886401\n }\n // ... more replies ]\n }\n // ... more threads ]\n}" } ``` ``` -------------------------------- ### GET /board/{board}/threads Source: https://github.com/4chan/4chan-api/blob/master/pages/Catalog.md Retrieves a list of threads for a specific board. ```APIDOC ## GET /board/{board}/threads ### Description Retrieves a list of all active threads for a given 4chan board. Each thread object contains information about the thread's posts, images, and last modified time. ### Method GET ### Endpoint /board/{board}/threads ### Parameters #### Path Parameters - **board** (string) - Required - The short name of the board (e.g., 'b' for Random). #### Query Parameters - **page** (integer) - Optional - The page number of threads to retrieve. ### Request Example ```json { "example": "GET /board/b/threads?page=2" } ``` ### Response #### Success Response (200) - **page** (integer) - The current page number. - **threads** (array) - An array of thread objects, each containing: - **no** (integer) - The thread number. - **now** (string) - The time the thread was created. - **name** (string) - The name of the thread creator. - **com** (string) - The comment of the first post. - **filename** (string) - The filename of the attached image. - **ext** (string) - The file extension of the attached image. - **w** (integer) - The width of the attached image. - **h** (integer) - The height of the attached image. - **tn_w** (integer) - The thumbnail width. - **tn_h** (integer) - The thumbnail height. - **tim** (integer) - The timestamp of the attached image. - **time** (integer) - The Unix timestamp of the post. - **md5** (string) - The MD5 hash of the attached image. - **fsize** (integer) - The file size of the attached image. - **resto** (integer) - The ID of the thread this post belongs to (0 for OP). - **bumplimit** (integer) - The bump limit for the thread. - **imagelimit** (integer) - The image limit for the thread. - **semantic_url** (string) - A URL-friendly version of the thread title. - **replies** (integer) - The number of replies in the thread. - **images** (integer) - The number of images in the thread. - **omitted_posts** (integer) - The number of omitted posts. - **omitted_images** (integer) - The number of omitted images. - **last_replies** (array) - An array of the last few replies in the thread. - **last_modified** (integer) - The Unix timestamp of the last modification. #### Response Example ```json { "example": "{\n \"page\": 2,\n \"threads\": [\n {\n \"no\": 568362,\n \"now\": \"10\/05\/18(Fri)13:53:57\",\n \"name\": \"Anonymous\",\n \"com\": \"This is a comment!\",\n \"filename\": \"IMG_20181005_181107-1\",\n \"ext\": \".jpg\",\n \"w\": 373,\n \"h\": 654,\n \"tn_w\": 142,\n \"tn_h\": 250,\n \"tim\": 1538762037790,\n \"time\": 1538762037,\n \"md5\": \"HTvheK4HTgbXKRqMQ0vrXA==\",\n \"fsize\": 48770,\n \"resto\": 0,\n \"bumplimit\": 0,\n \"imagelimit\": 0,\n \"semantic_url\": \"my-girlfriends-birthday-and-id-like-to-make-her\",\n \"replies\": 55,\n \"images\": 7,\n \"omitted_posts\": 50,\n \"omitted_images\": 7,\n \"last_replies\": [\n {\n \"no\": 570857,\n \"now\": \"01\/20\/19(Sun)19:18:28\",\n \"name\": \"Anonymous\",\n \"com\": \"This is a comment!\",\n \"time\": 1548029908,\n \"resto\": 568362\n }\n ],\n \"last_modified\": 1566367619\n }\n ]\n}" } ``` ``` -------------------------------- ### GET /boards.json Source: https://github.com/4chan/4chan-api/blob/master/pages/Boards.md Retrieves a comprehensive list of all boards on 4chan, including their major settings and attributes. ```APIDOC ## GET /boards.json ### Description This endpoint returns a JSON object containing a list of all available boards on 4chan. Each board object includes various attributes detailing its configuration, such as file size limits, page settings, and feature flags. ### Method GET ### Endpoint /boards.json ### Parameters #### Query Parameters None ### Request Example ```json { "example": "GET https://a.4cdn.org/boards.json" } ``` ### Response #### Success Response (200) - **boards** (array) - An array of board objects. - **board** (string) - The directory the board is located in. - **title** (string) - The readable title of the board. - **ws_board** (integer) - Indicates if the board is worksafe (1 for yes, 0 for no). - **per_page** (integer) - Number of threads on a single index page. - **pages** (integer) - Number of index pages for the board. - **max_filesize** (integer) - Maximum file size allowed for non-.webm attachments (in KB). - **max_webm_filesize** (integer) - Maximum file size allowed for .webm attachments (in KB). - **max_comment_chars** (integer) - Maximum characters allowed in a post comment. - **max_webm_duration** (integer) - Maximum duration of a .webm attachment (in seconds). - **bump_limit** (integer) - Maximum replies before a thread stops bumping. - **image_limit** (integer) - Maximum image replies per thread before image replies are discarded. - **cooldowns** (object) - Cooldown settings for the board. - **meta_description** (string) - SEO meta description content for the board. - **spoilers** (integer, optional) - Indicates if spoilers are enabled (1 for yes, 0 for no). - **custom_spoilers** (integer, optional) - Number of custom spoilers available. - **is_archived** (integer, optional) - Indicates if archives are enabled for the board (1 for yes, 0 for no). - **board_flags** (array, optional) - Array of flag codes mapped to flag names. - **country_flags** (integer, optional) - Indicates if country flags are enabled (1 for yes, 0 for no). - **user_ids** (integer, optional) - Indicates if user ID tags are enabled (1 for yes, 0 for no). - **oekaki** (integer, optional) - Indicates if Oekaki drawing functionality is enabled (1 for yes, 0 for no). - **sjis_tags** (integer, optional) - Indicates if SJIS tags are supported (1 for yes, 0 for no). - **code_tags** (integer, optional) - Indicates if code tags are supported (1 for yes, 0 for no). - **math_tags** (integer, optional) - Indicates if math tags (TeX, eqn) are supported (1 for yes, 0 for no). - **text_only** (integer, optional) - Indicates if image posting is disabled (1 for yes, 0 for no). - **forced_anon** (integer, optional) - Indicates if the name field is disabled (1 for yes, 0 for no). - **webm_audio** (integer, optional) - Indicates if webms with audio are allowed (1 for yes, 0 for no). - **require_subject** (integer, optional) - Indicates if OPs require a subject (1 for yes, 0 for no). - **min_image_width** (integer, optional) - Minimum image width in pixels. - **min_image_height** (integer, optional) - Minimum image height in pixels. *Note: `integer` values of 1 represent 'on' and 0 represent 'off'. Optional fields only appear if enabled for the board.* #### Response Example ```json { "example": "{\n \"boards\": [\n {\n \"board\": \"b\",\n \"title\": \"Random\",\n \"ws_board\": 0,\n \"per_page\": 10,\n \"pages\": 10,\n \"max_filesize\": 4194304,\n \"max_webm_filesize\": 104857600,\n \"max_comment_chars\": 5000,\n \"max_webm_duration\": 300,\n \"bump_limit\": 500,\n \"image_limit\": 100,\n \"cooldowns\": {\n \"threads\": 300,\n \"replies\": 60,\n \"images\": 120\n },\n \"meta_description\": \"/b/ - Random\",\n \"spoilers\": 0,\n \"custom_spoilers\": 0,\n \"is_archived\": 0,\n \"board_flags\": [],\n \"country_flags\": 0,\n \"user_ids\": 0,\n \"oekaki\": 0,\n \"sjis_tags\": 0,\n \"code_tags\": 0,\n \"math_tags\": 0,\n \"text_only\": 0,\n \"forced_anon\": 0,\n \"webm_audio\": 0,\n \"require_subject\": 0,\n \"min_image_width\": 0,\n \"min_image_height\": 0\n }\n // ... more board objects\n ]\n}" } ``` ``` -------------------------------- ### GET /catalog.json Source: https://github.com/4chan/4chan-api/blob/master/pages/Catalog.md Retrieves a comprehensive list of all threads and their attributes on a specific board. The data is grouped by 'page' and represents a board catalog page. ```APIDOC ## GET /catalog.json ### Description Retrieves a comprehensive list of all threads and their attributes on a specific board. The data is grouped by 'page' and represents a board catalog page. ### Method GET ### Endpoint `https://a.4cdn.org/{board}/catalog.json` ### Parameters #### Path Parameters - **board** (string) - Required - The identifier for the board (e.g., 'po', 'g'). #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Content-Type**: application/json - **Body**: A JSON object containing a list of threads, grouped by page. #### Response Example ```json { "page": 1, "threads": [ { "no": 123456, "last_modified": 1678886400, "replies": 50, "images": 10, "unique_ips": 25, "semantic_url": "example-thread-title", "id": 123456, "title": "Example Thread Title", "name": "Anonymous", "com": "

This is the first post.

", "filename": "image.jpg", "ext": ".jpg", "fsize": 102400, "w": 800, "h": 600, "tn_w": 100, "tn_h": 75, "tim": "1678886400123", "time": 1678886400, "md5": "a1b2c3d4e5f67890abcdef1234567890", "fsize_is_image": 1, "restored_post": 0, "sticky": 1, "closed": 0 } ] } ``` ``` -------------------------------- ### GET /board/{board}/thread/{thread} Source: https://github.com/4chan/4chan-api/blob/master/pages/Catalog.md Retrieves a specific thread from a board, including all its posts. ```APIDOC ## GET /board/{board}/thread/{thread} ### Description Retrieves a specific thread from a given 4chan board, including all its posts and associated media information. ### Method GET ### Endpoint /board/{board}/thread/{thread} ### Parameters #### Path Parameters - **board** (string) - Required - The short name of the board (e.g., 'b' for Random). - **thread** (integer) - Required - The ID of the thread to retrieve. ### Request Example ```json { "example": "GET /board/b/thread/1234567" } ``` ### Response #### Success Response (200) - **posts** (array) - An array of post objects within the thread, each containing: - **no** (integer) - The post number. - **now** (string) - The time the post was created. - **name** (string) - The name of the post creator. - **com** (string) - The comment of the post. - **filename** (string) - The filename of the attached image. - **ext** (string) - The file extension of the attached image. - **w** (integer) - The width of the attached image. - **h** (integer) - The height of the attached image. - **tn_w** (integer) - The thumbnail width. - **tn_h** (integer) - The thumbnail height. - **tim** (integer) - The timestamp of the attached image. - **time** (integer) - The Unix timestamp of the post. - **md5** (string) - The MD5 hash of the attached image. - **fsize** (integer) - The file size of the attached image. - **resto** (integer) - The ID of the thread this post belongs to (0 for OP). #### Response Example ```json { "example": "{\n \"posts\": [\n {\n \"no\": 1234567,\n \"now\": \"06\/28\/19(Fri)21:24:42\",\n \"name\": \"New Thread on Origami July 2019\",\n \"com\": \"Let's start a new thread since the previous one has been archived\",\n \"filename\": \"main-qimg-05ffefcf21e1c8a3f6d7b50b999d0c99-c\",\n \"ext\": \".jpg\",\n \"w\": 500,\n \"h\": 378,\n \"tn_w\": 250,\n \"tn_h\": 189,\n \"tim\": 1561771482133,\n \"time\": 1561771482,\n \"md5\": \"sRkYWy2xOCTQ1H\/sHYjFYw==\",\n \"fsize\": 84219,\n \"resto\": 0\n },\n {\n \"no\": 576173,\n \"now\": \"08\/22\/19(Thu)16:58:51\",\n \"name\": \"Anonymous\",\n \"com\": \"Comment\",\n \"time\": 1566507531,\n \"resto\": 574933\n }\n ]\n}" } ``` ``` -------------------------------- ### Get All Boards and Settings (Bash) Source: https://context7.com/4chan/4chan-api/llms.txt Fetches a list of all available 4chan boards along with their configuration settings such as posting limits, file size restrictions, and enabled features. This endpoint is useful for understanding board-specific rules and capabilities. It utilizes `curl` to make the request and `jq` to parse the JSON response. ```bash # Fetch all boards and their settings curl -s "https://a.4cdn.org/boards.json" | jq '.' # Example response structure { "boards": [{ "board": "a", "title": "Anime & Manga", "ws_board": 1, "per_page": 15, "pages": 10, "max_filesize": 4194304, "max_webm_filesize": 3145728, "max_comment_chars": 2000, "max_webm_duration": 120, "bump_limit": 500, "image_limit": 300, "cooldowns": { "threads": 600, "replies": 60, "images": 60 }, "meta_description": "...", "spoilers": 1, "custom_spoilers": 1, "is_archived": 1 }] } # Check if a board has archives enabled curl -s "https://a.4cdn.org/boards.json" | jq '.boards[] | select(.board == "po") | .is_archived' # Output: 1 # List all worksafe boards curl -s "https://a.4cdn.org/boards.json" | jq '[.boards[] | select(.ws_board == 1) | .board]' ``` -------------------------------- ### GET //thread/.json Source: https://github.com/4chan/4chan-api/blob/master/pages/Endpoints_and_domains.md Retrieves a full list of posts within a single thread on a board. ```APIDOC ## GET //thread/.json ### Description Retrieves a full list of posts in a single thread. ### Method GET ### Endpoint https://a.4cdn.org//thread/.json ### Parameters #### Path Parameters - **board** (string) - Required - The acronym of the board (e.g., 'po' for Politically Incorrect). - **OP #** (integer) - Required - The ID number of the original post (OP) of the thread. #### Query Parameters None ### Request Example ```json { "example": "GET https://a.4cdn.org/po/thread/570368.json" } ``` ### Response #### Success Response (200) - **posts** (array) - An array of post objects, each containing details of a post within the thread. #### Response Example ```json { "example": "{\n \"posts\": [\n {\n \"no\": 570368,\n \"now\": \"03/15/23(Wed)10:00:00\",\n \"name\": \"Anonymous\",\n \"com\": \"This is the original post content.\",\n \"filename\": \"example.jpg\",\n \"ext\": \".jpg\",\n \"w\": 800,\n \"h\": 600,\n \"tn_w\": 250,\n \"tn_h\": 187,\n \"tim\": \"1678886400000\",\n \"time\": 1678886400,\n \"md5\": \"...\",\n \"fsize\": 102400,\n \"resto\": 0,\n \"capcode\": \"\",\n \"email\": \"\",\n \"last_modified\": 1678886400,\n \"replies\": 150,\n \"images\": 75,\n \"bumplimit\": 400,\n \"imagelimit\": 10\n },\n {\n \"no\": 570369,\n \"now\": \"03/15/23(Wed)10:05:00\",\n \"name\": \"Anonymous\",\n \"com\": \"This is a reply to the original post.\",\n \"time\": 1678886700,\n \"resto\": 570368,\n \"capcode\": \"\",\n \"email\": \"\"\n }\n // ... more posts ]\n}" } ``` ``` -------------------------------- ### Get Board Catalog Source: https://context7.com/4chan/4chan-api/llms.txt Retrieves the full catalog of a board as a JSON representation, containing all thread OPs with their preview replies grouped by page. ```APIDOC ## GET /{board}/catalog.json ### Description Retrieves the full catalog of a board as a JSON representation, containing all thread OPs with their preview replies grouped by page. This endpoint provides thread metadata, image information, and recent replies in a single request. ### Method GET ### Endpoint `https://a.4cdn.org/{board}/catalog.json` ### Parameters #### Path Parameters - **board** (string) - Required - The identifier of the board (e.g., `po`). #### Query Parameters None #### Request Body None ### Request Example ```bash curl -s "https://a.4cdn.org/po/catalog.json" | jq '.' ``` ### Response #### Success Response (200) - **page** (integer) - The page number. - **threads** (array) - An array of thread objects. - **no** (integer) - The thread number (OP ID). - **sticky** (integer) - Indicates if the thread is stickied (1) or not (0). - **closed** (integer) - Indicates if the thread is closed (1) or not (0). - **now** (string) - Timestamp of the post in `MM/DD/YY(Day)HH:MM:SS` format. - **name** (string) - The name of the poster. - **sub** (string) - The subject of the thread. - **com** (string) - The comment content of the post. - **filename** (string) - The original filename of the attached file. - **ext** (string) - The file extension. - **w** (integer) - Width of the image in pixels. - **h** (integer) - Height of the image in pixels. - **tim** (integer) - Timestamp for the file. - **time** (integer) - Timestamp of the post. - **md5** (string) - MD5 hash of the file. - **fsize** (integer) - File size in bytes. - **resto** (integer) - The ID of the post this is a reply to (0 for OP). - **capcode** (string) - Capcode of the poster (e.g., `mod`, `admin`). - **semantic_url** (string) - A URL-friendly version of the thread subject. - **replies** (integer) - Number of replies in the thread. - **images** (integer) - Number of images in the thread. - **omitted_posts** (integer) - Number of omitted posts. - **omitted_images** (integer) - Number of omitted images. - **last_replies** (array) - An array of the last few replies. - **no** (integer) - Reply ID. - **now** (string) - Timestamp of the reply. - **name** (string) - Name of the replier. - **com** (string) - Content of the reply. - **time** (integer) - Timestamp of the reply. - **resto** (integer) - The OP ID this reply belongs to. - **capcode** (string) - Capcode of the replier. - **last_modified** (integer) - Timestamp of the last modification. #### Response Example ```json [ { "page": 1, "threads": [ { "no": 570368, "sticky": 1, "closed": 1, "now": "12/31/18(Mon)17:05:48", "name": "Anonymous", "sub": "Welcome to /po/!", "com": "Welcome to /po/! We specialize in origami...", "filename": "yotsuba_folding", "ext": ".png", "w": 530, "h": 449, "tim": 1546293948883, "time": 1546293948, "md5": "uZUeZeB14FVR+Mc2ScHvVA==", "fsize": 516657, "resto": 0, "capcode": "mod", "semantic_url": "welcome-to-po", "replies": 2, "images": 2, "omitted_posts": 1, "omitted_images": 1, "last_replies": [ { "no": 570371, "now": "12/31/18(Mon)17:21:29", "name": "Anonymous", "com": "FAQs about origami...", "time": 1546294889, "resto": 570368, "capcode": "mod" } ], "last_modified": 1546294897 } ] } ] ``` ``` -------------------------------- ### GET /{board}/{page}.json Source: https://context7.com/4chan/4chan-api/llms.txt Retrieves a specific index page of a board, containing threads with their preview replies. Index pages range from 1 to the maximum number of pages for each board. ```APIDOC ## Get Index Page ### Description Retrieves a specific index page of a board containing threads with their preview replies. Index pages range from 1 to the maximum number of pages configured for each board (found in boards.json). ### Method GET ### Endpoint `/{board}/{page}.json` ### Parameters #### Path Parameters - **board** (string) - Required - The short name of the board (e.g., "po"). - **page** (integer) - Required - The index page number to retrieve (starting from 1). ### Request Example ```bash curl -s "https://a.4cdn.org/po/2.json" | jq '.' ``` ### Response #### Success Response (200) - **threads** (array) - An array of thread objects. - **posts** (array) - An array of post objects representing the OP and preview replies. - **no** (integer) - Post number. - **sticky** (integer) - Indicates if the thread is sticky (1) or not (0). - **closed** (integer) - Indicates if the thread is closed (1) or not (0). - **now** (string) - Timestamp of the post. - **name** (string) - Name of the poster. - **sub** (string) - Subject of the post. - **com** (string) - Comment body of the post. - **filename** (string) - Filename of the attached file. - **ext** (string) - File extension of the attachment. - **tim** (integer) - Unique timestamp identifier for the file. - **time** (integer) - Unix timestamp of the post. - **resto** (integer) - The ID of the OP post this post is a reply to (0 for OP). - **semantic_url** (string) - A URL-friendly version of the post subject. - **replies** (integer) - Number of replies in the thread. - **images** (integer) - Number of images in the thread. - **unique_ips** (integer) - Number of unique IP addresses that posted in the thread. - **omitted_posts** (integer) - Number of posts omitted (if more than preview). - **omitted_images** (integer) - Number of images omitted (if more than preview). #### Response Example ```json { "threads": [ { "posts": [ { "no": 570368, "sticky": 1, "closed": 1, "now": "12/31/18(Mon)17:05:48", "name": "Anonymous", "sub": "Welcome to /po/!", "com": "Welcome to /po/...", "filename": "yotsuba_folding", "ext": ".png", "tim": 1546293948883, "time": 1546293948, "resto": 0, "semantic_url": "welcome-to-po", "replies": 2, "images": 2, "unique_ips": 1 }, { "no": 570370, "com": "FAQs about papercraft...", "resto": 570368 } ] } ] } ``` ``` -------------------------------- ### Get Thread List Source: https://context7.com/4chan/4chan-api/llms.txt Returns a summarized list of all threads on a board organized by page number, including thread OP numbers, last modification timestamps, and reply counts. ```APIDOC ## GET /{board}/threads.json ### Description Returns a summarized list of all threads on a board organized by page number, including thread OP numbers, last modification timestamps, and reply counts. Useful for monitoring thread activity without fetching full content. ### Method GET ### Endpoint `https://a.4cdn.org/{board}/threads.json` ### Parameters #### Path Parameters - **board** (string) - Required - The identifier of the board (e.g., `po`). #### Query Parameters None #### Request Body None ### Request Example ```bash curl -s "https://a.4cdn.org/po/threads.json" | jq '.' ``` ### Response #### Success Response (200) - **page** (integer) - The page number. - **threads** (array) - An array of thread objects. - **no** (integer) - The thread number (OP ID). - **last_modified** (integer) - Timestamp of the last modification. - **replies** (integer) - Number of replies in the thread. #### Response Example ```json [ { "page": 1, "threads": [ { "no": 570368, "last_modified": 1546294897, "replies": 2 }, { "no": 567982, "last_modified": 1566438201, "replies": 63 } ] }, { "page": 2, "threads": [ { "no": 575972, "last_modified": 1566435330, "replies": 2 } ] } ] ``` ``` -------------------------------- ### threads.json Structure Example Source: https://github.com/4chan/4chan-api/blob/master/pages/Threadlist.md This JSON snippet demonstrates the structure of the threads.json file, showing an array of page objects, each containing an array of thread objects. Each thread object includes its OP number, last modified timestamp, and reply count. ```json [{ "page": 1, "threads": [{ "no": 570368, "last_modified": 1546294897, "replies": 2 }, { "no": 567982, "last_modified": 1566438201, "replies": 63 }, { "no": 574224, "last_modified": 1566456119, "replies": 4 }, { "no": 576101, "last_modified": 1566406602, "replies": 0 }, { "no": 553409, "last_modified": 1566391725, "replies": 250 }, { "no": 545554, "last_modified": 1566367896, "replies": 169 }] }, { "page": 2, "threads": [{ "no": 575972, "last_modified": 1566435330, "replies": 2 }, { "no": 576045, "last_modified": 1566309370, "replies": 2 }, { "no": 576048, "last_modified": 1566275920, "replies": 1 }] }] ``` -------------------------------- ### Get Index Page Data from 4chan API Source: https://context7.com/4chan/4chan-api/llms.txt Retrieves a specific index page of a board, containing threads with their preview replies. Index pages range from 1 to the maximum number of pages configured for each board. This endpoint requires a board identifier and a page number. ```bash # Fetch page 2 of /po/ board curl -s "https://a.4cdn.org/po/2.json" | jq '.' # Example response structure { "threads": [{ "posts": [{ "no": 570368, "sticky": 1, "closed": 1, "now": "12/31/18(Mon)17:05:48", "name": "Anonymous", "sub": "Welcome to /po/!", "com": "Welcome to /po/!", "filename": "yotsuba_folding", "ext": ".png", "tim": 1546293948883, "time": 1546293948, "resto": 0, "semantic_url": "welcome-to-po", "replies": 2, "images": 2, "unique_ips": 1 }, { "no": 570370, "com": "FAQs about papercraft...", "resto": 570368 }] }] } # Get all thread OPs from an index page curl -s "https://a.4cdn.org/po/1.json" | jq '[.threads[].posts[0]]' # Count threads on a page curl -s "https://a.4cdn.org/po/1.json" | jq '.threads | length' # Get threads with omitted posts (indicating more replies exist) curl -s "https://a.4cdn.org/po/1.json" | jq '[.threads[].posts[0] | select(.omitted_posts > 0) | {no, omitted_posts, omitted_images}]' ``` -------------------------------- ### Archive JSON Structure Example Source: https://github.com/4chan/4chan-api/blob/master/pages/Archive.md This JSON snippet demonstrates the structure of the archive.json file. It is a simple array containing integers, where each integer represents the OP number of an archived thread on a 4chan board. This format is consistent across all boards that have archives enabled. ```json [ 571958, 572866, 54195, 574342, 574378, 574398, 574417, 574426, 574435, 574453, 574486, 574510, 574586, 574588 ] ``` -------------------------------- ### Construct and Access User Media URLs on 4chan Source: https://context7.com/4chan/4chan-api/llms.txt User-submitted images and thumbnails are served from `i.4cdn.org`. This section explains how to construct URLs for images and thumbnails using the `tim` (timestamp) and `ext` (file extension) values from thread post data. It also shows how to download all images from a thread. ```bash # Construct image URL from thread post data # Format: https://i.4cdn.org/[board]/[tim].[ext] # Example from post with tim=1546293948883 and ext=".png" curl -I "https://i.4cdn.org/po/1546293948883.png" # Thumbnail URL (append 's' before extension, always .jpg) # Format: https://i.4cdn.org/[board]/[tim]s.jpg curl -I "https://i.4cdn.org/po/1546293948883s.jpg" # Download all images from a thread curl -s "https://a.4cdn.org/po/thread/570368.json" | jq -r ' .posts[] | select(.tim != null) | "curl -O https://i.4cdn.org/po/(.tim)(.ext)" ' | sh ```