Meme LemurDocs

Render a template

Send a template id and your own captions to POST /v1/render and get the finished image back. No model is called.

Render captions on a template #

POST /v1/render

Render draws the captions you send on the template you chose. It calls no model, so it is fast and does not count toward the daily cap. Use it when a member edits the captions of a meme, or when your own code writes them.

Request #

Field Type What it does
templateId string A shared template, or one your team uploaded. Required.
captions 1 to 12 strings, each up to 500 characters One caption for each box of the template, in box order. Required. Send an empty string to leave a box empty.
media image or gif What you expect back, in place of media in your settings. It has to be what the template makes: image for a still template and gif for an animated one.

The number of captions has to equal the number of boxes the template has. Get one template returns its boxes and its kind.

A box with text always says that text. It still takes its caption in the request, so the count does not change, and what you send there is dropped: send an empty string. The captions in the response have the box's text in that place, and that is what is drawn, checked against your prohibited topics and stored.

An animated template is rendered as a GIF with the captions on every frame, in the size your gifSize setting chooses. Animated memes has the two sizes.

Shell
curl https://api.memelemur.com/v1/render \
  -H "Authorization: Bearer $MEMELEMUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"templateId": "tpl_kwhxl4k7tqhc25ds", "captions": ["Testing in staging", "Testing in production"]}'

Response #

The response has one meme, where generate and match return a list.

JSON
{
  "generationId": "gen_ii4sttc53bp6md6j",
  "meme": {
    "key": "renders/tnt_hc0n3r4w54a35prf/84916e08bafaf14ed453362dce5d33b5f72994b9ae12ebe4a04c79dbc5224020.jpg",
    "url": "https://api.memelemur.com/i/renders/tnt_hc0n3r4w54a35prf/84916e08bafaf14ed453362dce5d33b5f72994b9ae12ebe4a04c79dbc5224020.jpg",
    "width": 446,
    "height": 698,
    "templateId": "tpl_kwhxl4k7tqhc25ds",
    "templateName": "Drakeposting",
    "captions": ["Testing in staging", "Testing in production"],
    "id": "shown_jedws5zgdmnp6t5i"
  }
}

The text is fitted to each box: the largest font size at which the words wrap inside the box is used. The longest side of the image is at most maxDimension from your settings.

The same template and captions always give the same url, and a repeat of an earlier render is returned without drawing it again.

id works with feedback the same way a generated meme's does. If the call could not be stored, the meme is still returned, and generationId and id are null.

With the Memelemur-Space header, the call is counted in that space and uses the space's maxDimension.

Errors #

Status When
400 A field is missing or out of range, or the number of captions is not the number of boxes. The message says both numbers, such as template has 2 caption slots, got 1.
400 The template is animated and the call did not ask for gif, or it is still and the call asked for gif. The message says which media the template is rendered as.
404 No template has that id, it belongs to another team, or your settings or the space's block it by id or by tag.
422 The captions reference one of your prohibited topics.
429 Your team made more render calls in a minute than its rendersPerMinute allows, 600 unless the operator set another number. Retry-After says how many seconds to wait.