Imgflip Logo Icon

Imgflip API

Looking to integrate memes into Slack? Check out our Imgflip Slack App.

The Imgflip API uses a RESTful JSON interface. Request parameters are standard HTTP form urlencoded parameters, and return data is JSON.

The base version of the API is free. You can upgrade to our Premium API to unlock advanced features. Requests to the free version of the API do not have a hard limit, but may be throttled or blocked if you start doing crazy things or abusing the API. The Premium API has a base cost of $9.99 per month and includes some Premium requests each month (details below). After that, each type of Premium request has a small per-request cost. Note that the free API endpoints are still free if you have API Premium, you'll only be charged for the Premium-only features.

Feel free to contact us at [email protected] with any questions or suggestions.

Free Premium
Get top memes Yes Yes
Make memes for free Yes Yes
Caption animated GIFs No Yes
Search all 1M+ memes No Yes
Make memes without watermark No Yes
Make memes with AI (automeme and ai_meme) No Yes
/get_memes
Gets an array of popular memes that may be captioned with this API. The size of this array and the order of memes may change at any time. When this description was written, it returned 100 memes ordered by how many times they were captioned in the last 30 days. Additional properties other than those listed below may be added in the future without warning, so do not assume the JSON structure of each meme will never have new properties.

URL: https://api.imgflip.com/get_memes

Method: GET

Example Success Response:

box_count is the default number of boxes each meme uses. some memes have many text boxes

{
   "success": true,
   "data": {
      "memes": [
         {
            "id": "61579",
            "name": "One Does Not Simply",
            "url": "https://i.imgflip.com/1bij.jpg",
            "width": 568,
            "height": 335,
            "box_count": 2
         },
         {
            "id": "101470",
            "name": "Ancient Aliens",
            "url": "https://i.imgflip.com/26am.jpg",
            "width": 500,
            "height": 437,
            "box_count": 2
         }
         // probably a lot more memes here..
      ]
   }
}
		
/caption_image

Add a caption to an Imgflip meme template. Images created with this API will be publicly accessible by anyone through the url in the response - there is no "private" option. This does not mean these memes will be posted publicly though, one still needs to know the exact URL to find the image. If the image hangs around on Imgflip servers for a while and gets very few views (direct image views and image page views both count), it will be auto-deleted to save space.

For a real working example of the API, check out this hubot script (written in coffeescript). That script is open source, so feel free to use that set of regexes as a starting place. IMPORTANT NOTE: If you plan to use the API for anything other than testing, you should create your own Imgflip account and use that instead of the default imgflip_hubot account, because that account may be limited as soon as you send a non-trivial number of requests, and then your script wouldn't be able to make memes anymore, and everyone would be sad.

URL: https://api.imgflip.com/caption_image

Method: POST

Input Parameters

All memes on Imgflip can have custom default font settings which will be used if you do not specify the exact settings you want. For example, this allows a meme such as Two Buttons to default to uncapitalized black text with rotation applied, because it fits the template better.

key value
template_id A template ID as returned by the get_memes response. Any ID that was ever returned from the get_memes response should work for this parameter. For custom template uploads, the template ID can be found in the memegenerator URL, e.g. https://imgflip.com/memegenerator/14859329/Charlie-Sheen-DERP. Also, here is a list of the top 100 Imgflip meme IDs.
username username of a valid imgflip account. This is used to track where API requests are coming from.
password password for the imgflip account. As always, make sure password (and all the other parameters) are in the body of the POST request, not in the request url.
text0 Top text for the meme (do not use this parameter if you are using the boxes parameter below)
text1 Bottom text for the meme (do not use this parameter if you are using the boxes parameter below)
font [optional] The font family to use for the text. Defaults to impact. You can also use "arial" or any of the 1,500+ Google Fonts which you can see in the font menu at imgflip.com/memegenerator.
max_font_size [optional] Maximum font size in pixels. Defaults to 50px.
no_watermark [optional] [premium only] Remove the imgflip.com watermark. First 100 per month included, then $0.01 per creation.
boxes [optional] For creating memes with more than two text boxes, or for further customization. If boxes is specified, text0 and text1 will be ignored, and text will not be automatically converted to uppercase, so you'll have to handle capitalization yourself if you want the standard uppercase meme text. The API is currently limited to 20 text boxes per image. All options below are optional, except "text". The exception is that you may leave the first box completely empty, so that the second box will automatically be used for the bottom text.

x, y, width, and height are for the bounding box of the text box. x and y are the coordinates of the top left corner. If you specify bounding coordinates, be sure to specify all four (x, y, width, height), otherwise your text may not show up correctly. If you do not specify bounding box coordinates, the same automatic default coordinates from imgflip.com/memegenerator will be used, which is very useful for memes with special text box positioning other than the simple top/bottom.

Example "boxes" array:
[
   {
      "text": "One does not simply",
      "x": 10,
      "y": 10,
      "width": 548,
      "height": 100,
      "color": "#ffffff",
      "outline_color": "#000000"
   },
   {
      "text": "Make custom memes on the web via imgflip API",
      "x": 10,
      "y": 225,
      "width": 548,
      "height": 100,
      "color": "#ffffff",
      "outline_color": "#000000"
   }
]
					
Example Success Response:
{
   "success": true,
   "data": {
      "url": "https://i.imgflip.com/123abc.jpg",
      "page_url": "https://imgflip.com/i/123abc"
   }
}
		
Example Failure Response:
{
   "success" => false,
   "error_message" => "Some hopefully-useful statement about why it failed"
}
		
/caption_gif

Add a caption to an Imgflip animated GIF template. Mostly identical to /caption_image above, except the older text0/text1 format is not supported (use boxes instead).

