Tumblr API Guide: Legal Post Collection Without Scraping
In this article
This guide shows you how to collect Tumblr posts legally using the official Tumblr API, avoiding headless browser scraping which violates Tumblr's terms of service and can get your IP banned. With API access, you get structured data, rate limits, and a stable method that respects the platform. Before starting, you'll need a Tumblr account (free) and a registered application to obtain API credentials.
What You'll Need
- A Tumblr account (free, create one at tumblr.com if you don't have it)
- A registered Tumblr application (done via Tumblr's OAuth registration page)
- Basic understanding of HTTP requests and JSON (or a programming language like Python, JavaScript, etc.)
- An API client library or tool like
curl, Postman, or a language-specific SDK
Step-by-Step
- Register a Tumblr application. Go to
https://www.tumblr.com/oauth/appsand click “Register an application.” Fill in the required fields: application name, description, website, and callback URL (for local testing, usehttp://localhost). After submission, you'll receive an OAuth consumer key and secret key. - Obtain OAuth tokens. For read-only access to public posts, you only need the consumer key (also called API key) for most endpoints. However, to access private blogs or post your own content, you'll need full OAuth flow: get request tokens, authorize, and exchange for access tokens. For simplicity, this guide focuses on public data using just the API key.
- Understand the API endpoints. Tumblr's API v2 base URL is
https://api.tumblr.com/v2. Key endpoints include:/blog/{blog-identifier}/posts/{post-type}– get posts from a blog (e.g.,/blog/good.tumblr.com/posts/photo)/blog/{blog-identifier}/info– get blog metadata/blog/{blog-identifier}/followers– get followers (requires auth)
- Make your first API call. Use your API key as a query parameter:
https://api.tumblr.com/v2/blog/{blog-identifier}/posts?api_key=YOUR_API_KEY. Replace{blog-identifier}with the blog's canonical name (e.g.,staff.tumblr.com) or a custom domain. For example, usingcurl:curl "https://api.tumblr.com/v2/blog/staff.tumblr.com/posts?api_key=YOUR_API_KEY"
You'll get a JSON response containing an array of posts. - Parse the JSON response. The response structure is:
response.posts(array), each post has fields likeid,type,date,tags,body(for text posts),photos(for photo posts), etc. Use your programming language to extract the data you need. - Handle pagination. The API returns a limited number of posts per request (default 20, max 50). To get more, use the
offsetparameter (e.g.,&offset=20) orbefore(timestamp) to get posts older than a certain time. Loop until you've collected all posts or reached your desired count. - Respect rate limits. Tumblr's API allows 250 requests per hour per consumer key for most endpoints. Monitor the
X-Ratelimit-Remainingheader in responses. If you hit the limit, wait for the reset time (usually an hour). Implement exponential backoff in your code to avoid being throttled. - Filter by post type and tags. Use the
typeparameter (e.g.,text,photo,quote,link,chat,audio,video) andtagparameter (e.g.,&tag=funny) to narrow your collection. - Store your data. Save the JSON responses to files or a database. Ensure you comply with Tumblr's Developer API Terms of Service, which require attribution and prohibit commercial use without permission (read the terms).
Common Mistakes
- Using the API key as a header instead of query parameter. For Tumblr's v2 API, the API key must be passed as a query parameter named
api_key, not as an Authorization header (unless using OAuth). - Ignoring pagination. If you only make one request, you'll get only the first 20 posts. Always loop through pages.
- Not checking rate limits. Making rapid requests without checking headers can lead to temporary IP blocks. Always monitor and throttle.
- Using blog's display name instead of identifier. The blog identifier is the canonical name (e.g.,
staff.tumblr.com), not the title shown in the browser.
Tips
- Use the
notes_infoparameter (set totrue) to get like and reblog counts for each post, which can be useful for analytics. - Cache responses to avoid re-fetching the same data, especially if you're doing iterative analysis.
- Test with a small blog first to understand the response structure before scaling up.
- Use a library like
pytumblrfor Python ortumblr.jsfor Node.js to simplify authentication and requests. - For large-scale collection, consider using the
beforeparameter with timestamps to paginate backwards in time, which is more efficient than offset for deep archives.
Troubleshooting
- 401 Unauthorized: Double-check your API key. If you're using OAuth, ensure your tokens are valid and not expired.
- 404 Not Found: The blog identifier might be wrong. Try the canonical name (e.g.,
staff.tumblr.com) or a custom domain if applicable. - 429 Too Many Requests: You've hit the rate limit. Wait until the
X-Ratelimit-Resetheader time, or reduce request frequency. - Empty response or missing fields: Some post types (like video) may not have a
bodyfield. Check the Tumblr API documentation for the specific post type structure. - API key not working: Ensure your app is approved (usually instant) and that you're using the key correctly as a query parameter.
Frequently Asked Questions
Do I need OAuth for public posts?
No, for public posts from any blog, you only need your API key (consumer key). OAuth is required for private blogs, posting, or accessing followers.
Can I get all posts from a blog?
Yes, by paginating through all results using offset or before until you reach the end. However, very large blogs (millions of posts) may take time and hit rate limits, so plan accordingly.
What is the rate limit exactly?
Tumblr's API allows 250 requests per hour per consumer key for most endpoints. Check the response headers for exact usage.
Can I use the API for commercial purposes?
You must review Tumblr's Developer API Terms of Service. Generally, commercial use is restricted without explicit permission. For personal or educational projects, it's usually fine.
Is there a way to get posts without an API key?
No, you must register an application and use the API key. Scraping without API is against ToS and may lead to blocks.
How do I get the API key?
Register an application at https://www.tumblr.com/oauth/apps. After registration, you'll see your OAuth consumer key and secret. The consumer key is your API key.