Imgflip API

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

The Imgflip API uses a RESTful JSON interface. Requests to the API may be rate-limited if you make a lot of requests. There is currently no paid version of the API, but we may create one if there are enough applications that need more requests than we are able to fulfill on a free basis. If you're considering using this API, feel free to contact us at [email protected] with any questions, suggestions, or concerns you may have.

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.

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

Method: GET

Example Success Response:
{
    "success": true,
    "data": {
        "memes": [
            {
                "id": "61579",
                "name": "One Does Not Simply",
                "url": "http://i.imgflip.com/1bij.jpg",
                "width": 568,
                "height": 335
            },
            {
                "id": "101470",
                "name": "Ancient Aliens",
                "url": "http://i.imgflip.com/26am.jpg",
                "width": 500,
                "height": 437
            }
            // 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
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
text0 Top text for the meme
text1 Bottom text for the meme
font [optional] The font family to use for the text. Current options are "impact" and "arial". Defaults to impact.
max_font_size [optional] Maximum font size in pixels. Defaults to 50px.
boxes [optional] For maximum customization. If boxes is specified, text0 and text1 will be ignored. You may specify up to 5 custom boxes. 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. 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.

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": "http://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"
}