/caption_gif requires API Premium. First 50 creations per month are included, then $0.02 per creation.

URL: https://api.imgflip.com/caption_gif

Method: POST

Input Parameters
key value
template_id An animated template ID.
username see /caption_image
password
font
max_font_size
no_watermark
boxes

/search_memes

Search for meme templates that can be captioned with the /caption_image endpoint. This allows you to give users a search input to find which of the 1M+ templates from the Imgflip database they want to use. If you plan to use search-as-you-type and send multiple searches per user, you may want to use caching on your frontend. Do not cache the results globally for all users on your backend though, as memes are constantly updated.

IMPORTANT NOTE: The Imgflip database is user-generated content, NOT curated content. We have some simple mechanisms to help prevent spam and inappropriate content, but you may want to filter based on your own criteria such as language or number of captions (aka popularity).

Searching memes requires API Premium. First 200 searches per month are included, then $0.005 per search.

URL: https://api.imgflip.com/search_memes

Method: POST

Input Parameters
key value
username username of the imgflip account with the Premium API subscription
password password for the imgflip account. As always, make sure password (and all the other parameters) are in the body of the POST request, not in the request url.
query A text query to search the meme database for. Searches both names and alternate names.
include_nsfw [optional] Use include_nsfw=1 to allow not-safe-for-work memes to be returned. Defaults to 0. NSFW memes may contain adult language, comedy, or minimal clothing, but should not contain porn or other content forbidden in the Imgflip Terms.
Example Success Response:

box_count is the default number of boxes each meme uses. some memes have many text boxes

{
   "success": true,
   "data": {
      "memes": [
      {
         "id": "61579",
         "name": "One Does Not Simply",
         "url": "https://i.imgflip.com/1bij.jpg",
         "width": 568,
         "height": 335,
         "box_count": 2,
         "captions": 1750 // estimated number of all-time captions of this meme, rounded
      },
      // probably a lot more memes here..
   ]
   }
}
		
/get_meme

Get a meme by ID. Same return format as /search_memes. Helpful if your users want to upload templates to Imgflip and then give you the ID directly to use in your app/website/bot. Currently Premium only.

URL: https://api.imgflip.com/get_meme

Method: POST

Input Parameters
key value
username
password
template_id
Example Success Response:
{
   "success": true,
   "data": {
     "meme": {
       "id": "61579",
       "name": "One Does Not Simply",
       "url": "https://i.imgflip.com/1bij.jpg",
       "width": 568,
       "height": 335,
       "box_count": 2,
       "captions": 1750 // estimated number of all-time captions of this meme, rounded
     }
   }
}
		
/automeme

Automatically caption one of the top 2,048 memes based only on the input text. This allows someone to simply type the phrase they want turned into a meme, and Imgflip magically picks the correct meme and adds their text. Automeme uses a deep neural network trained on millions of public Imgflip memes. Keep in mind that some memes work much better than others for this style of creation, namely shorter simpler memes. Memes with many text locations and no discernible patterns are less likely to work well.

To see how it works, try it yourself at imgflip.com/automeme. This is also what powers the Imgflip Slack App where you can type phrases like "/imgflip nobody got time for reading long API docs".

Automeme requires API Premium. First 50 creations per month are included, then $0.02 per creation.

URL: https://api.imgflip.com/automeme

Method: POST

Input Parameters
key value
username username of the imgflip account with the Premium API subscription
password password for the imgflip account. As always, make sure password (and all the other parameters) are in the body of the POST request, not in the request url.
text The text to display on the meme. This will also be used to determine which meme template to use.
no_watermark [optional] Remove the imgflip.com watermark.
Example Success/Failure:

Same as /caption_image

/ai_meme

Generates a fresh meme from scratch using either OpenAI GPT or Imgflip's own deep neural network trained on millions of public memes.

IMPORTANT NOTE (only if using classic model): The classic Imgflip AI is trained on all public user-generated content, so it is NOT censored or curated in any way, and therefore may contain vulgarities or other potentially unsuitable content. If this doesn't fit your use case, you may want to filter the output based on language.

To see how it works, try it yourself at imgflip.com/ai-meme.

AI Meme requires API Premium. First 50 creations per month are included, then $0.02 per creation.

URL: https://api.imgflip.com/ai_meme

Method: POST

Input Parameters
key value
username username of the imgflip account with the Premium API subscription
password password for the imgflip account. As always, make sure password (and all the other parameters) are in the body of the POST request, not in the request url.
model [optional] Which neural network model to use, can be either "openai" or "classic". Corresponds to the OpenAI GPT and Imgflip Classic Model available on imgflip.com/ai-meme. The current default is "openai" if left unspecified.
template_id [optional] This allows you to choose one of the 48 templates from imgflip.com/ai-meme if using the classic model, otherwise any popular Imgflip template if using the openai model. If not specified, it will randomly select one of those 48 memes (or top 94 memes for openai). You can find the top 100 template IDs here: imgflip.com/popular-meme-ids, or any other template ID from the template detail page when searching meme templates.
prefix_text [optional] Max 64 chars. Initial prefix text to seed the meme text, e.g. "Eric" to make the meme about Eric. For the openai model, it's used as a general topic rather than strictly prefix text. For the classic model, shorter is generally better as it gives the AI more room for creative variety.
no_watermark [optional] Remove the imgflip.com watermark.
Example Success Response:
{
   "success": true,
   "data": {
      "url": "https://i.imgflip.com/123abc.jpg",
      "page_url": "https://imgflip.com/i/123abc",
      "template_id": 89370399,
      "texts": ["you can't get caught to sing a conversation", "if you don't have any money"]
   }
}