API Documentation

Welcome to the Text to Meme API. Integrate our powerful meme generation engine directly into your applications. All requests and responses are in JSON format.

Authentication

All API requests must be authenticated using a bearer token. Include an Authorization header with your request.

Header Format
Authorization: Bearer XXXXXXXXXXXX

Meme Generation

Our API uses an asynchronous workflow. First, you make a POST request to start a generation job. The API immediately responds with a job_id. You then use this ID to poll for the results.

Generate with Random Templates

Use this method to have our AI select templates for you from a chosen library.

POST https://textomeme.com/api/v1/generate

Parameters

ParameterTypeRequiredDescription
promptStringYesThe text idea for your meme.
template_sourceStringNo (defaults to random)pick the templates randomly.
number_of_memesIntegerNo (defaults to 1)How many memes to generate.
libraryStringNo (defaults to "global")"global" or "my_templates".

Example Request Body

{
    "prompt": "When the tests pass on the first try",
    "template_source": "random",
    "number_of_memes": 2
  }

Example cURL Request

curl -X POST https://textomeme.com/api/v1/generate \
        -H "Authorization: Bearer XXXXXXXXXXXX" \
        -H "Content-Type: application/json" \
        -d '{"prompt": "...", "template_source": "random"}'

Successful Response

{
    "job_id": "a1b2c3d4e5f6g7h8"
  }

Generate with Specific Templates

Use this method when you know exactly which templates you want to use.

POST https://textomeme.com/api/v1/generate

Parameters

ParameterTypeRequiredDescription
promptStringYesThe text idea for your meme.
template_sourceStringYesMust be exactly "specific".
template_idsArray of StringsYesAn array of the template slugs you want to use.

Example Request Body

{
    "prompt": "When the tests pass on the first try",
    "template_source": "specific",
    "template_ids": ["drake-hotline-bling-slug", "success-kid-slug"]
  }

Example cURL Request

curl -X POST https://textomeme.com/api/v1/generate \
        -H "Authorization: Bearer XXXXXXXXXXXX" \
        -H "Content-Type: application/json" \
        -d '{"prompt": "...", "template_source": "specific", "template_ids": ["slug-1"]}'

Successful Response

{
    "job_id": "i9j0k1l2m3n4o5p6"
  }

Check Job Status

After creating a job, poll this endpoint with the job_id to get the result.

GET https://textomeme.com/api/v1/jobs/:job_id

URL Parameters

ParameterTypeDescription
:job_idStringThe ID returned from the initial POST request.

Possible Responses

The status field will tell you the current state of the job. You should continue polling until the status is "completed" or "failed".

Response (Processing)
{
    "job_id": "...",
    "status": "processing",
    "progress": "1 of 2 memes completed"
  }
Response (Completed)
{
    "job_id": "...",
    "status": "completed",
    "results": [
      {
        "meme_id": "meme_slug_1",
        "status": "completed",
        "image_url": "https://...",
        "editor_url": "https://..."
      }
    ]
  }

Example cURL Request

curl -X GET https://textomeme.com/api/v1/jobs/a1b2c3d4... \
     -H "Authorization: Bearer XXXXXXXXXXXX"

Error Codes

The API uses standard HTTP status codes for errors.

Status CodeMeaning
401 UnauthorizedAuthentication failed. Token is missing or invalid.
402 Payment RequiredNot enough credits to perform this action.
422 Unprocessable EntityInvalid parameters in the request body.
429 Too Many RequestsRate limit exceeded. Please slow down.
500 Internal Server ErrorAn unexpected error occurred on our end.