Status for the API can be found at status.imgur.com!
Imgur's API exposes the entire Imgur infrastructure via a standardized programmatic interface. Using Imgur's API, you can do just about anything you can do on imgur.com, while using your programming language of choice. The Imgur API is a RESTful API based on HTTP requests and JSON responses.
This version of the API, version 3, uses OAuth 2.0. This means that all requests will need to be encrypted and sent via HTTPS. It also means that you need to register your application, even if you aren't allowing users to login.
The easiest way to start using the Imgur API is by clicking the Run in Postman button above. Postman is a free tool which helps developers run and debug API requests, and is the source of truth for this documentation. Every endpoint you see documented here is readily available by running our Postman collection.
These examples serve as a starting point to help familiarize you with the basics of the Imgur API.
The Imgur engineers are always around answering questions. The quickest way to get help is by posting your question on StackOverflow with the Imgur tag.
Each client must register their application and receive the client_id
and client_secret
.
For public read-only and anonymous resources, such as getting image info, looking up user comments, etc. all you need to do is send an authorization header with your client_id in your requests. This also works if you'd like to upload images anonymously (without the image being tied to an account), or if you'd like to create an anonymous album. This lets us know which application is accessing the API.
If you are just getting started, an easy way to explore the endpoints is by creating an application using following instructions below.
https://www.getpostman.com/oauth2/callback
https://api.imgur.com/oauth2/authorize
and Access Token URL to https://api.imgur.com/oauth2/token
. Add the Client ID and Client Secret you received from registering your application above, then click Request Token refreshToken
, clientId
, and clientSecret
fields as shown below Your application is commercial if you're making any money with it (which includes in-app advertising), if you plan on making any money with it, or if it belongs to a commercial organization.
To use Imgur's API commercially, you must first register your application. Once that's done, you must register with RapidAPI. RapidAPI allows you to choose a pricing plan that fits your needs. From then on, the API endpoint is https://imgur-apiv3.p.rapidapi.com/
which must be used in place of https://api.imgur.com/
. Additionally, you must set a X-Mashape-Key
request header with the key obtained from RapidAPI.
The Imgur API is free for non-commercial usage. Your application is probably free if you don't plan on making any money with it, or if it's open source.
The API is accessed by making HTTP requests to a specific version endpoint URL, in which GET or POST variables contain information about what you wish to access. Every endpoint is accessed via an SSL-enabled HTTPS (port 443), this is because everything is using OAuth 2.0.
Everything (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 3.
The stable HTTP endpoint for the latest version is:
https://api.imgur.com/3/
Each response is wrapped in a data tag. This means if you have a response, it will always be within the data field. We also include a status code and success flag in the response. For more information and examples go to the data models page.
Responses are either JSON (the default), JSONP, or XML. Response formats are specified by supplying an extension to the API call. For example, if you want to access the gallery information with JSON:
JSONP responses are made by adding the callback parameter via either GET or POST to the request. For example:
and to specify an XML response, the URL is:
For the most part, if the API action is plural, you can page it via a query string parameter.
NOTE: /gallery endpoints do not support the perPage query string, and /album/{id}/images is not paged.
Example:
The API requires each client to use OAuth 2 authentication. This means you'll have to register your application, and generate an access_code if you'd like to log in as a user. For public read-only and anonymous resources, such as getting image info, looking up user comments, etc. all you need to do is send an authorization header with your client_id in your requests. This also works if you'd like to upload images anonymously (without the image being tied to an account), or if you'd like to create an anonymous album. This lets us know which application is accessing the API.
For accessing a user's account, please visit the OAuth2 section of the docs. OAuth Endpoints To access OAuth, the following endpoints must be used:
You can also verify your OAuth 2.0 tokens by setting your header and visiting the page
The Imgur API uses a credit allocation system to ensure fair distribution of capacity. Each application can allow approximately 1,250 uploads per day or approximately 12,500 requests per day. If the daily limit is hit five times in a month, then the app will be blocked for the rest of the month. The remaining credit limit will be shown with each requests response in the X-RateLimit-ClientRemaining
HTTP header.
We also limit each user (via their IP Address) for each application, this is to ensure that no single user is able to spam an application. This limit will simply stop the user from requesting more data for an hour. We recommend that each application takes precautions against spamming by implementing rate limiting on their own applications. Each response will also include the remaining credits for each user in the X-RateLimit-UserLimit
HTTP header.
Each request contains rate limit information in the HTTP response headers.
Unless otherwise noted, an API call deducts 1 credit from your allocation. However, uploads have a significantly higher computational cost on our back-end, and deduct 10 credits per call. All OAuth calls, such as refreshing tokens or authorizing users, do not deduct any credits. You can also check the current rate limit status on your application by sending a GET request to
Your use of the Imgur API is also limited by the number of POST requests your IP can make across all endpoints. This limit is 1,250 POST requests per hour. Commercial Usage is not impacted by this limit. Each POST request will contain the following headers.
The Imgur API uses OAuth 2.0 for authentication. OAuth 2.0 has four steps: registration, authorization, making the request, and getting new access_tokens after the initial one expired.
Registration gives you your client_id
and client_secret
, which is then used to authorize the user to your app.
Authorization is the process of the user saying "I would like YourSuperAwesomeImgurApp to access my data". YourSuperAwesomeImgurApp cannot access the user's account without them agreeing to it. After they agree, you will get refresh and access tokens.
access_token
: is your secret key used to access the user's data. It can be thought of the user's password and username combined into one, and is used to access the user's account. It expires after 1 month.refresh_token
: is used to request new access_tokens. Since access_tokens expire after 1 month, we need a way to request new ones without going through the entire authorization step again. It does not expire.authorization_code
: is used for obtaining the the access and refresh tokens. It's purpose is to be immediately exchanged for an access_token and refresh_token.Authorization: Bearer YOUR_ACCESS_TOKEN
Registration
Each client must register their application and receive the client_id and client_secret.
For public read-only and anonymous resources, such as getting image info, looking up user comments, etc. all you need to do is send an authorization header with your client_id in your requests. This also works if you'd like to upload images anonymously (without the image being tied to an account), or if you'd like to create an anonymous album. This lets us know which application is accessing the API.
NOTE: If your app is not only requesting public read-only information, then you may skip this step.
To access a user's account, the user must first authorize your application so that you can get an access token. Requesting an access token is fairly straightforward: point a browser (pop-up, or full page redirect if needed) to a URL and include a set of query string parameters.
The user will now be able to enter their password and accept that they'd like to use your application. Once this happens, they will be redirected to your redirect URL (that you entered during registration) with the access token. You can now send the access token in the headers to access their account information.
Authorization Endpoint: https://api.imgur.com/oauth2/authorize
response_type
Parametertoken
: This authorization flow will directly return the access_token
and refresh_token
via the redirect URL you specified during registration, in the form of hash query string parameters. Example: http://example.com?access_token=ACCESS_TOKEN&token_type=Bearer&expires_in=3600
The code
and pin
response types have been deprecated and will soon no longer be supported.
The response will be sent to the redirect URL that was specified during registration. The contents and format of the response is determined by the value of the response_type parameter. You're able to change your applications redirect URL at any time by accessing the 'apps' section of your account settings.
token
Imgur returns an access token to your application if the user grants your application the permissions it requested. The access token is returned to your application in the fragment as part of the access_token
parameter. Since a fragment (the part of the URL after the #
) is not sent to the server, client side javascript must parse the fragment and extract the value of the access_token
parameter.
Other parameters included in the response include expires_in
and token_type
. These parameters describe the lifetime of the token in seconds, and the kind of token that is being returned. If the state
parameter was included in the request, then it is also included in the response.
An example User Agent flow response is shown below:
Below is a JavaScript snippet that parses the response and returns the parameters to the server.
This code sends the parameters received on the fragment to the server using XMLHttpRequest and writes the access token to local storage in the browser. The latter is an optional step, and depends on whether or not the application requires other JavaScript code to make calls to the Imgur API. Also note that this code sends the parameters to the token endpoint, and they are sent over an HTTPS channel.
The Imgur API returns an error if the user did not grant your application the permissions it requested. The error is returned to the application in the query string parameter error if the web server flow is used. If the user agent flow was used, then the error is returned in the fragment. If the state parameter was included in the request, it is also present in the error response.
An example error response for the web server flow is shown below:
Congrats! You must have the user's access_token at this point and you're ready to start making API requests to their account. All that's required for this is to set the header in your requests:
If a user has authorized their account but you no longer have a valid access_token for them, then a new one can be generated by using the refresh_token.
When your application receives a refresh token, it is important to store that refresh token for future use. If your application loses the refresh token, you will have to prompt the user for their login information again.
To obtain a new access token, your application performs a POST to https://api.imgur.com/oauth2/token
. The request must include the following parameters to use a refresh token:
As long as the user has not revoked the access granted to your application, the response includes a new access token. A response from such a request is shown below:
For more information about how to use OAuth 2, please visit the great documentation from Google. At the time of writing, our OAuth 2 server is completely compatible with theirs. The documentation may be found here: https://developers.google.com/accounts/docs/OAuth2
Below are a few ways you can speed up your application's use of the Imgur API.
If you have any additional feature requests, please reach out on Twitter @imgurAPI!
The Imgur API supports ETags, which allows the API to signal to developers whether or not data from previous queries have changed.
Usage:
When fetching from the Imgur API, the response header will include an ETag with a digest of the response data. Save this ETag value for future requests to the same route.
An example ETag response header:
ETag: "a695f4e9672bf7fc7a779ac12ead684d72292506"
On the next request to the same route, include a If-None-Match header in the request with the ETag from the first step. (Note: the quotations around the hash must be included)
An example ETag request header:
If-None-Match: "a695f4e9672bf7fc7a779ac12ead684d72292506"
If the data hasn't changed, the response status code will be 304 (Not Modified) and no data will be returned.
If the response data has changed since the last request, the data is returned normally with a new ETag in the response header. Save this value for future requests.
Note: Although ETags help speed up your application, requests with the If-None-Match header will still count towards rate limits.
When an API endpoint is scheduled for deprecation the following actions will be taken:
Sunset
header (Sunset HTTP Header) added to incidate the last date the endpoint should be relied upon. When the Sunset
date has passed followup email will be sent to active third party developers notifing of the deprecation.
If you have questions that aren't answered here, the support page provides details on how to get help.
Account
Generate Access Token
Given a user's refresh token, this endpoint generates an access token.
The refresh token returned from the authorization code exchange
The client_id obtained during application registration
The client secret obtained during application registration
As defined in the OAuth2 specification, this field must contain a value of: refresh_token
Account Base
Request standard user information. If you need the username for the account that is logged in, it is returned in the request for an access token. Note: This endpoint also supports the ability to lookup account base info by account ID. To do so, pass the query parameter account_id
.
Account Block Status
Determine if the user making the request has blocked a username.
Account Blocks
List all accounts being blocked,
Account Block Create
Block a user.
Account Block Delete
Unblock a user.
Account Images
To make requests for the current account, you may use me
as the {{username}}
parameter. For example, https://api.imgur.com/3/account/me/images
will request all the images for the account that is currently authenticated.
Account Gallery Favorites
Return the images the user has favorited in the gallery.
Account Favorites
Returns the users favorited images, only accessible if you're logged in as the user.
Note: vote data ('ups', 'downs', and 'score') may be null if the favorited item hasn't been submitted to gallery
Account Submissions
Return the images a user has submitted to the gallery. You can add sorting as well after paging. Sorts can be: newest (default), oldest, worst, best.
Account Available Avatars (Un-authed / Authed)
If unauthentiated, get list of default trophies a user can select from. The username need not exist to get the listing.
If authenticated, get the list of available avatars for the given user.
If unauthenticated, send the Client-ID
If authenticated send the bearer token
Account Avatar (Authed)
Get the current account's avatar URL and avatar name.
Account Settings
Returns the account settings, only accessible if you're logged in as the user.
Change Account Settings
Updates the account settings for a given user, the user must be logged in.
(deprecated)
See Account Available Avatars for possible values
Account Gallery Profile
Verify User's E-mail
Send Verification E-mail
Sends an email to the user to verify that their email is valid to upload to gallery. Must be logged in as the user to send.
Albums (Un-Authed / Authed)
Get all the albums associated with the account. Must be logged in as the user to see secret and hidden albums.
Album
Get additional information about an album, this endpoint works the same as the Album Endpoint. You can also use any of the additional routes that are used on an album in the album endpoint.
Album IDs (Un-Authed / Authed)
Album Count (Un-Authed / Authed)
Album Deletion
Comments
Comment
Return information about a specific comment. This endpoint works the same as the Comment Endpoint. You can use any of the additional actions that the comment endpoint allows on this end point.
Comment IDs
Comment Count
Comment Deletion
Delete a comment. You are required to be logged in as the user whom created the comment.
Images
Return all of the images associated with the account. You can page through the images by setting the page, this defaults to 0.
Image
Return information about a specific image. This endpoint works the same as the Image Endpoint. You can use any of the additional actions that the image endpoint with this endpoint.
Image IDs
Image Count
Image Deletion
Replies
Returns all of the reply notifications for the user. Required to be logged in as that user.
Follow Tag
Follows the {{tagName}} specified for the currently logged in user.
Unfollow tag
Unfollows the {{tagName}} specified for the currently logged in user.
Account Delete (me)
Delete the account of the auth'd user with delete feedback.
note: password is left blank to avoid accidental account deletion, to delete account you must add account password to body.
Comment
Comment
Comment Creation
Comment Deletion
Replies
Reply Creation
Vote
Report
Report a comment for being inappropriate.
Optional. An integer representing the reason for the report
Album
There are two methods of sending the image ids, one way is by sending an array of images, this is denoted by []
's. Everywhere you see ids[]
, it's also an option to send a string of ids that is comma delineated. For example: ids=aaaaa,bbbbb,ccccc
is the same as sending ids[]=aaaaa&ids[]=bbbbb&ids[]=ccccc
.
Album
Album Images
Album Image
Get information about an image in an album, any additional actions found in Image Endpoint will also work.
Album Creation (Un-Authed / Authed)
Create a new album. Optional parameter of ids[]
is an array of image ids to add to the album. If uploading anonymous images to an anonymous album please use the optional parameter of deletehashes[]
rather than ids[]
. Note: including the optional deletehashes[]
parameter will also work for authenticated user albums. There is no need to duplicate image ids with their corresponding deletehash.
This method is available without authenticating an account, and may be used merely by sending "Authorization: Client-ID {client_id}" in the request headers. Doing so will create an anonymous album which is not tied to an account.
Use this header if performing this action anonymously.
Use this header if performing this action as a logged-in user.
The image ids that you want to be included in the album.
any additional image ids...
The deletehashes of the images that you want to be included in the album.
any additional deletehashes...
The title of the album
The description of the album
(deprecated) Sets the privacy level of the album. Values are : public | hidden | secret. Defaults to user's privacy settings for logged in users.
The ID of an image that you want to be the cover of the album
Update Album (Un-Authed / Authed)
Update the information of an album. For anonymous albums, albumHash
should be the deletehash that is returned at creation.
If uploading anonymous images to an anonymous album please use the optional parameter of deletehashes[]
rather than ids[]
. Note: including the optional deletehashes[]
parameter will also work for authenticated user albums. There is no need to duplicate image ids with their corresponding deletehash.
Use this header if performing this action anonymously.
Use this header if performing this action as a logged-in user.
Optional. The image ids that you want to be included in the album.
any additional image ids...
Optional. The deletehashes of the images that you want to be included in the album.
Optional. The title of the album
Optional. The description of the album
(deprecated) Optional. Sets the privacy level of the album. Values are : public
| hidden
| secret
. Defaults to user's privacy settings for logged in users.
Optional. The ID of an image that you want to be the cover of the album
Album Deletion (Un-Authed)
Album Deletion (Authed)
Delete an album with a given ID. You are required to be logged in as the user to delete the album.
Favorite Album
Favorite an album with a given ID. The user is required to be logged in to favorite the album.
Set Album Images (Un-Authed)
Sets the images for an album, removes all other images and only uses the images in this request.
Set Album Images (Authed)
Sets the images for an album, removes all other images and only uses the images in this request. You must include either ids[] or deletehashes[].
Add Images to an Album (Un-Authed)
Takes parameter, deletehashes[]
, as an array of deletehashes to add to the album. Alternatively, the deletehashes
parameter can take a comma delimted string of deletehashes.
Add Images to an Album (Authed)
Adds the images to an album. You must specify ids[] or deletehashes[] in order to add an image to an album.
Remove Images from an Album (Un-Authed)
Takes parameter, ids[]
, as an array of ids and removes from the album.
Remove Images from an Album (Authed)
Takes parameter, ids[]
, as an array of ids and removes from the album.
Gallery
Due to caching limitations of Imgur, it's not possible to change the result size of the gallery resources.
Gallery
Optional. true
| false
- Show or hide viral images from the user
section. Defaults to true
Optional. true
| false
- Show or hide mature (nsfw) images in the response section. Defaults to false
NOTE: This parameter is only required if un-authed. The response for authed users will respect their account setting.
Optional. true
| false
- Include image metadata for gallery posts which are albums
Subreddit Galleries
View gallery images for a subreddit
Subreddit Image
View a single image in the subreddit
Gallery Tag
Returns tag metadata, and posts tagged with the tagName
provided
Gallery Tags
Gets a list of default tags
Gallery Tag Info
Gets metadata about a tag
Gallery Item Tags
Update Gallery Item Tags
Update the tags for a post in the gallery
Required. ID of the gallery item
Required. The name of the tags you wish to associate with a post. Can be passed as tags[]=funny&tags[]=cat or tags=funny,cat
Gallery Search
Search the gallery with a given query string.
Random Gallery Images
DEPRECATED Returns a random set of gallery images.
Share with Community (Image)
Share an Album or Image to the Gallery.
Required. The title of the image.
Optional. Topic name
Optional. If the user has not accepted our terms yet, this endpoint will return an error. To by-pass the terms in general simply set this value to 1
.
Optional. If the post is mature, set this value to 1
.
Optional. The name of the tags you wish to associate with a post. Can be passed as tags[]=funny&tags[]=cat
or tags=funny,cat
Share with Community (Album)
Share an Album or Image to the Gallery.
Required. The title of the image.
Optional. Topic name
Optional. If the user has not accepted our terms yet, this endpoint will return an error. To by-pass the terms in general simply set this value to 1
.
Optional. If the post is mature, set this value to 1
.
Optional. The name of the tags you wish to associate with a post. Can be passed as tags[]=funny&tags[]=cat
or tags=funny,cat
Remove from Gallery
Remove an image from the public gallery. You must be logged in as the owner of the item to do this action.
Gallery Album
Gallery Image
Get additional information about an image in the gallery.
Album / Image Reporting
Album / Image Votes
Album / Image Voting
Album / Image Comments
Get comments on an image or album in the gallery.
galleryHash
is the unique identifier of an album or image in the gallery.
commentSort
is one of best
| top
| new
- defaults to best
.
Album / Image Comment
Information about a specific comment. This action also allows any of the additional actions provided in the Comment Endpoint.
Album / Image Comment Creation
Image
Image
Get information about an image.
Image Upload
Upload a new image or video.
A binary file, base64 data, or a URL for an image. (up to 10MB)
A binary file (up to 200MB)
The id of the album you want to add the image to. For anonymous albums, album should be the deletehash that is returned at creation
The type of the file that's being sent; file, base64 or URL
The name of the file, this is automatically detected if uploading a file with a POST and multipart / form-data
The title of the image
The description of the image
Will remove the audio track from a video file
Image Deletion (Un-Authed)
Image Deletion (Authed)
Update Image Information (Un-Authed)
Update Image Information (Authed)
Favorite an Image
Favorite an image with the given ID. The user is required to be logged in to favorite the image.