Danbooru Anime API

Danbooru Anime API

Anime

Danbooru is an thousands of anime artist database to find good anime art. Random anime photos.

Visit APIπŸ” Alternatives

πŸ“š Documentation & Examples

Everything you need to integrate with Danbooru Anime API

πŸš€ Quick Start Examples

Danbooru Anime API Javascript Examplejavascript
// Danbooru Anime API API Example
const response = await fetch('https://danbooru.donmai.us/wiki_pages/43568', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

An Introduction to the Danbooru Public API

Danbooru is a popular image board that hosts a wide variety of anime images and related content. The service also provides a rich set of APIs that allow users to programmatically access its data and content. In this article, we'll introduce you to the Danbooru Public API, and provide you with some examples of how to use it using JavaScript.

How to Get a Danbooru API Key

Most read endpoints (like /posts.json) work anonymously, but an API key raises your limits and is required for anything that logs you in or writes data.

  1. Create a free account at https://danbooru.donmai.us/signup
  2. Open your user profile (click your username β†’ My Account).
  3. Click the Generate API Key button and copy the key.
  4. Authenticate by adding your username as login and the key as api_key β€” either as URL query parameters or via HTTP Basic auth. Keep the key secret; treat it like a password.
const url = 'https://danbooru.donmai.us/posts.json'
  + '?tags=kaguya-sama&limit=10'
  + '&login=YOUR_USERNAME&api_key=YOUR_API_KEY';
const posts = await (await fetch(url)).json();

Free tier / limits: Accounts are free. Reads are capped at roughly 10 requests per second globally; write actions are limited by user level (1/sec Basic, 4/sec Gold and above). Current limits come back in the x-rate-limit response header.

Endpoint

The main endpoint for Danbooru's API is https://danbooru.donmai.us.

Examples

Search for Images

To search for images using the API, you can use the /posts.json endpoint. Here is an example using JavaScript:

const API_URL = 'https://danbooru.donmai.us/posts.json';

async function searchImages(apiKey, tags) {
  const params = new URLSearchParams({
    tags,
    api_key: apiKey,
    limit: 10 // Set limit to 10 results
  });

  const response = await fetch(`${API_URL}?${params}`);
  const data = await response.json();

  return data.map((post) => ({
    title: post.tags,
    url: post.large_file_url
  }));
}

// Example usage
searchImages('your-api-key', 'kaguya-sama').then((results) => {
  console.log(results);
});

This example searches for images with the tag "kaguya-sama" and returns an array of objects containing the image's title and a URL to the large-sized file.

Create a New Tag

To create a new tag using the API, you can use the /tags.json endpoint. Here is an example using JavaScript:

const API_URL = 'https://danbooru.donmai.us/tags.json';

async function createTag(apiKey, name, category, aliases = []) {
  const body = new URLSearchParams({
    name,
    category,
    aliases: aliases.join(','),
    api_key: apiKey,
  });

  const response = await fetch(API_URL, {
    method: 'POST',
    body,
  });

  const data = await response.json();
  return data;
}

// Example usage
createTag('your-api-key', 'my-new-tag', 'artist').then((tag) => {
  console.log(`Created tag "${tag.name}" with ID ${tag.id}`);
});

This example creates a new tag with the name "my-new-tag" and the category "artist". You can optionally specify aliases for the tag by providing an array of strings as the aliases parameter.

Conclusion

The Danbooru Public API provides a powerful way to access the site's data and content programmatically. We hope this introduction and these examples help you get started building your own applications and tools using Danbooru's API. If you have any questions or feedback, feel free to reach out to the Danbooru community.

Explore More

Best Danbooru Anime API alternatives (2026)Best Anime APIs

Related APIs in Anime