Overview
Imgur's API exposes much of the Imgur infrastructure via a
standardized programmatic interface. Using Imgur's API, you can
upload images and completely manage your Imgur account, using
your programming language of choice. Here are just a few of the
things you can do:
- Upload images anonymously
- Upload images into accounts
- Create and manage photo albums
- Delete images
- List all images in your account
Commercial Usage
The Imgur API is available for non-commercial use by outside
developers. Commercial use is possible by prior arrangement. If
you wish to use it for such purposes, please contact Imgur first. Commercial purposes
include websites and/or applications that earn, or are expected
to earn, over $500 per month.
Anonymous API
The anonymous API lets you upload images, get site statistics,
get information on images, and read the images from the gallery. Anonymous API users get 500 API credits per hour, which is equal to
50 uploads per hour. If you don't want to upload images into
your account, and you're ok with the 50 uploads per hour limit,
then the anonymous API might be for you.
Register an application for the anonymous API
Authenticated API
The authenticated API uses either OAuth to allow
uploading images into Imgur accounts, and also gives the
developer full control over all account functions. You're able
to create albums, upload images into albums, list all images in
the account, delete previously uploaded images, etc. Everything
you can do with your account on the Imgur website, you can do
with the authenticated API (with the exception of changing core
account settings). Authenticated API users get 1000 API credits per hour (twice the amount of
the anonymous API), which is equal to 100 uploads per hour.
However, users with pro accounts get 2000 API credits per hour
(twice that of a non-pro account).
Click here for help on authenticating
Register an application for the authenticated API for OAuth
Technology Overview
The Imgur API is a RESTful API based on HTTP requests and XML or
JSON responses. If you're familiar with the APIs of Twitter,
Amazon's S3, del.icio.us, or a host of other web services,
you'll feel right at home.
Endpoints
The API is accessed by making HTTP requests to an endpoint URL,
in which GET or POST variables contain information about what
you wish to access. Every endpoint is accessible via standard
HTTP (port 80) and SSL-enabled HTTPS (port 443).
The default HTTP endpoint is:
The default HTTP endpoint is:
api.imgur.com/
The default SSL endpoint is:https://api.imgur.com/
Versions
Everything in the API (methods, parameters, etc.) is fixed to a
version number, and every call must contain one. Different
Versions are available at different endpoint URLs. The
latest version is Version 2.
The stable HTTP endpoint for the latest version is:
The stable HTTP endpoint for the latest version is:
api.imgur.com/2/
The previous version, version 1, is available at:https://api.imgur.com/1/
The documentation for Version 1 can be found here:code.google.com/p/imgur-api/
Response Formats
Responses are either XML (the default) or JSON. Response formats
are specified by supplying an extension to the API call. For
example, to specify a JSON response after an image is
uploaded, the URL is:
api.imgur.com/2/upload.json
and to specify an XML response, the URL is:api.imgur.com/2/upload.xml
Responses
JSON responses are directly analogous to their XML counterparts,
and each response follows a standard format. The root node of
the response is always the function call name, and similar
responses use the same structure. For example whenever an image
is returned, whether it's after an upload while returning a list
of images from an account, the structure is always the same.
api.imgur.com/2/upload.xml
api.imgur.com/2/account/images.xml
Authentication
To use the Authenticated API, the first thing you have to do is
register an application and obtain your consumer key and secret.
This key and secret scheme is used for the OAuth authentication
protocol.
Because of OAuth, you, as the application developer,
Because of OAuth, you, as the application developer,
- don't have the burden of keeping potentially damaging credentials for your users (especially considering that a lot of people use the same password for multiple services);
- don't have to worry about the user changing their password — a user can change his or her password and the OAuth "connection" to your app will still work;
- don't have to worry about other applications masquerading as your application as only your application can set the byline with your application name;
OAuth Endpoints
To access OAuth, the following endpoints must be used:
- https://api.imgur.com/oauth/request_token
- https://api.imgur.com/oauth/authorize
- https://api.imgur.com/oauth/access_token
List Parameters
List parameters are available to all list resources, and can be
set using either the GET or POST request methods.
Example:
Name | Required | Description |
page | optional | Page number of the result set (default: 1) |
count | optional | Limit the number of results per page. (default: 30, max: 100) |
api.imgur.com/2/account/images.json?count=42&page=6
Rate Limits
The Imgur API uses a credit allocation system to ensure fair
distribution of capacity. For the authenticated API, each
standard account is allocated 1,000 credits per hour, and each
pro account is allocated 2,000 credits per hour. You can check
the status of your credits with the following call:
Unless otherwise noted, an API call deducts 1 credit from your
allocation. However, uploads have a significantly higher
computational cost on our backend, and deduct 10 credits per
call. This means that each standard account can have 100 uploads
per hour, while each pro account can have 200 uploads per hour.
api.imgur.com/2/credits.xml
or,api.imgur.com/2/credits.json
In addition, each request contains rate limit information in the HTTP response headers.HTTP Header | Description |
X-RateLimit-Limit | Total credits that can be allocated. |
X-RateLimit-Remaining | Total credits available. |
X-RateLimit-Reset | Timestamp (unix epoch) for when the credits will be reset. |