### Resource Interaction Examples Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Examples demonstrating how to interact with Danbooru API resources using different HTTP methods and parameter encoding. ```APIDOC ## GET /posts/{id}.json ### Description Retrieves a JSON representation of a specific post. ### Method GET ### Endpoint /posts/{id}.json ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the post to retrieve. ### Response #### Success Response (200) - **post** (object) - Contains details of the post. #### Response Example { "post": { "id": 23, "tag_string": "example tag" } } ## GET /tags.json?search[name_matches]={pattern} ### Description Finds tags that match a given pattern. ### Method GET ### Endpoint /tags.json ### Parameters #### Query Parameters - **search[name_matches]** (string) - Required - A pattern to match tag names against (e.g., "a*" for tags starting with 'a'). ### Response #### Success Response (200) - **tags** (array) - A list of tags matching the pattern. #### Response Example [ { "id": 1, "name": "a_tag" } ] ## PUT /posts/{id}.json (Form Encoded Body) ### Description Updates a specific post using form-urlencoded data in the request body. ### Method PUT ### Endpoint /posts/{id}.json ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the post to update. #### Request Body - **post[rating]** (string) - Optional - The new rating for the post (e.g., 's', 'q', 'e'). - **post[tag_string]** (string) - Optional - The new comma-separated tag string for the post. ### Request Example ``` curl -u "$login:$api_key" -X PUT "https://testbooru.donmai.us/posts/6.json" -d 'post[rating]=s&post[tag_string]=danboo' ``` ### Response #### Success Response (200 or 204) - **success** (boolean) - Indicates if the update was successful. - **reason** (string) - Provides a reason if the update failed. #### Response Example { "success": true } ## PUT /posts/{id}.json (JSON Body) ### Description Updates a specific post using JSON data in the request body. ### Method PUT ### Endpoint /posts/{id}.json ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the post to update. #### Request Body - **post** (object) - Contains fields to update. - **rating** (string) - Optional - The new rating for the post (e.g., 's', 'q', 'e'). - **tag_string** (string) - Optional - The new comma-separated tag string for the post. ### Request Example ``` curl -u "$login:$api_key" -X PUT "https://testbooru.donmai.us/posts/6.json" -d '{ "post": { "rating": "s", "tag_string": "danboo" } }' -H "Content-Type: application/json" ``` ### Response #### Success Response (200 or 204) - **success** (boolean) - Indicates if the update was successful. - **reason** (string) - Provides a reason if the update failed. #### Response Example { "success": true } ``` -------------------------------- ### Wiki Pages Create Other Names Example Source: https://danbooru.donmai.us/wiki_pages/api%3Awiki_pages Example of how to provide multiple 'other_names' when creating a wiki page using the URL array parameter format. ```text wiki_page[other_names][]=blah&wiki_page[other_names][]=foo ``` -------------------------------- ### Tag Update Parameters Example Source: https://danbooru.donmai.us/wiki_pages/api%3Atags Example of how to format parameters for updating a tag. Note the restrictions on setting `is_deprecated` and `category` based on user level and tag properties. ```http tag[is_deprecated]=true tag[category]=1 ``` -------------------------------- ### Create Forum Topic with Original Post Source: https://danbooru.donmai.us/wiki_pages/api%3Aforum_topics Example of creating a forum topic along with its original post body. This requires specifying the body within 'original_post_attributes'. ```text forum_topic[original_post_attributes][body] ``` -------------------------------- ### Recommended Posts Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Endpoint to get recommended posts. ```APIDOC ## GET /recommended_posts(.:format) ### Description Retrieves a list of recommended posts. ### Method GET ### Endpoint /recommended_posts(.:format) ``` -------------------------------- ### Get Post Versions Source: https://danbooru.donmai.us/wiki_pages/api%3Apost_versions Retrieves a list of post versions. The default order is ID descending. Supports searching by various attributes. ```APIDOC ## GET /post_versions.json ### Description Retrieves a list of post versions. The default order is ID descending. ### Method GET ### Endpoint /post_versions.json ### Parameters #### Query Parameters - **id** (integer) - Search by post version ID. - **post_id** (integer) - Search by post ID. - **tags** (string) - Search by tags (space-delineated). - **added_tags** (array of string) - Search by added tags. - **removed_tags** (array of string) - Search by removed tags. - **rating** (string) - Search by rating ([g, s, q, e]). - **parent_id** (integer) - Search by parent ID. - **source** (string) - Search by source. - **rating_changed** (boolean) - Search if rating was changed. - **parent_changed** (boolean) - Search if parent was changed. - **source_changed** (boolean) - Search if source was changed. - **version** (integer) - Search by version number. - **updater_id** (integer) - Search by updater ID. - **updated_at** (timestamp) - Search by update timestamp. - **updater_addr_ip** (inet) - Search by updater IP address (Moderator+). - **all_changed_tags** (string) - Search where all tags in the list must be either an added tag or removed tag (space-delineated). - **any_changed_tags** (string) - Search where at least one tag in the list must be either an added tag or removed tag (space-delineated). - **tag_matches** (string) - Case-insensitive search of the `tag` string. Adds asterisks if missing and ignores input after the first word. - **updater_name** (string) - Searches by updater name instead of updater ID. - **is_new** (boolean) - Shorthand search for `version=1` or `version=>1`. ### Response #### Success Response (200) - **id** (integer) - The ID of the post version. - **post_id** (integer) - The ID of the associated post. - **tags** (string) - Space-delineated tags. - **added_tags** (array of string) - Tags that were added. - **removed_tags** (array of string) - Tags that were removed. - **rating** (string) - The rating of the post ([g, s, q, e]). - **parent_id** (integer or null) - The ID of the parent post version. - **source** (string) - The source of the post. - **rating_changed** (boolean) - Indicates if the rating was changed. - **parent_changed** (boolean) - Indicates if the parent was changed. - **source_changed** (boolean) - Indicates if the source was changed. - **version** (integer) - The version number. - **updater_id** (integer) - The ID of the user who updated the post version. - **updated_at** (timestamp) - The timestamp when the post version was updated. - **updater_addr_ip** (inet) - The IP address of the updater (Limited to Moderator+). #### Response Example { "example": "[\n {\n \"id\": 1,\n \"post_id\": 123,\n \"tags\": \"tag1 tag2\",\n \"added_tags\": [\"tag3\"],\n \"removed_tags\": [],\n \"rating\": \"s\",\n \"parent_id\": null,\n \"source\": \"http://example.com\",\n \"rating_changed\": false,\n \"parent_changed\": false,\n \"source_changed\": false,\n \"version\": 1,\n \"updater_id\": 45,\n \"updated_at\": \"2023-10-27T10:00:00Z\",\n \"updater_addr_ip\": \"192.168.1.1\"\n }\n]" ``` -------------------------------- ### Create Upload - Parameters Source: https://danbooru.donmai.us/wiki_pages/api%3Auploads When creating an upload, parameters follow the format `Upload[FIELD]=VALUE`. Either `source` or `files` is mandatory, while `referer_url` is optional. ```text Upload[FIELD]=VALUE ``` -------------------------------- ### Show Email Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Retrieves a specific email by its ID. Get details of a single email record. ```APIDOC ## GET /emails/:id(.:format) ### Description Retrieves a specific email by its ID. ### Method GET ### Endpoint /emails/:id(.:format) ``` -------------------------------- ### Create User Source: https://danbooru.donmai.us/wiki_pages/api%3Ausers Creates a new user record. ```APIDOC ## POST /users.json ### Description Creates a single user record. ### Method POST ### Endpoint /users.json ### Response #### Success Response (200) - **user** (object) - The newly created user object. ``` -------------------------------- ### Show Count Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Retrieves a specific count by its ID. Get details of a single count record. ```APIDOC ## GET /counts/:id(.:format) ### Description Retrieves a specific count by its ID. ### Method GET ### Endpoint /counts/:id(.:format) ``` -------------------------------- ### Create Wiki Page Source: https://danbooru.donmai.us/wiki_pages/api%3Awiki_pages Creates a new wiki page record. ```APIDOC ## POST /wiki_pages.json ### Description Creates a single wiki page record. ### Method POST ### Endpoint /wiki_pages.json ### Parameters #### Request Body - **wiki_page[title]** (string) - Required - The title of the wiki page. - **wiki_page[body]** (text) - Optional - The content of the wiki page. - **wiki_page[other_names][]** (string) - Optional - Alternative names for the wiki page (use URL array format). - **wiki_page[other_names_string]** (string) - Optional - Space-delimited list of other names. - **wiki_page[is_deleted]** (boolean) - Optional - Set to true to create a deleted wiki page. - **wiki_page[is_locked]** (boolean) - Optional - Lock the wiki page (requires Builder+ permissions). ### Request Example ```json { "wiki_page": { "title": "new_wiki", "body": "Content for the new wiki.", "other_names": ["alias1", "alias2"] } } ``` ### Response #### Success Response (200) Returns the created wiki page record with the same fields as the Show action. ``` -------------------------------- ### Get Post Counts Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Retrieves counts related to posts. This endpoint provides statistics about posts. ```APIDOC ## GET /counts/posts(.:format) ### Description Retrieves counts related to posts. ### Method GET ### Endpoint /counts/posts(.:format) ``` -------------------------------- ### Mock IQDBs Similar API Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Mock API for finding similar images via IQDBs. ```APIDOC ## GET /mock/iqdbs/similar ### Description Mock API for finding similar images via IQDBs. ### Method GET ### Endpoint /mock/iqdbs/similar(.:format) ``` ```APIDOC ## POST /mock/iqdbs/similar ### Description Mock API for finding similar images via IQDBs. ### Method POST ### Endpoint /mock/iqdbs/similar(.:format) ``` -------------------------------- ### Show Ban Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Retrieves a specific ban by its ID. Use this to get details of a single ban. ```APIDOC ## GET /bans/:id(.:format) ### Description Retrieves a specific ban by its ID. ### Method GET ### Endpoint /bans/:id(.:format) ``` -------------------------------- ### New Dmail Form Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Displays the form for composing a new direct message (dmail). Use this to start a new conversation. ```APIDOC ## GET /dmails/new(.:format) ### Description Displays the form for composing a new direct message (dmail). ### Method GET ### Endpoint /dmails/new(.:format) ``` -------------------------------- ### Artist API Create Parameters Source: https://danbooru.donmai.us/wiki_pages/api%3Aartists Parameters for creating a new artist record. 'name' is required and must be in tag format. Refer to Help:API Write Requests for more info. ```text artist[FIELD]=VALUE ``` -------------------------------- ### Note Create Parameter Format Source: https://danbooru.donmai.us/wiki_pages/api%3Anotes Illustrates the parameter format for creating a note record. Fields like post_id, x, y, height, width, and body are required. ```text note[FIELD]=VALUE ``` -------------------------------- ### Create DText Preview Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Creates a preview for DText formatted content. Useful for seeing how DText will render before submitting. ```APIDOC ## POST /dtext_preview(.:format) ### Description Creates a preview for DText formatted content. ### Method POST ### Endpoint /dtext_preview(.:format) ``` -------------------------------- ### API Response - JSON Failure Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Example of a JSON response indicating a failed API request. The 'success' field is false, and the 'reason' field provides details. ```json { "success": false, "reason": "duplicate" } ``` -------------------------------- ### API Response - XML Failure Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Example of an XML response indicating a failed API request. The 'success' attribute is false, and the 'reason' attribute provides details. ```xml ``` -------------------------------- ### Wiki Pages Create Parameters Source: https://danbooru.donmai.us/wiki_pages/api%3Awiki_pages Parameters for creating a new wiki page record. Title is required, while body and other names are optional. ```text wiki_page[FIELD]=VALUE ``` -------------------------------- ### Create Artist Source: https://danbooru.donmai.us/wiki_pages/api%3Aartists Creates a new artist record. ```APIDOC ## POST /artists.json ### Description Creates a single artist record. ### Method POST ### Endpoint /artists.json ### Parameters #### Request Body - **artist[name]** (string) - Required - The artist tag name. Must be tag format. - **artist[group_name]** (string) - Optional - The name of the group this artist belongs to. - **artist[other_names]** (string) - Optional - List of alternative names for this artist. Space delimited. Replace spaces within names with underscores. - **artist[url_string]** (string) - Optional - List of URLs associated with this artist. Whitespace or newline delimited. - **artist[is_deleted]** (boolean) - Optional - Set the artist entry as deleted or not. ### Response #### Success Response (200) - **id** (integer) - Artist ID. - **name** (string) - Artist tag name. - **group_name** (string) - Name of the group the artist belongs to. - **other_names** (array) - List of alternative names. - **is_banned** (boolean) - Indicates if the artist is banned. - **is_deleted** (boolean) - Indicates if the artist is deleted. - **created_at** (timestamp) - Timestamp of creation. - **updated_at** (timestamp) - Timestamp of last update. ``` -------------------------------- ### User Creation Parameters Format Source: https://danbooru.donmai.us/wiki_pages/api%3Ausers Defines the format for user parameters when creating a new user account via the API. Requires name, password, and password confirmation. ```text user[FIELD]=VALUE ``` -------------------------------- ### Artist API URL Search with Wildcards Source: https://danbooru.donmai.us/wiki_pages/api%3Aartists Perform a wildcard search on artist URLs when the query contains asterisks (*). Wildcards are placed at the start and end by default. ```text url_matches=*wildcard* ``` -------------------------------- ### Create Post Source: https://danbooru.donmai.us/wiki_pages/api%3Aposts Creates a new post record. Requires upload_media_asset_id and optionally accepts tags, rating, parent_id, source, and commentary fields. ```APIDOC ## POST /posts.json ### Description Creates a single post record. ### Method POST ### Endpoint /posts.json ### Parameters #### Request Body - **upload_media_asset_id** (integer) - Mandatory - The ID of the media asset to upload. - **tag_string** (string) - Optional - The tags for the post. - **rating** (string) - Optional - The rating of the post (e.g., 's', 'q', 'e'). - **parent_id** (integer) - Optional - The ID of the parent post. - **source** (string) - Optional - The source URL of the post. - **artist_commentary_title** (string) - Optional - The title for artist commentary. - **artist_commentary_desc** (string) - Optional - The description for artist commentary. - **translated_commentary_title** (string) - Optional - The translated title for artist commentary. - **translated_commentary_desc** (string) - Optional - The translated description for artist commentary. - **is_pending** (boolean) - Optional - Set to true to mark the post as pending (only for users with unrestricted uploads). ``` -------------------------------- ### Artist API URL Search with Regex Source: https://danbooru.donmai.us/wiki_pages/api%3Aartists Perform a regex match on artist URLs when the query starts and ends with a forward slash. Regexes must follow Ruby's format. ```text url_matches=/regex/ ``` -------------------------------- ### Show User API Key Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Shows user API key. ```APIDOC ## GET /maintenance/user/api_key ### Description Shows user API key. ### Method GET ### Endpoint /maintenance/user/api_key(.:format) ``` -------------------------------- ### Create Forum Topic with Restricted Parameters Source: https://danbooru.donmai.us/wiki_pages/api%3Aforum_topics Optional parameters for creating a forum topic that are restricted to Moderator+ roles. These include 'min_level', 'is_sticky', and 'is_locked'. ```text min_level - Can be: 0, 40, 50 is_sticky is_locked ``` -------------------------------- ### Create Post Parameter Format Source: https://danbooru.donmai.us/wiki_pages/api%3Aposts Parameters for creating a new post. Refer to Help:API Write Requests for comprehensive information. ```text post[FIELD]=VALUE ``` -------------------------------- ### Create Parameters Format Source: https://danbooru.donmai.us/wiki_pages/api%3Abulk_update_requests Specifies the format for parameters when creating a bulk update request. Use `bulk_update_request[FIELD]=VALUE` syntax. ```text bulk_update_request[FIELD]=VALUE ``` -------------------------------- ### Create Forum Topic Parameters Source: https://danbooru.donmai.us/wiki_pages/api%3Aforum_topics Parameters for creating a new forum topic. 'title', 'category_id', and 'category' are required. 'original_post_attributes[body]' can be used to create the initial post. ```text forum_topic[FIELD]=VALUE ``` -------------------------------- ### Create Forum Topic Source: https://danbooru.donmai.us/wiki_pages/api%3Aforum_topics Creates a new forum topic record. Requires title and category. ```APIDOC ## POST /forum_topics.json ### Description Creates a single forum topic record. ### Method POST ### Endpoint /forum_topics.json ### Parameters #### Request Body - `forum_topic[title]` (string) - Required. The title of the new forum topic. - `forum_topic[category_id]` (integer) - Required. The category ID (0, 1, or 2). - `forum_topic[category]` (string) - Alternate to `category_id`. The category name. - `forum_topic[original_post_attributes][body]` (string) - Optional. The DText content for the initial forum post. - `forum_topic[min_level]` (integer) - Optional. Restricted to Moderator+. Can be 0, 40, 50. - `forum_topic[is_sticky]` (boolean) - Optional. Restricted to Moderator+. - `forum_topic[is_locked]` (boolean) - Optional. Restricted to Moderator+. ### Response #### Success Response (200) - `id` (integer) - Unique identifier for the newly created forum topic. - `title` (string) - The title of the forum topic. - `category_id` (integer) - The category of the topic. - `response_count` (integer) - The number of responses in the topic. - `min_level` (integer) - The minimum user level required to view the topic. - `is_deleted` (boolean) - Whether the topic is deleted. - `is_sticky` (boolean) - Whether the topic is sticky. - `is_locked` (boolean) - Whether the topic is locked. - `creator_id` (integer) - The ID of the user who created the topic. - `updater_id` (integer) - The ID of the user who last updated the topic. - `created_at` (timestamp) - The timestamp when the topic was created. - `updated_at` (timestamp) - The timestamp when the topic was last updated. - `creator` (object) - User object of the topic creator. - `updater` (object) - User object of the topic updater. - `original_post` (object) - The first post of the topic. ``` -------------------------------- ### Create Note Source: https://danbooru.donmai.us/wiki_pages/api%3Anotes Creates a single note record. ```APIDOC ## Create Note ### Description Creates a single note record. ### Method POST ### Endpoint /notes.json ### Parameters #### Request Body - `note[post_id]` (integer) - Required - The post ID the note belongs to. - `note[x]` (integer) - Required - X coordinate of the note starting from the left of the image. - `note[y]` (integer) - Required - y coordinate of the note starting from the top of the image. - `note[height]` (integer) - Required - Height of the note. - `note[width]` (integer) - Required - Width of the note. - `note[body]` (string) - Required - The content of the note. - `note[is_active]` (boolean) - Optional - Whether the note is active or not. ``` -------------------------------- ### Generate HTTP Basic Authentication Header Manually Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Manually construct the Authorization header for Basic Authentication by Base64 encoding your username and API key. This is useful if your HTTP library does not support Basic Auth directly. ```bash curl --header "Authorization: Basic $(printf "%s" "$username:$api_key" | base64)" https://danbooru.donmai.us/profile.json ``` -------------------------------- ### Pool Creation Parameters Source: https://danbooru.donmai.us/wiki_pages/api%3Apools Parameters for creating a new pool record. Requires 'name' and 'category'. 'post_ids' can be provided as a URL array or space-delimited string. ```text pool[FIELD]=VALUE ``` ```text pool[post_ids][]=1&pool[post_ids][]=2 ``` -------------------------------- ### Authenticate with API Key URL Parameters Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Pass your login and API key as URL parameters for authentication. Ensure your API key is kept secret. ```url https://danbooru.donmai.us/profile.json?login=your_username&api_key=your_api_key ``` -------------------------------- ### Preview Note Source: https://danbooru.donmai.us/wiki_pages/api%3Anotes Returns the sanitized version of HTML that Danbooru uses for notes. ```APIDOC ## Preview Note ### Description Returns the sanitized version of HTML that Danbooru uses for notes. Returns a JSON object with note attributes and a `sanitized_body` field. ### Method POST ### Endpoint /notes/preview.json ### Parameters #### Request Body - `body` (string) - Required - The HTML text to sanitize. ``` -------------------------------- ### Show Wiki Page Source: https://danbooru.donmai.us/wiki_pages/api%3Awiki_pages Retrieves a single wiki page record by its ID or title. ```APIDOC ## GET /wiki_pages/$id.json ### Description Returns a single wiki page record. ### Method GET ### Endpoint /wiki_pages/$id.json ### Parameters #### Path Parameters - **id** (integer or string) - Required - The wiki page ID or title. ### Response #### Success Response (200) - **id** (integer) - Wiki page ID. - **title** (string) - Wiki page title. - **body** (text) - Content of the wiki page. - **other_names** (array) - Array of alternative names. - **is_deleted** (boolean) - Indicates if the wiki page is deleted. - **locked** (boolean) - Indicates if the wiki page is locked. - **created_at** (timestamp) - Timestamp of creation. - **updated_at** (timestamp) - Timestamp of last update. - **category_name** (string, derived) - Category of the associated tag, or null. #### Response Example { "id": 123, "title": "example_wiki", "body": "This is the content.", "other_names": ["alt_name1", "alt_name2"], "is_deleted": false, "locked": false, "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z", "category_name": "general" } ``` -------------------------------- ### Create Dmail Parameter Format Source: https://danbooru.donmai.us/wiki_pages/api%3Admails Shows the parameter format for creating a dmail. Dmail fields are prefixed with 'dmail'. ```text dmail[FIELD]=VALUE ``` -------------------------------- ### Show or New Artist Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Shows an existing artist or provides a form to create a new one. ```APIDOC ## GET /artists/show_or_new ### Description Shows an existing artist or provides a form to create a new one. ### Method GET ### Endpoint /artists/show_or_new(.:format) ``` -------------------------------- ### Create Forum Post Source: https://danbooru.donmai.us/wiki_pages/api%3Aforum_posts Creates a single forum post record. ```APIDOC ## POST /forum_posts.json ### Description Creates a single forum post record. ### Method POST ### Endpoint /forum_posts.json ### Parameters #### Request Body - **body** (string) - Required - The content of the forum post. - **topic_id** (integer) - Required - The ID of the forum topic to which the post belongs. ### Request Example ```json { "body": "This is the content of the new forum post.", "topic_id": 123 } ``` ### Response #### Success Response (200) - **Forum post object** - Contains the details of the newly created forum post. ``` -------------------------------- ### DText Help API Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Provides help documentation for DText formatting. ```APIDOC ## GET /static/dtext_help ### Description Provides help documentation for DText formatting. ### Method GET ### Endpoint /static/dtext_help(.:format) ``` -------------------------------- ### New Artist Form Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Provides a form to create a new artist. ```APIDOC ## GET /artists/new ### Description Provides a form to create a new artist. ### Method GET ### Endpoint /artists/new(.:format) ``` -------------------------------- ### Create Forum Post API Source: https://danbooru.donmai.us/wiki_pages/api%3Aforum_posts Create a new forum post record. Requires `body` and `topic_id` parameters. This is a write request. ```http POST /forum_posts.json ``` -------------------------------- ### Mock Recommender Similar API Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Mock API for finding similar posts based on post ID. ```APIDOC ## GET /mock/recommender/similiar/:post_id ### Description Mock API for finding similar posts based on post ID. ### Method GET ### Endpoint /mock/recommender/similiar/:post_id(.:format) ### Parameters #### Path Parameters - **post_id** (string) - Required - The ID of the post to find similar items for. ``` -------------------------------- ### Show Note Source: https://danbooru.donmai.us/wiki_pages/api%3Anotes Returns a single note record. $id is the note ID. ```APIDOC ## Show Note ### Description Returns a single note record. ### Method GET ### Endpoint /notes/$id.json ### Parameters #### Path Parameters - `id` (integer) - Required - The note ID. ``` -------------------------------- ### View User API Key Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Views user API key. ```APIDOC ## POST /maintenance/user/api_key/view ### Description Views user API key. ### Method POST ### Endpoint /maintenance/user/api_key/view(.:format) ``` -------------------------------- ### Authentication with HTTP Basic Authentication Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Alternatively, authenticate using HTTP Basic Authentication by providing your username and API key in the Authorization header or directly in the URL. ```APIDOC ## Authentication with HTTP Basic Authentication ### Description Authenticate API requests using HTTP Basic Authentication. This can be done via the `Authorization` header or by embedding credentials in the URL for tools like `curl`. ### Method GET ### Endpoint `https://danbooru.donmai.us/profile.json` ### Authentication #### HTTP Basic Authentication (Header) - **Authorization**: `Basic ` #### HTTP Basic Authentication (curl URL) `https://:@danbooru.donmai.us/profile.json` ### Request Example (curl with header) ```bash curl --user "$username:$api_key" https://danbooru.donmai.us/profile.json ``` ### Request Example (curl with manual header) ```bash curl --header "Authorization: Basic $(printf "%s" "$username:$api_key" | base64)" https://danbooru.donmai.us/profile.json ``` ``` -------------------------------- ### List Artist Versions Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Retrieves a list of all artist versions. Useful for fetching a collection of artist versions. ```APIDOC ## GET /artist_versions(.:format) ### Description Retrieves a list of all artist versions. ### Method GET ### Endpoint /artist_versions(.:format) ``` -------------------------------- ### Show Artist Version Source: https://danbooru.donmai.us/wiki_pages/api%3Aartist_versions Retrieves a specific artist version by its ID. ```APIDOC ## GET /artist_versions/$id.json ### Description Retrieves a specific artist version by its ID. ### Method GET ### Endpoint /artist_versions/$id.json ### Parameters #### Path Parameters - **id** (integer) - The artist version ID. ``` -------------------------------- ### Keyboard Shortcuts API Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Displays information about keyboard shortcuts. ```APIDOC ## GET /static/keyboard_shortcuts ### Description Displays information about keyboard shortcuts. ### Method GET ### Endpoint /static/keyboard_shortcuts(.:format) ``` -------------------------------- ### Index Posts (Root) Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Retrieves a list of posts, accessible from the root path. ```APIDOC ## GET / ### Description Retrieves a list of posts, accessible from the root path. ### Method GET ### Endpoint / ``` -------------------------------- ### Index Artist Versions Source: https://danbooru.donmai.us/wiki_pages/api%3Aartist_versions Retrieves a list of artist versions. The default order is ID descending. Supports searching by various attributes and special parameters like 'order'. ```APIDOC ## GET /artist_versions.json ### Description Retrieves a list of artist versions. The default order is ID descending. ### Method GET ### Endpoint /artist_versions.json ### Parameters #### Query Parameters - **id** (integer) - Searchable by number syntax. - **artist_id** (integer) - Searchable by number syntax. - **created_at** (timestamp) - Searchable by number syntax. - **updated_at** (timestamp) - Searchable by number syntax. - **name** (string) - Searchable by string syntax. - **group_name** (string) - Searchable by string syntax. - **is_banned** (boolean) - Searchable by boolean syntax. - **is_deleted** (boolean) - Searchable by boolean syntax. - **updater** (user) - Searchable by user syntax. - **order** (string) - Sets the order of results. Example: `name` for alphabetical on the name field. ``` -------------------------------- ### List Wiki Page Versions Source: https://danbooru.donmai.us/wiki_pages/api%3Awiki_page_versions Retrieves a list of wiki page versions. The default order is ID descending. Supports searching and filtering via query parameters. ```APIDOC ## GET /wiki_page_versions.json ### Description Retrieves a list of wiki page versions. The default order is ID descending. ### Method GET ### Endpoint /wiki_page_versions.json ### Parameters #### Query Parameters - **id** (integer) - Searchable - ID of the wiki page version. - **updated_at** (timestamp) - Searchable - Timestamp of the last update. - **title** (string) - Searchable - Title of the wiki page version. - **body** (text) - Searchable - Content of the wiki page version. - **is_locked** (boolean) - Searchable - Indicates if the wiki page version is locked. - **is_deleted** (boolean) - Searchable - Indicates if the wiki page version is deleted. - **other_names** (array) - Searchable - Array of other names associated with the wiki page version. - **updater** (user) - Searchable - The user who updated the wiki page version. - **wiki_page** (wiki page) - Searchable - The wiki page associated with this version. - **artist** (artist) - Searchable - The artist associated with the wiki page version. - **tag** (tag) - Searchable - The tag associated with the wiki page version. - **title_matches** (string) - Special Search - Case-insensitive normalized wildcard search on the title field. - **body_matches** (string) - Special Search - Case-insensitive normalized wildcard search on the body field. ### Response #### Success Response (200) - **id** (integer) - Unique identifier for the wiki page version. - **wiki_page_id** (integer) - Identifier for the associated wiki page. - **title** (string) - The title of the wiki page version. - **body** (text) - The content of the wiki page version. - **other_names** (array) - An array of strings representing other names for the wiki page. - **is_locked** (boolean) - True if the wiki page version is locked, false otherwise. - **is_deleted** (boolean) - True if the wiki page version is deleted, false otherwise. - **updater_id** (integer) - Identifier for the user who updated the wiki page version. - **created_at** (timestamp) - The timestamp when the wiki page version was created. - **updated_at** (timestamp) - The timestamp when the wiki page version was last updated. - **updater_addr_ip** (inet) - The IP address of the updater (limited to Moderator+). ``` -------------------------------- ### Create Note API Endpoint Source: https://danbooru.donmai.us/wiki_pages/api%3Anotes Creates a single note record. Requires post_id, x, y, height, width, and body. The note box must fit within the image dimensions. ```http POST /notes.json ``` -------------------------------- ### Basic Post Search Parameter Format Source: https://danbooru.donmai.us/wiki_pages/api%3Aposts Use this format for chaining search parameters in API requests. Consult Help:Chaining Syntax for more details. ```text search[post][FIELD]=VALUE ``` -------------------------------- ### User Levels Source: https://danbooru.donmai.us/wiki_pages/api%3Ausers Lists the different user levels and their corresponding integer values. These levels determine user permissions and capabilities within the system. ```text Name| Level ---|--- Anonymous| 0 (Used internally when browsing anonymously) Restricted| 10 Member| 20 Gold| 30 Platinum| 31 Builder| 32 Contributor| 35 Approver| 37 Moderator| 40 Admin| 50 Owner| 60 ``` -------------------------------- ### Authenticate with HTTP Basic Authentication (curl) Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Use curl with HTTP Basic Authentication by embedding your username and API key in the URL or using the --user flag. The API key should be kept secret. ```bash curl "https://$username:$api_key@danbooru.donmai.us/profile.json" ``` ```bash curl --user "$username:$api_key" https://danbooru.donmai.us/profile.json ``` -------------------------------- ### IQDB Queries API Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Endpoints for interacting with the IQDB (Image Quality Database). ```APIDOC ## GET /iqdb_queries/preview ### Description Provides a preview of IQDB query results. ### Method GET ### Endpoint /iqdb_queries/preview(.:format) ``` ```APIDOC ## GET /iqdb_queries/check ### Description Checks IQDB status (redirects). ### Method GET ### Endpoint /iqdb_queries/check(.:format) ``` ```APIDOC ## GET /iqdb_queries ### Description Retrieves IQDB query results. ### Method GET ### Endpoint /iqdb_queries(.:format) ``` ```APIDOC ## POST /iqdb_queries ### Description Creates a new IQDB query. ### Method POST ### Endpoint /iqdb_queries(.:format) ``` -------------------------------- ### Create Pool Source: https://danbooru.donmai.us/wiki_pages/api%3Apools Creates a single pool record. ```APIDOC ## POST /pools.json ### Description Creates a new pool record. ### Method POST ### Endpoint /pools.json ### Parameters #### Request Body - **pool[name]** (string) - Required - The name of the pool. - **pool[category]** (string) - Required - The category of the pool. Can be 'series' or 'collection'. - **pool[description]** (string) - Optional - A description for the pool. - **pool[post_ids][]** (integer) - Optional - An array of post IDs to include in the pool. Use URL array parameter format (e.g., `pool[post_ids][]=1&pool[post_ids][]=2`). - **pool[post_ids_string]** (string) - Optional - A space-delimited list of post IDs. ### Response #### Success Response (200) - **pool** (object) - The newly created pool object. ``` -------------------------------- ### Create Bulk Update Request Source: https://danbooru.donmai.us/wiki_pages/api%3Abulk_update_requests Submit a POST request to create a new bulk update request. Requires `script` and `reason` parameters. Can optionally associate with an existing `forum_topic_id` or create a new one using `title`. ```http POST /bulk_update_requests.json ``` -------------------------------- ### Create Upload Source: https://danbooru.donmai.us/wiki_pages/api%3Auploads Creates a single upload record. Requires either a source URL or file(s) to be provided. ```APIDOC ## POST /uploads.json ### Description Creates a single upload record. ### Method POST ### Endpoint /uploads.json ### Parameters #### Request Body - **Upload[source]** (string) - Optional - The source URL for the upload. One of `source` or `files` must be present. - **Upload[files]** (array) - Optional - An array of files to upload. One of `source` or `files` must be present. - **Upload[referer_url]** (string) - Optional - The URL from which the upload was initiated. ### Request Example ```json { "Upload[source]": "http://example.com/image.jpg", "Upload[referer_url]": "http://example.com/referrer" } ``` ### Response #### Success Response (201) - **id** (integer) - Unique identifier for the newly created upload. - **uploader_id** (integer) - The ID of the user who uploaded the record. - **source** (string) - The source URL or identifier for the uploaded media. - **referer_url** (string) - The URL from which the upload was initiated. - **media_asset_count** (integer) - The number of media assets associated with the upload. - **status** (string) - The current status of the upload (e.g., 'pending', 'completed', 'failed'). - **error** (string or null) - Details about any errors encountered during the upload process. - **created_at** (timestamp) - The timestamp when the upload record was created. - **updated_at** (timestamp) - The timestamp when the upload record was last updated. #### Response Example { "id": 124, "uploader_id": 456, "source": "http://example.com/image.jpg", "referer_url": "http://example.com/referrer", "media_asset_count": 0, "status": "pending", "error": null, "created_at": "2023-10-27T11:00:00Z", "updated_at": "2023-10-27T11:00:00Z" } ``` -------------------------------- ### Create Ban Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Creates a new ban record. Use this to add a new ban. ```APIDOC ## POST /bans(.:format) ### Description Creates a new ban record. ### Method POST ### Endpoint /bans(.:format) ``` -------------------------------- ### Mock Recommender Recommend API Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Mock API for recommender recommendations based on user ID. ```APIDOC ## GET /mock/recommender/recommend/:user_id ### Description Mock API for recommender recommendations based on user ID. ### Method GET ### Endpoint /mock/recommender/recommend/:user_id(.:format) ### Parameters #### Path Parameters - **user_id** (string) - Required - The ID of the user for whom to get recommendations. ``` -------------------------------- ### Autocomplete Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Provides autocomplete suggestions. ```APIDOC ## GET /autocomplete ### Description Provides autocomplete suggestions. ### Method GET ### Endpoint /autocomplete(.:format) ``` -------------------------------- ### Mark All Forum Topics as Read API Endpoint Source: https://danbooru.donmai.us/wiki_pages/api%3Aforum_topics Marks every topic as being read. This is a write request. ```http POST /forum_topics/mark_all_as_read.json ``` -------------------------------- ### Robots.txt Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Endpoint to retrieve the robots.txt file. ```APIDOC ## GET /robots(.:format) ### Description Retrieves the robots.txt file. ### Method GET ### Endpoint /robots(.:format) ``` -------------------------------- ### Index Note Versions Source: https://danbooru.donmai.us/wiki_pages/api%3Anote_versions Retrieves a list of note versions. The default order is ID descending. Supports searching by various attributes and special parameters. ```APIDOC ## GET /note_versions.json ### Description Retrieves a list of note versions. The default order is ID descending. ### Method GET ### Endpoint /note_versions.json ### Parameters #### Query Parameters - **id** (integer) - Searchable - **note_id** (integer) - Searchable - **post_id** (integer) - Searchable - **x** (integer) - Searchable - **y** (integer) - Searchable - **width** (integer) - Searchable - **height** (integer) - Searchable - **body** (string) - Searchable - **is_active** (boolean) - Searchable - **version** (integer) - Searchable - **created_at** (timestamp) - Searchable - **updated_at** (timestamp) - Searchable - **updater_id** (integer) - Searchable - **updater_addr_ip** (inet) - Searchable (Limited to Moderator+) - **post_tags_match** (string) - Special parameter: The post query of the search term matches the post of the note. - **body_matches** (string) - Special parameter: Case-insensitive wildcard search on the body field. ``` -------------------------------- ### List Users Source: https://danbooru.donmai.us/wiki_pages/api%3Ausers Retrieves a list of user records. The default order is by creation date in descending order. ```APIDOC ## GET /users.json ### Description Returns multiple user records. The default order is created at descending. ### Method GET ### Endpoint /users.json ### Parameters #### Query Parameters - **search[FIELD]** (string) - Optional - Allows searching by various user fields. See documentation for specific field syntax. - **order** (string) - Optional - Specifies the order of results. Possible values include `name`, `post_upload_count`, `post_update_count`, `note_count`. - **name_matches** (string) - Optional - Case-insensitive wildcard search on the name field. - **any_name_matches** (string) - Optional - Case-insensitive search on current or previous usernames. - **name_or_past_name_matches** (string) - Optional - Case-insensitive search for current or past names. - **min_level** (integer) - Optional - Minimum user level to include. - **max_level** (integer) - Optional - Maximum user level to include. - **is_banned** (boolean) - Optional - Filter by ban status. - **current_user_first** (boolean) - Optional - If true, shows the current user first, then all other users by ID desc. ### Response #### Success Response (200) - **users** (array) - An array of user objects, each containing fields like `id`, `name`, `level`, etc. ``` -------------------------------- ### List Posts Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Retrieves a list of posts. ```APIDOC ## GET /posts ### Description Retrieves a list of posts. ### Method GET ### Endpoint /posts(.:format) ``` -------------------------------- ### Create User API Endpoint Source: https://danbooru.donmai.us/wiki_pages/api%3Ausers Creates a new user record. This is a write request to the API. ```http POST /users.json ``` -------------------------------- ### Note Previews API Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Endpoint for retrieving note previews. ```APIDOC ## GET /note_previews ### Description Retrieves note previews. ### Method GET ### Endpoint /note_previews ``` -------------------------------- ### Create Favorite Group Parameters Source: https://danbooru.donmai.us/wiki_pages/api%3Afavorite_groups Parameters for creating a favorite group. 'name' is required. 'post_ids_string' can be used for a space-delimited list of post IDs. ```text favorite_group[FIELD]=VALUE ``` -------------------------------- ### Show Post Source: https://danbooru.donmai.us/wiki_pages/api%3Aposts Retrieves a single post record by its ID. ```APIDOC ## GET /posts/$id.json ### Description Retrieves a single post record. ### Method GET ### Endpoint /posts/$id.json ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the post to retrieve. ``` -------------------------------- ### Index Forum Posts Source: https://danbooru.donmai.us/wiki_pages/api%3Aforum_posts Retrieves multiple forum post records. The default order is updated at descending. ```APIDOC ## GET /forum_posts.json ### Description Returns multiple forum post records. ### Method GET ### Endpoint /forum_posts.json ### Parameters #### Query Parameters - **search[FIELD]** (string) - Optional - Used for searching forum posts based on various fields like `id`, `topic_id`, `body`, `is_deleted`, `creator`, `updater`, `topic`, `dtext_links`, `votes`, `tag alias`, `tag implication`, `bulk update request`, and `linked_to`. - **order** (string) - Optional - Changes the order of the results. Can be set to `custom` (requires `search[id]` to be set with a list of comma-separated IDs). ### Response #### Success Response (200) - **Array of forum post objects** - Contains forum post records matching the search criteria. ``` -------------------------------- ### List Artist URLs Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Retrieves a list of artist URLs. ```APIDOC ## GET /artist_urls ### Description Retrieves a list of artist URLs. ### Method GET ### Endpoint /artist_urls(.:format) ``` -------------------------------- ### Static Content API Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Endpoints for static content like sitemaps. ```APIDOC ## GET /sitemap(.:format) ### Description Displays the sitemap index. ### Method GET ### Endpoint /sitemap(.:format) ``` -------------------------------- ### Create Comment Source: https://danbooru.donmai.us/wiki_pages/help%3Aapi Creates a new comment. Use this to add a new comment. ```APIDOC ## POST /comments(.:format) ### Description Creates a new comment. ### Method POST ### Endpoint /comments(.:format) ```