You don't appear to have Javascript enabled If you're using a tool like NoScript, please disable it or allow derpicdn.net for the site to work properly.

API

Backwards-incompatible changes to the API are coming up

We're going to be seriously reworking the API in the coming weeks to reduce server-side load and client-side network congestion with API-heavy scripting.

The access methods and data structures will remain largely unchanged but access URIs and data contained at a given URI will be changing.

We will also be adding support for extra API formats.

Contact the devs on the contact page if you have questions or would like to suggest an API endpoint.

Derpibooru provides a JSON API for major site functionality, which can be freely used by anyone wanting to produce tools for the site or other webapps that use the data provided within Derpibooru.

Licensing

Licensing of the API is simple - anyone can use it, users making abusively high numbers of requests may be asked to stop. Your application MUST properly cache, respect server-side cache expiry times, and gracefully back off if requests fail (ie the site is under heavy load).

Credit MUST always be given to the site in the form of a link. If images are used, the uploader MUST always be credited and the original source URL MUST be displayed alongside the image, either in textual form or as a link. A link to the Derpibooru page is optional but recommended; we recommend the derpiboo.ru domain as a canonical domain.

Accessing the API

Most methods support API access by appending the extension .json to a URL. For requests that require authentication, the URL parameter "key" should be appended. This key provides limited access to a user"s account. This key can be found by users on their account page. For instance, to access a user"s watched feed, the request "/images/watched.json?key=AfXLW11xvmkMj2UsjqKb" would be made.

Methods dealing with large feeds are paginated; the "page" parameter controls the page you"re on. The number of images per page can be set with the "perpage" parameter. The default is 15 unless you use your key and have changed the "Images per page" option on the settings page.

Available Methods

Basic methods for fetching image lists and information are available. To access the JSON API for a given image page, simply add .json to the end of the path. Here are a few incredibly exciting examples.

Note the list pages default to a 7 day sampling period; this can be altered with a URL parameter such as 6h, 24h, 7d, 4w.

Authenticated requests take a key argument - your personal key is shown in these requests as an example.

Available Parameters

All page parameters are 1-indexed.

Image Index (/image.json)

Parameter Function
constraint Search and sort by a specific field. (See also the note on page offsets below.)
Currently, the field can be:
  • id - to search by ID number
  • updated - to search by last update time
  • created - to search by image creation time
Time fields are in ISO 8601 format (the same format which is returned).
page The page offset. (See also note below.)
gt When specified, constraint field must be greater than this value.
gte When specified, constraint field must be greater than or equal to this value.
lt When specified, constraint field must be less than this value.
lte When specified, constraint field must be less than or equal to this value.
order Sort order for constraint; either 'a' (ascending) or 'd' (descending). The default order is 'a'.
deleted When set, includes limited information about deleted and duplicate images in the results. For such images, metadata is limited to id_number, created_at, updated_at, and either deletion_reason or duplicate_of.
nocomments When set, suppresses comment arrays; good for reducing bandwidth and may improve performance.
nofav When set, suppresses favorited-by arrays.

Image Lists (/lists.json,/lists/top_scoring.json, etc.)

Parameter Function
page The page offset. (See also note below.)
last Sampling period, specified in weeks, days, or hours.
nocomments When set, suppresses comment arrays; good for reducing bandwidth and may improve performance.
nofav When set, suppresses favorited-by arrays.

Image Search (/search.json)

Parameter Function
q The search query. (Replace spaces with "+".)
page The page offset.
nocomments When set, suppresses comment arrays; good for reducing bandwidth and may improve performance.
nofav When set, suppresses favorited-by arrays.

oEmbed

For embedding content in other websites as well as for finding canonical image descriptors and IDs, we provide an oEmbed API.

This API is compliant to the oEmbed specification and can be found at http://derpiboo.ru/oembed.json or http://derpiboo.ru/oembed.xml

Format selection is done by URL; call oembed.xml for an XML response. This is the only API currently supporting XML and we strongly encourage the use of JSON wherever possible.

You are strongly advised to cache image data on your own server upon embedding content via oEmbed, particularly if your website supports a large number of users. A cache age parameter is provided, which your client SHOULD respect for oEmbed requests themselves.

The author_url and author_name attributes will be set to the original author/source URL attributes wherever possible. The provider_url attribute will always direct you to the image's page on Derpibooru.

In addition to the standard oEmbed photo attributes, the following attributes are also provided: derpibooru_id, derpibooru_id_number, derpibooru_score, derpibooru_comments

The following domain spaces are supported (for derpibooru.org and other domains, the format is the same). /media/ URLs are only supported in full form (ie with the ID number present in the last portion of the path).

http://derpiboo.ru/*
http://derpiboo.ru/images/*
http://derpiboo.ru/thumbs/*
http://derpiboo.ru/media/*

For example:

This service supports maxheight and maxwidth parameters; these will return a fully formed thumbnail.

For tools that support it, the Derpibooru HTML header is embellished with appropriate oEmbed lookup link tags for automatic oEmbed discovery.