ScrollX Tag Page

Api:Notes

0 posts0 sourcesWiki updated 12/14/2025
Browse Full Gallery →

About Api:Notes

Table of Contents

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

[hr]

Record field format

[table]

[thead]

[tr]

[th]Name[/th]

[th]Type[/th]

[th]Details[/th]

[/tr]

[/thead]

[tbody]

[tr]

[td][code]id[/code][/td]

[td]integer[/td]

[td]>0[/td]

[/tr]

[tr]

[td][code]post_id[/code][/td]

[td]integer[/td]

[td]>0[/td]

[/tr]

[tr]

[td][code]body[/code][/td]

[td]string[/td]

[td][/td]

[/tr]

[tr]

[td][code]x[/code][/td]

[td]integer[/td]

[td]>0[/td]

[/tr]

[tr]

[td][code]y[/code][/td]

[td]integer[/td]

[td]>0[/td]

[/tr]

[tr]

[td][code]width[/code][/td]

[td]integer[/td]

[td]>0[/td]

[/tr]

[tr]

[td][code]height[/code][/td]

[td]integer[/td]

[td]>0[/td]

[/tr]

[tr]

[td][code]is_active[/code][/td]

[td]boolean[/td]

[td][/td]

[/tr]

[tr]

[td][code]version[/code][/td]

[td]integer[/td]

[td]>0[/td]

[/tr]

[tr]

[td][code]created_at[/code][/td]

[td]timestamp[/td]

[td][/td]

[/tr]

[tr]

[td][code]updated_at[/code][/td]

[td]timestamp[/td]

[td][/td]

[/tr]

[/tbody]

[/table]

[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):

[table]

[thead]

[tr]

[th]Name[/th]

[th]Type[/th]

[th]Number[/th]

[th]Availability[/th]

[th]Details[/th]

[/tr]

[/thead]

[tbody]

[tr]

[td][code]post[/code][/td]

[td]post[/td]

[td]single[/td]

[td]required[/td]

[td][/td]

[/tr]

[/tbody]

[/table]

[hr]

Index

Returns multiple note records.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]GET[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/notes.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]read request[/td]

[/tr]

[tr]

[td]Description[/td]

[td]The default order is ID descending.[/td]

[/tr]

[/tbody]

[/table]

Search attributes

Search parameters take the following format (see Help:Common URL Parameters for more info):

[code]

search[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]x[/code]
  • [code]y[/code]
  • [code]width[/code]
  • [code]height[/code]
  • [code]version[/code]
  • [code]created_at[/code]
  • [code]updated_at[/code]
  • Text syntax
  • [code]body[/code]
  • Boolean syntax
  • [code]is_active[/code]
  • Post syntax
  • [code]post[/code]

Search order

Using the search parameter [code]order[/code] with one of the following values changes the order of the results.

  • [code]custom[/code] - Help:Common URL Parameters
  • In order to use this order, [code]search[id][/code] must also be set with a list of comma-separated IDs.

[hr]

Show

Returns a single note record.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]GET[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/notes/$id.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]read request[/td]

[/tr]

[tr]

[td]Description[/td]

[td][code]$id[/code] is the note ID.[/td]

[/tr]

[/tbody]

[/table]

Note: This does a redirect to the post with that note when using the HTML interface, specifically highlighting that note when it gets there.

[hr]

Create

Creates a single note record.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]POST[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/notes.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]write request[/td]

[/tr]

[/tbody]

[/table]

Create parameters

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

[code]

note[FIELD]=VALUE

[/code]

  • Required:
  • [code]post_id[/code] - The post ID the note belongs to.
  • [code]x[/code] - X coordinate of the note starting from the left of the image.
  • [code]y[/code] - y coordinate of the note starting from the top of the image.
  • [code]height[/code]
  • [code]width[/code]
  • [code]body[/code]
  • Optional
  • [code]is_active[/code] - Whether the note is active or not (i.e. deleted).

Note: The note box must fit within the full-size dimensions of the image.

[hr]

Update

Updates a single note record.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]PUT/PATCH[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/notes/$id.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]write request[/td]

[/tr]

[tr]

[td]Description[/td]

[td][code]$id[/code] is the note ID.[/td]

[/tr]

[/tbody]

[/table]

Update parameters

Accepts the same parameters as the Create action, except for the post ID. All parameters are optional.

[hr]

Delete

Deletes a single note record.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]DELETE[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/notes/$id.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]write request[/td]

[/tr]

[tr]

[td]Description[/td]

[td][code]$id[/code] is the note ID.[/td]

[/tr]

[/tbody]

[/table]

[hr]

Revert

Reverts a single note record to a prior version.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]PUT[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/notes/$id/revert.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]write request[/td]

[/tr]

[tr]

[td]Description[/td]

[td][code]$id[/code] is the note ID.[/td]

[/tr]

[/tbody]

[/table]

Revert parameters

  • Required:
  • [code]version_id[/code] - The note version ID to revert to.

Note: The version ID may be passed along as a URL parameter instead of in the body.

[hr]

Preview

Returns the sanitized version of HTML that Danbooru uses for notes.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]POST[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/notes/preview.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]write request[/td]

[/tr]

[tr]

[td]Description[/td]

[td]Returns a JSON object that has the same attributes as a note record, with the addition of a [code]sanitized_body[/code] field.[/td]

[/tr]

[/tbody]

[/table]

Preview parameters

  • Required:
  • [code]body[/code] - The HTML text to sanitize.

Note: The body variable may be passed along as a URL parameter instead of in the request body.

[hr]

See also

[hr]

[table]

[tbody]

[tr]

[td]Controller[/td]

[td]<https://github.com/danbooru/danbooru/blob/master/app/controllers/notes_controller.rb>[/td]

[td][/td]

[/tr]

[tr]

[td]Model[/td]

[td]<https://github.com/danbooru/danbooru/blob/master/app/models/note.rb>[/td]

[/tr]

[tr]

[td]Policy[/td]

[td]<https://github.com/danbooru/danbooru/blob/master/app/policies/note_policy.rb>[/td]

[/tr]

[/tbody]

[/table]

Page 1