Skip to navigation

Create Template

Add a template to the library, by the app’s library form’s rules, whoever asks. A key acts with an app admin’s rights; a signed-in session must be an app admin of Memegen’s own (403 admin_required). The name is folded onto one line and kept to 120 characters; the address must be http or https; a picture already in the workspace is promoted into the library and renamed rather than added twice (200, with that template, rather than 201); a new one is measured unless width and height are sent, and goes to the end of the picker unless sortOrder says otherwise. A key’s template is credited to the key’s maker.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
namestringRequired

What the workspace sees in the picker. Folded onto one line (runs of spaces and newlines become one space), trimmed, and cut at 120 characters; one with nothing left is refused with 422. Over 200 characters is refused with 422 before that.

imageUrlstringRequired

The background: an http or https address. Any other scheme (javascript:, data:, file:) is refused with 422. If a template in the workspace already has this picture, that template is promoted into the library rather than a second one added.

slugstringOptional

Left out, one is derived from the name and numbered (-2, -3…) if it clashes. Given and already taken by another picture, the request is refused with 409 rather than renamed.

layoutenumOptional
Where the captions sit on a template.
Allowed values:
widthintegerOptional

With height, the picture’s size, taken as sent. Left out (or sent without height), the picture is measured.

heightintegerOptional
attributionstringOptional
sourceUrlstringOptional

Where the credit links to: an http or https address, or 422.

sortOrderintegerOptional

Its place in the picker, lowest first. Left out, a new template goes to the end of the picker; a promoted one keeps its place.

Response

This endpoint returns an object.
idstring
organizationIdstring
namestring
slugstring
layoutenum
Where the captions sit on a template.
Allowed values:
curatedboolean
Part of the library the workspace curates, rather than a background somebody found while composing one meme. Only curated templates appear in the picker.
archivedboolean

Out of the picker. Memes already made from it keep rendering, which is why a template is archived rather than deleted, but no new meme can be made from it. Only an app admin of Memegen, or a key, brings one back: archived: false on PATCH, or adding its picture again with POST /meme-templates, /meme-templates/from-url or /meme-templates/import, which restores it. Anybody else who adds the same picture again is refused (“An admin removed this template.”) and it stays archived.

sortOrderinteger
createdAtdatetime
updatedAtdatetime
builtinKeystringOptional
Set on the templates that ship with the app.
imageUrlstringOptional

The background, an http or https address. Absent on a built-in, which the app draws itself.

widthintegerOptional
The background's real pixel size, so the canvas can match the picture instead of cropping it into a fixed box.
heightintegerOptional
attributionstringOptional
Where a searched template came from. The background is served from there rather than copied, so the credit stays with the row.
sourceUrlstringOptional
Where the credit links to, an http or https address.

Errors

402
Subscription Required Error
403
Forbidden Error
409
Conflict Error
422
Validation Error
429
Too Many Requests Error