ScrollX Tag Page

Api:Posts

0 sourcesWiki updated 12/15/2025
Browse all Api:Posts images →

About Api:Posts

Table of Contents

This page has details for how to interact with post records through the API.

[hr]

Record field format

NameTypeDetails
[code]id[/code]integer>0
[code]rating[/code]stringincludes [g, s, q, e]
[code]parent_id[/code]integer or null>0
[code]source[/code]string
[code]md5[/code]stringOnly shown if visible to the user.
[code]uploader_id[/code]integer>0
[code]approver_id[/code]integer or null>0
[code]file_ext[/code]string
[code]file_size[/code]integer
[code]image_width[/code]integer
[code]image_height[/code]integer
[code]score[/code]integer
[code]up_score[/code]integer
[code]down_score[/code]integer
[code]fav_count[/code]integer
[code]is_pending[/code]boolean
[code]is_flagged[/code]boolean
[code]is_deleted[/code]boolean
[code]tag_string[/code]string
[code]tag_count[/code]integer
[code]tag_count_general[/code]integer
[code]tag_count_artist[/code]integer
[code]tag_count_copyright[/code]integer
[code]tag_count_character[/code]integer
[code]tag_count_meta[/code]integer
[code]last_commented_at[/code]timestamp or null
[code]last_comment_bumped_at[/code]timestamp or null
[code]last_noted_at[/code]timestamp or null
[code]has_children[/code]boolean
[code]has_active_children[/code]boolean
[code]pixiv_id[/code]integer or null>0
[code]bit_flags[/code]bigint
[code]created_at[/code]timestamp
[code]updated_at[/code]timestamp

[hr]

Derived field format

These are values which are not part of the actual record, but instead are derived from calculations and record lookups on the fly.

NameTypeDetailsNotes
[code]has_large[/code]booleanDerived from the media asset. The existence of the sample size.
[code]has_visible_children[/code]booleanDerived from the children. Returns true if: - Any child is active - The user has it set to show deleted children - The post itself is deleted
[code]file_url[/code]stringOnly shown if visible to user.Derived from the media asset. The original size.
[code]large_file_url[/code]stringOnly shown if visible to user.Derived from the media asset, if the sample size exists.
[code]preview_file_url[/code]stringOnly shown if visible to user.Derived from the media asset. The 180x180 size.
[code]tag_string_general[/code]stringDerived from the tag string.
[code]tag_string_artist[/code]stringDerived from the tag string.
[code]tag_string_copyright[/code]stringDerived from the tag string.
[code]tag_string_character[/code]stringDerived from the tag string.
[code]tag_string_meta[/code]stringDerived from the tag string.

[hr]

Associated attributes

The following is the list of relations that can be included in the API results (see Help:Common URL Parameters for more info):

NameTypeNumberAvailabilityDetails
[code]media_asset[/code]media assetsinglerequiredIncluded by default.
[code]media_metadata[/code]media metadatasinglerequired
[code]uploader[/code]usersinglerequired
[code]approver[/code]usersingleoptional
[code]parent[/code]postsingleoptional
[code]children[/code]postmultipleoptional
[code]artist_commentary[/code]artist_commentarysingleoptional
[code]notes[/code]notemultipleoptional
[code]comments[/code]commentmultipleoptional
[code]flags[/code]post flagmultipleoptional
[code]appeals[/code]post appealsmultipleoptional
[code]events[/code]eventsmultipleoptional
[code]approvals[/code]post approvalmultipleoptional
[code]disapprovals[/code]post disapprovalmultipleoptional
[code]replacements[/code]post replacementmultipleoptional
[code]ai_tags[/code]ai tagmultipleoptional
[code]dtext_links[/code]dtext linkmultipleoptional
[code]embedding_wiki_pages[/code]wiki pagemultipleoptional

[hr]

Index

Returns multiple post records.

HTTP MethodGET
Base URL[code]/posts.json[/code]
Typeread request
DescriptionThe default order is ID descending

Index parameters

  • [code]tags[/code] - The post query to search for using tags and metatags (Help:Cheatsheet).
  • [code]random[/code] - Selects a random sampling under the post query.
  • [code]md5[/code] - Search for an MD5 match. Takes priority over all other parameters.

