JUHE API Marketplace
Comprehensive Documentation

API Documentation

Everything you need to integrate and use our APIs effectively with guides, references, and examples

Meme Generator API

5 min read

This API allows you to programmatically create memes. You can either use a predefined list of popular meme templates or provide your own custom background image.

API Endpoints

1. List Templates

Fetches a list of all available meme templates. You should call this endpoint first to get the id for a specific template, which is required for the /generate endpoint.

  • Functionality: Fetches a list of available meme templates.
  • Method: GET
  • Endpoint: /meme/v1/templates

Query Parameters

ParameterRequiredTypeDescription
apikeyYesstringYour unique API key.

Responses

Successful Response (Code 200)

Returns a JSON object containing an array of template objects.

{
  "code": "0",
  "msg": "success",
  "data": {
    "templates": [
      {
        "id": "aag",
        "name": "Always Has Been",
        "lines": 2,
        "styles": [],
        "blank": "https://api.juheapi.com/memes/aag.png",
        "example": "https://api.juheapi.com/memes/aag/astronaut1/astronaut2.png",
        "source": "https://knowyourmeme.com/memes/always-has-been",
        "_self": "https://api.juheapi.com/templates/aag"
      }
    ]
  }
}

Error Responses

  • 401 Unauthorized: The provided apikey is invalid.
  • 502 Bad Gateway: The service failed to fetch templates from its source.

2. Generate Meme from Template

Generates a meme image using a specified template and text. The response will contain a URL to the final image.

  • Functionality: Generates a meme from a template.
  • Method: GET
  • Endpoint: /meme/v1/generate

Query Parameters

ParameterRequiredTypeDescription
apikeyYesstringYour unique API key.
templateYesstringThe id of the meme template (obtained from /templates).
top_textYesstringThe text to display on the top of the meme.
bottom_textNostringThe text to display on the bottom. Use an underscore (_) for a blank line.
formatNostringDesired image format. Can be png, jpg, gif, webp. Defaults to png.
fontNostringThe font to use (e.g., impact, notosans).
widthNointegerDesired width of the image in pixels.
heightNointegerDesired height of the image in pixels.
layoutNostringControls text positioning (e.g., top).
styleNostringAn alternate style for the template or a URL for an image overlay.

Responses

Successful Response (Code 200)

{
  "code": "0",
  "msg": "success",
  "data": {
    "meme_url": "https://api.juheapi.com/Memes/Memes_Everywhere.png?font=impact"
  }
}

Error Responses

  • 400 Bad Request: Required parameters like template or top_text are missing.
  • 401 Unauthorized: The provided apikey is invalid.

3. Generate Meme with Custom Background

Generates a meme using a custom image from a URL as the background.

  • Functionality: Creates a meme with a user-provided background.
  • Method: GET
  • Endpoint: /meme/v1/custom

Query Parameters

ParameterRequiredTypeDescription
apikeyYesstringYour unique API key.
background_urlYesstringThe URL of the image to use as the background.
top_textYesstringThe text to display on the top of the meme.
bottom_textNostringThe text to display on the bottom. Use an underscore (_) for a blank line.
formatNostringDesired image format. Can be png, jpg, gif, webp. Defaults to png.
fontNostringThe font to use.
widthNointegerDesired width of the image in pixels.
heightNointegerDesired height of the image in pixels.
layoutNostringControls text positioning.
styleNostringA URL for an image to overlay on top of the custom background.

Responses

Successful Response (Code 200)

{
  "code": "0",
  "msg": "success",
  "data": {
    "meme_url": "https://api.juheapi.com/memes/custom/Hello/World.png?background=https%3A%2F%2Fi.imgur.com%2Fexample.jpg&font=arial"
  }
}

Error Responses

  • 400 Bad Request: The background_url is missing or has an invalid format.
  • 401 Unauthorized: The provided apikey is invalid.

⚠️ Important Considerations

  1. API Key: A valid apikey is required for all endpoints.
  2. Standard Workflow: The recommended workflow is to first call /meme/v1/templates to find the id of the template you want, and then use that id in your call to /meme/v1/generate.
  3. Required Text: The top_text parameter is always required when generating a meme.
  4. Blank Lines: If you need a meme with only top text, use an underscore (_) for the bottom_text parameter.