### Caption Image with Imgflip API (Example Parameters) Source: https://imgflip.com/api/index Demonstrates the parameters required to add a caption to an Imgflip meme template using a POST request. Key parameters include template_id, username, password, and the text content for the meme. Optional parameters like font and max_font_size can also be specified. ```HTTP POST /caption_image HTTP/1.1 Host: api.imgflip.com Content-Type: application/x-www-form-urlencoded template_id=61579&username=YOUR_USERNAME&password=YOUR_PASSWORD&text0=One%20Does%20Not%20Simply&text1=Walk%20Into%20Mordor ``` -------------------------------- ### Get Popular Memes with Imgflip API Source: https://imgflip.com/api/index Fetches an array of popular user-uploaded memes from the Imgflip API. The response includes meme ID, name, URL, dimensions, and default box count. The order and size of the returned array may change. ```JSON { "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 } ] } } ``` -------------------------------- ### GET /get_memes Source: https://imgflip.com/api/index Retrieves an array of popular user-uploaded memes that can be captioned. The response includes meme details such as ID, name, URL, dimensions, and default box count. ```APIDOC ## GET /get_memes ### Description Gets an array of popular user-uploaded 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. ### Method GET ### Endpoint https://api.imgflip.com/get_memes ### Parameters #### Query Parameters None ### Request Example None (GET request) ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains meme data. - **memes** (array) - An array of meme objects. - **id** (string) - The unique identifier for the meme template. - **name** (string) - The name of the meme template. - **url** (string) - The URL of the meme template image. - **width** (integer) - The width of the meme template image. - **height** (integer) - The height of the meme template image. - **box_count** (integer) - The default number of text boxes for the meme. #### Response Example ```json { "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 } ] } } ``` ``` -------------------------------- ### POST /ai_meme Source: https://imgflip.com/api/index Generates a fresh meme from scratch using either OpenAI GPT or Imgflip's deep neural network trained on millions of public memes. Allows optional template selection and prefix text seeding. Requires API Premium subscription. ```APIDOC ## POST /ai_meme ### Description Generates a completely fresh meme from scratch using either OpenAI GPT or Imgflip's classic deep neural network model trained on millions of public memes. Allows optional template selection and prefix text to seed the generation. Note: The classic model is not censored and may contain vulgarities. ### Method POST ### Endpoint https://api.imgflip.com/ai_meme ### Parameters #### Request Body - **username** (string) - Required - Username of the Imgflip account with Premium API subscription - **password** (string) - Required - Password for the Imgflip account (must be in request body, not URL) - **model** (string) - Optional - Neural network model to use: "openai" or "classic". Defaults to "openai" if unspecified - **template_id** (integer) - Optional - Template ID to use. For classic model, choose from 48 templates at imgflip.com/ai-meme. For openai model, any popular Imgflip template. Randomly selected if not specified - **prefix_text** (string) - Optional - Max 64 characters. Initial prefix text to seed meme generation. For openai, used as general topic. For classic, shorter is better for creative variety - **no_watermark** (boolean) - Optional - Remove the imgflip.com watermark from the generated meme ### Request Example ``` { "username": "your_username", "password": "your_password", "model": "openai", "template_id": 89370399, "prefix_text": "Eric", "no_watermark": false } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful - **data** (object) - Contains the generated meme data - **url** (string) - URL of the generated meme image - **page_url** (string) - Imgflip page URL for the generated meme - **template_id** (integer) - ID of the meme template used - **texts** (array) - Array of text strings generated for the meme #### Response Example ``` { "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"] } } ``` ### Pricing - First 50 creations per month included with Premium subscription - $0.02 per creation after the first 50 - Premium subscription: $9.99/month ``` -------------------------------- ### Creating Memes with Custom Text Boxes Source: https://imgflip.com/api/index This function demonstrates how to create memes with custom text box positioning and styling using the 'boxes' parameter. It allows for advanced customization beyond the standard top and bottom text. The 'boxes' parameter expects an array of objects, where each object defines the text content, position (x, y), dimensions (width, height), and color/outline properties for a text box. Ensure all four bounding box coordinates are provided if any are specified. ```json [ { "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" } ] ``` -------------------------------- ### POST /search_memes Source: https://imgflip.com/api/index Search for meme templates that can be captioned. This endpoint requires API Premium. ```APIDOC ## POST /search_memes ### Description Search for meme templates that can be captioned with the /caption_image endpoint. This allows users to search for templates from Imgflip's database. Searching memes requires API Premium. ### Method POST ### Endpoint https://api.imgflip.com/search_memes ### Parameters #### Query Parameters - **username** (string) - Required - Username of the Imgflip account with the Premium API subscription. - **password** (string) - Required - Password for the Imgflip account. - **query** (string) - Required - A text query to search the meme database for. Searches both names and alternate names. - **include_nsfw** (integer) - Optional - Use 1 to allow not-safe-for-work memes to be returned. Defaults to 0. ### Request Example ```json { "username": "your_premium_username", "password": "your_premium_password", "query": "doge", "include_nsfw": 0 } ``` ### Response #### Success Response (200) - **success** (boolean) - True if the operation was successful. - **data** (object) - Contains a list of matching meme templates. - **memes** (array of objects) - A list of meme objects. - **id** (string) - The ID of the meme template. - **name** (string) - The name of the meme template. - **url** (string) - The URL of the meme template image. - **width** (integer) - The width of the meme template. - **height** (integer) - The height of the meme template. - **box_count** (integer) - The default number of text boxes the meme uses. - **captions** (integer) - Estimated number of all-time captions for this meme. #### Response Example (Success) ```json { "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 } ] } } ``` #### Error Response (400/500) - **success** (boolean) - False if the operation failed. - **error_message** (string) - A message describing the error. #### Response Example (Failure) ```json { "success": false, "error_message": "API Premium required for this endpoint." } ``` ``` -------------------------------- ### POST /caption_gif Source: https://imgflip.com/api/index Add a caption to an Imgflip animated GIF template. This endpoint requires API Premium. ```APIDOC ## POST /caption_gif ### Description Add a caption to an Imgflip animated GIF template. This endpoint requires API Premium. It uses the 'boxes' parameter for text customization and does not support the older text0/text1 format. ### Method POST ### Endpoint https://api.imgflip.com/caption_gif ### Parameters #### Query Parameters - **username** (string) - Required - Username of the Imgflip account with the Premium API subscription. - **password** (string) - Required - Password for the Imgflip account. - **template_id** (string) - Required - An animated template ID. - **font** (string) - Optional - The font to use for the captions. - **max_font_size** (integer) - Optional - The maximum font size to use. - **no_watermark** (boolean) - Optional - Removes the Imgflip watermark (Premium feature). - **boxes** (array of objects) - Required - For advanced customization, allows specifying text, position, size, color, and outline color for multiple text boxes. - **text** (string) - Required - The text for the box. - **x** (integer) - Required if bounding box is specified - The x-coordinate of the top-left corner. - **y** (integer) - Required if bounding box is specified - The y-coordinate of the top-left corner. - **width** (integer) - Required if bounding box is specified - The width of the text box. - **height** (integer) - Required if bounding box is specified - The height of the text box. - **color** (string) - Optional - Hex color code for the text. - **outline_color** (string) - Optional - Hex color code for the text outline. ### Request Example ```json { "username": "your_premium_username", "password": "your_premium_password", "template_id": "some_gif_template_id", "boxes": [ { "text": "Waiting for my turn", "x": 50, "y": 50, "width": 200, "height": 50, "color": "#ffffff", "outline_color": "#000000" } ] } ``` ### Response #### Success Response (200) - **success** (boolean) - True if the operation was successful. - **data** (object) - Contains the URL of the generated GIF and its page URL. - **url** (string) - The URL of the generated GIF. - **page_url** (string) - The URL of the GIF on Imgflip. #### Response Example (Success) ```json { "success": true, "data": { "url": "https://i.imgflip.com/animated.gif", "page_url": "https://imgflip.com/i/animated" } } ``` #### Error Response (400/500) - **success** (boolean) - False if the operation failed. - **error_message** (string) - A message describing the error. #### Response Example (Failure) ```json { "success": false, "error_message": "API Premium required for this endpoint." } ``` ``` -------------------------------- ### POST /caption_image Source: https://imgflip.com/api/index This endpoint allows you to add text captions to an image. It supports custom text placement using the 'boxes' parameter for advanced customization. ```APIDOC ## POST /caption_image ### Description This endpoint allows you to add text captions to an image. It supports custom text placement using the 'boxes' parameter for advanced customization. The 'no_watermark' option is available for premium users. ### Method POST ### Endpoint https://api.imgflip.com/caption_image ### Parameters #### Query Parameters - **username** (string) - Required - Username of the Imgflip account. - **password** (string) - Required - Password for the Imgflip account. - **template_id** (string) - Required - The ID of the meme template to use. - **text0** (string) - Optional - The text for the first caption box (deprecated, use 'boxes' instead). - **text1** (string) - Optional - The text for the second caption box (deprecated, use 'boxes' instead). - **font** (string) - Optional - The font to use for the captions. - **max_font_size** (integer) - Optional - The maximum font size to use. - **no_watermark** (boolean) - Optional - If true, removes the Imgflip watermark (Premium feature). - **boxes** (array of objects) - Optional - For advanced customization, allows specifying text, position, size, color, and outline color for multiple text boxes. If provided, text0 and text1 are ignored. - **text** (string) - Required - The text for the box. - **x** (integer) - Required if bounding box is specified - The x-coordinate of the top-left corner. - **y** (integer) - Required if bounding box is specified - The y-coordinate of the top-left corner. - **width** (integer) - Required if bounding box is specified - The width of the text box. - **height** (integer) - Required if bounding box is specified - The height of the text box. - **color** (string) - Optional - Hex color code for the text. - **outline_color** (string) - Optional - Hex color code for the text outline. ### Request Example ```json { "username": "your_username", "password": "your_password", "template_id": "180649309", "text0": "One does not simply", "text1": "Make custom memes" } ``` ### Request Example with Boxes ```json { "username": "your_username", "password": "your_password", "template_id": "180649309", "boxes": [ { "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" } ] } ``` ### Response #### Success Response (200) - **success** (boolean) - True if the operation was successful. - **data** (object) - Contains the URL of the generated image and its page URL. - **url** (string) - The URL of the generated image. - **page_url** (string) - The URL of the image on Imgflip. #### Response Example (Success) ```json { "success": true, "data": { "url": "https://i.imgflip.com/123abc.jpg", "page_url": "https://imgflip.com/i/123abc" } } ``` #### Error Response (400/500) - **success** (boolean) - False if the operation failed. - **error_message** (string) - A message describing the error. #### Response Example (Failure) ```json { "success": false, "error_message": "Some hopefully-useful statement about why it failed" } ``` ``` -------------------------------- ### POST /caption_image Source: https://imgflip.com/api/index Adds a caption to an Imgflip meme template. This endpoint generates a publicly accessible image URL for the created meme. It requires authentication details and text to be added to the meme. ```APIDOC ## POST /caption_image ### Description 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. If the image hangs around on Imgflip servers for a while and gets very few views, it will be auto-deleted to save space. It is recommended to create your own Imgflip account for API usage beyond testing. ### Method POST ### Endpoint https://api.imgflip.com/caption_image ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **template_id** (string) - Required - A template ID as returned by the get_memes response or from a custom template URL. - **username** (string) - Required - Username of a valid Imgflip account. - **password** (string) - Required - Password for the Imgflip account. - **text0** (string) - Optional - Top text for the meme (do not use if using `boxes`). - **text1** (string) - Optional - Bottom text for the meme (do not use if using `boxes`). - **boxes** (array of objects) - Optional - An array of text objects for custom placement and content. Each object can have `text`, `x`, `y`, `width`, `height`, `color`, `outline_color`. - **font** (string) - Optional - The font family to use for the text. Defaults to 'impact'. Can also be 'arial' or any of the 1,500+ Google Fonts. - **max_font_size** (integer) - Optional - Maximum font size in pixels. Defaults to 50px. ### Request Example ```json { "template_id": "61579", "username": "your_imgflip_username", "password": "your_imgflip_password", "text0": "One does not simply", "text1": "make memes without the API" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the URL of the generated meme. - **url** (string) - The publicly accessible URL of the generated meme image. - **pageurl** (string) - The URL of the page where the meme can be viewed. #### Response Example ```json { "success": true, "data": { "url": "https://i.imgflip.com/xxxxxx.jpg", "pageurl": "https://imgflip.com/i/xxxxxx" } } ``` #### Error Response (e.g., 400, 401, 404) - **success** (boolean) - `false` - **error_message** (string) - A description of the error. ``` -------------------------------- ### API Success Response Structure Source: https://imgflip.com/api/index This is a standard success response from the Imgflip API, indicating that a request was processed successfully. It includes a boolean 'success' flag set to true and a 'data' object containing relevant information, such as the URL of the generated image and its corresponding page URL. ```json { "success": true, "data": { "url": "https://i.imgflip.com/123abc.jpg", "page_url": "https://imgflip.com/i/123abc" } } ``` -------------------------------- ### POST /automeme Source: https://imgflip.com/api/index Automatically caption one of the top 2,048 memes based on input text using a deep neural network trained on millions of public Imgflip memes. This endpoint uses AI to intelligently select the appropriate meme template and add captions. Requires API Premium subscription. ```APIDOC ## POST /automeme ### Description Automatically caption one of the top 2,048 memes based only on the input text. Uses a deep neural network trained on millions of public Imgflip memes to intelligently select the meme template and add captions. Works best with shorter, simpler memes. ### Method POST ### Endpoint https://api.imgflip.com/automeme ### Parameters #### Request Body - **username** (string) - Required - Username of the Imgflip account with Premium API subscription - **password** (string) - Required - Password for the Imgflip account (must be in request body, not URL) - **text** (string) - Required - The text to display on the meme, also used to determine which meme template to use - **no_watermark** (boolean) - Optional - Remove the imgflip.com watermark from the generated meme ### Request Example ``` { "username": "your_username", "password": "your_password", "text": "nobody got time for reading long API docs", "no_watermark": false } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful - **data** (object) - Contains the generated meme data - **url** (string) - URL of the generated meme image - **page_url** (string) - Imgflip page URL for the generated meme - **template_id** (integer) - ID of the meme template used - **texts** (array) - Array of text strings added to the meme #### Response Example ``` { "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 } } } ``` ### Pricing - First 50 creations per month included with Premium subscription - $0.02 per creation after the first 50 - Premium subscription: $9.99/month ``` -------------------------------- ### API Failure Response Structure Source: https://imgflip.com/api/index This is a standard failure response from the Imgflip API, indicating that a request could not be processed successfully. It includes a boolean 'success' flag set to false and an 'error_message' providing details about the reason for the failure. ```json { "success": false, "error_message": "Some hopefully-useful statement about why it failed" } ``` -------------------------------- ### POST /get_meme Source: https://imgflip.com/api/index Retrieve a specific meme by its ID. This endpoint is currently Premium only. ```APIDOC ## POST /get_meme ### Description Get a meme by ID. This endpoint returns the same format as the /search_memes endpoint. It is helpful if your users want to upload templates to Imgflip and then provide you with the ID directly to use in your application. Currently Premium only. ### Method POST ### Endpoint https://api.imgflip.com/get_meme ### Parameters #### Query Parameters - **username** (string) - Required - Username of the Imgflip account with the Premium API subscription. - **password** (string) - Required - Password for the Imgflip account. - **template_id** (string) - Required - The ID of the meme template to retrieve. ### Request Example ```json { "username": "your_premium_username", "password": "your_premium_password", "template_id": "61579" } ``` ### Response #### Success Response (200) - **success** (boolean) - True if the operation was successful. - **data** (object) - Contains the details of the requested meme template. - **memes** (array of objects) - A list containing a single meme object. - **id** (string) - The ID of the meme template. - **name** (string) - The name of the meme template. - **url** (string) - The URL of the meme template image. - **width** (integer) - The width of the meme template. - **height** (integer) - The height of the meme template. - **box_count** (integer) - The default number of text boxes the meme uses. - **captions** (integer) - Estimated number of all-time captions for this meme. #### Response Example (Success) ```json { "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 } ] } } ``` #### Error Response (400/500) - **success** (boolean) - False if the operation failed. - **error_message** (string) - A message describing the error. #### Response Example (Failure) ```json { "success": false, "error_message": "Meme with ID 12345 not found." } ``` ``` -------------------------------- ### Meme Search Results Structure Source: https://imgflip.com/api/index This JSON structure represents the successful response from the /search_memes endpoint. It contains a 'success' flag and a 'data' object, which includes an array of 'memes'. Each meme object provides its ID, name, URL, dimensions, default box count, and an estimated caption count. ```json { "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 } ] } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.