Search attributes

Search parameters are not available directly, but can be used via chaining (see Help:Chaining Syntax for more info). The following is an example of what this format can look like:

[code]

search[post][FIELD]=VALUE

[/code]

The following are the base fields along with their associated type. Check the syntax pages for all of the available variations.

  • Number syntax
  • [code]id[/code]
  • [code]created_at[/code]
  • [code]updated_at[/code]
  • [code]pixiv_id[/code]
  • [code]fav_count[/code]
  • [code]score[/code]
  • [code]up_score[/code]
  • [code]down_score[/code]
  • [code]file_size[/code]
  • [code]image_width[/code]
  • [code]image_height[/code]
  • [code]tag_count[/code]
  • [code]last_comment_bumped_at[/code]
  • [code]last_commented_at[/code]
  • [code]last_noted_at[/code]
  • Text syntax
  • [code]rating[/code]
  • [code]source[/code]
  • [code]md5[/code]
  • [code]file_ext[/code]
  • Boolean syntax
  • [code]has_children[/code]
  • [code]has_active_children[/code]
  • [code]is_pending[/code]
  • [code]is_flagged[/code]
  • [code]is_deleted[/code]
  • [code]is_banned[/code]
  • User syntax
  • [code]uploader[/code]
  • [code]approver[/code]
  • Post syntax
  • [code]parent[/code] (unavailable due to current limitations)
  • [code]children[/code] (unavailable due to current limitations)
  • Chaining syntax
  • [code]artist_commentary[/code]
  • [code]flags[/code]
  • [code]appeals[/code]
  • [code]notes[/code]
  • [code]comments[/code]
  • [code]approvals[/code]
  • [code]replacements[/code]
  • [code]media_metadata[/code]

Special search parameters

The following are additional search fields.

  • [code]tags[/code] - Behaves the same as the regular post search.

[hr]

Show

Returns a single post record.

HTTP MethodGET
Base URL[code]/posts/$id.json[/code]
Typeread request
Description[code]$id[/code] is the post ID

[hr]

Create

Creates a single post record.

HTTP methodPOST
Base URL/posts.json
Typewrite request

Create parameters

Post parameters take the following format (see Help:API Write Requests for more info):

[code]

post[FIELD]=VALUE

[/code]

  • Mandatory:
  • [code]upload_media_asset_id[/code]
  • Optional:
  • [code]tag_string[/code]
  • [code]rating[/code]
  • [code]parent_id[/code]
  • [code]source[/code]
  • [code]artist_commentary_title[/code]
  • [code]artist_commentary_desc[/code]
  • [code]translated_commentary_title[/code]
  • [code]translated_commentary_desc[/code]
  • [code]is_pending[/code] - only matters for users with unrestricted uploads.

[hr]

Update

Updates a single post record.

HTTP MethodPUT/PATCH
Base URL[code]/posts/$id.json[/code]
Typewrite request
Description$id is the post ID

Update parameters

  • Optional:
  • [code]tag_string[/code]
  • [code]old_tag_string[/code]
  • [code]parent_id[/code]
  • [code]old_parent_id[/code]
  • [code]source[/code]
  • [code]old_source[/code]
  • [code]rating[/code]
  • [code]old_rating[/code]
  • [code]has_embedded_notes[/code]

[hr]

Destroy

Deletes a single post record.

HTTP MethodDELETE
Base URL[code]/posts/$id.json[/code]
Typewrite request
Description$id is the post ID Only available to Approvers and above.

Revert

HTTP MethodPUT/PATCH
Base URL[code]/posts/$id/revert.json[/code]
Typewrite request
Description$id is the post ID

Revert parameters

  • Required:
  • version_id - The post version ID to revert to.

[hr]

See also

[hr]

Controller<https://github.com/danbooru/danbooru/blob/master/app/controllers/posts_controller.rb>
Model<https://github.com/danbooru/danbooru/blob/master/app/models/post.rb>
Policy<https://github.com/danbooru/danbooru/blob/master/app/policies/post_policy.rb>

Api:Posts Gallery

0 visible posts on page 1