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.
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
Parameter | Type | Required | Description |
---|---|---|---|
prompt | String | Yes | The text idea for your meme. |
template_source | String | No (defaults to random) | pick the templates randomly. |
number_of_memes | Integer | No (defaults to 1) | How many memes to generate. |
library | String | No (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
Parameter | Type | Required | Description |
---|---|---|---|
prompt | String | Yes | The text idea for your meme. |
template_source | String | Yes | Must be exactly "specific" . |
template_ids | Array of Strings | Yes | An 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
Parameter | Type | Description |
---|---|---|
:job_id | String | The 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"
.
{
"job_id": "...",
"status": "processing",
"progress": "1 of 2 memes 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 Code | Meaning |
---|---|
401 Unauthorized | Authentication failed. Token is missing or invalid. |
402 Payment Required | Not enough credits to perform this action. |
422 Unprocessable Entity | Invalid parameters in the request body. |
429 Too Many Requests | Rate limit exceeded. Please slow down. |
500 Internal Server Error | An unexpected error occurred on our end. |