> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.taktoria.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.taktoria.com/_mcp/server.

# Preview Meme

POST https://api.taktoria.com/api/v1/memes/preview
Content-Type: application/json

What `POST /memes` would make, drawn as a PNG and not saved: the
same body, the same checks (`422` for an archived template or no
words, `404` for a template not in the workspace) and the same
fitting, so it can be shown to somebody before everybody sees it.
Nothing is written, so it needs only `memes:read`. It counts against
the `meme-render` budget as `GET /memes/{memeId}/image` does, and as
a write against the caller's own limits, being a `POST`.

Reference: https://docs.taktoria.com/api-reference/memegen/preview-meme

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.taktoria.com/api/v1` (Production, default)
- `http://localhost:3000/api/v1` (Local)

## Request

### Query parameters

- `size` (integer, optional) — The longest edge, in pixels, from 64. Left out, 1024; above 1024, 1024.

### Body (application/json)

This endpoint expects a CreateMemeRequest.

- `templateId` (string, required) — A template in the workspace that is still in the picker. One an app admin archived is refused with `422`; memes already made from it are kept and keep rendering. A one-off background (`curated: false`) may be used.
- `captions` (list of string, required) — One per caption box, in the layout's order. Each is folded onto one line and cut at 140 characters; extra captions are dropped and missing ones left empty. At least one must have words, or `422`. Up to 8, each at most 500 characters as sent.
- `layout` (enum, optional) — A different layout for this meme only. Stored only when it differs from the template's own.
  - Allowed values: `CAPTION`, `TOP_BOTTOM`, `THREE_PANEL`, `SPLIT`

## Response

### 200

- File download.

## Errors

### 402 Subscription Required Error

The organization has no subscription for the app that lets it in: active, trialing or past due. One that is unpaid (Stripe stopped retrying a failed payment), paused, incomplete or cancelled answers this too, and the message says which: an unpaid app is locked until a workspace admin updates the payment details. `details.status` is the app's subscription status (null with none), and `details.paymentIssue` is `unpaid`, or `payment_failed` for an incomplete one whose first payment failed, as `paymentIssue` on `GET /subscription` reckons it; null when a payment is not why.

- `error` (ErrorDetail, required)

### 404 Not Found Error

- `error` (ErrorDetail, required)

### 422 Validation Error

- `error` (ErrorDetail, required)

### 502 Upstream Error

A service Taktoria depends on (Stripe, Vercel for app domains, or a ticketing system such as Linear, Jira, GitHub, Asana or ClickUp, or a docs tool a person exports to, Notion, Confluence or Google Docs) turned the change down or could not be reached. Nothing was saved; try again.

- `error` (ErrorDetail, required)

### 429 Too Many Requests Error

Rate limited (`rate_limited`): the key, the signed-in person, the workspace or an expensive endpoint's own budget is used up for now. `Retry-After` says how many seconds to wait, and `details` names the `policy`, its `limit`, `windowSeconds` and `retryAfter`. Every answer to an authenticated request carries the IETF `RateLimit-Policy` and `RateLimit` headers, so a client can slow down before it gets this. Nothing was done; wait and send it again. See "Rate limits".

- `error` (ErrorDetail, required)

## Types

### ErrorDetail

- `code` (string, required) — A stable machine-readable code such as `not_found`.
- `message` (string, required)
- `details` (any, optional)

## Examples

**Request**

```json
{
  "templateId": "string",
  "captions": [
    "string"
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.taktoria.com/api/v1/memes/preview"

querystring = {"size":"0"}

payload = {
    "templateId": "string",
    "captions": ["string"]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.taktoria.com/api/v1/memes/preview?size=0';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"templateId":"string","captions":["string"]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.taktoria.com/api/v1/memes/preview?size=0"

	payload := strings.NewReader("{\n  \"templateId\": \"string\",\n  \"captions\": [\n    \"string\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.taktoria.com/api/v1/memes/preview?size=0")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"templateId\": \"string\",\n  \"captions\": [\n    \"string\"\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.taktoria.com/api/v1/memes/preview?size=0")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"templateId\": \"string\",\n  \"captions\": [\n    \"string\"\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.taktoria.com/api/v1/memes/preview?size=0', [
  'body' => '{
  "templateId": "string",
  "captions": [
    "string"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.taktoria.com/api/v1/memes/preview?size=0");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"templateId\": \"string\",\n  \"captions\": [\n    \"string\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "templateId": "string",
  "captions": ["string"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.taktoria.com/api/v1/memes/preview?size=0")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```