---
title: "Search templates"
method: POST
path: "/api/businesses/{business_id}/templates/search"
tags: ["library"]
---

# Search templates

`POST /api/businesses/{business_id}/templates/search`

## Request

- Base URL: `https://api.mymarky.ai`
- URL: `https://api.mymarky.ai/api/businesses/{business_id}/templates/search`
- Auth: HTTP bearer

Pick a template for this business, with the fields/slots you must fill.

Mirrors Max's `search_template`: returns one template (weighted toward
least-recently-used) plus every text field and image slot to fill it. When
`has_image_slot=true` but no template has a fillable image slot, returns 200
with `error="no_image_slot_templates"` (fall back to an image-only post).

Errors:
    400 invalid_value: The business_id is not a valid UUID.
    401 authentication_required: API key or token is missing, invalid, or revoked.
    403 permission_denied: Your plan does not include API access, or this business is not in your org.
    404 resource_not_found: No business with that ID exists.
    429 rate_limit_exceeded: You sent too many requests this minute.

## Path parameters

- `business_id` string, required: A UUID identifier.

## Headers

- `Marky-Version` '2026-04-08' | '2026-07-17' | '2026-08-02' | '2026-08-04' | '2026-08-06'

## Request body

- TemplateSearchRequest: Filters for picking a template from the business's library.
  - `is_meme` boolean, nullable: True = only meme templates, False = only non-meme, None = any.
  - `has_image_slot` boolean, nullable: True = only templates with a fillable photo slot. Use when you have an image to place.

## Response `200`

Successful Response

- TemplateSearchResponse: Either a chosen template (with its fields/slots), or a no-image-slot signal.
  - `template` TemplateDetail: A template plus every field/slot you must fill to create a design from it.
    - `template_id` string, required: Template id — pass to create_design.
    - `description` string, nullable: What the template is for.
    - `page_count` integer, required: Number of pages.
    - `template_url` string, required: Open the template in the editor to view or tweak it — a link you can hand the user.
    - `pages` TemplatePageDetail[]: Per-page fields and slots.
      - `page_number` integer, required: 1-based page index.
      - `image_slots` TemplateImageSlot[]: Image slots on this page.
        - `id` string, required: Slot id — use as the key in create_design.filler_media.
        - `kind` string, nullable: Slot role: FILLER (you must provide a photo), LOGO/AVATAR/WATERMARK (brand, optional).
        - `required` boolean, required: True for FILLER slots — you must supply an image.
        - `width` integer, required: Slot width in px.
        - `height` integer, required: Slot height in px.
      - `text_fields` TemplateTextField[]: Text fields on this page.
        - `id` string, required: Field id — use as the key in create_design.text_content.
        - `kind` string, nullable: Field role (e.g. HEADER, BODY).
        - `instructions` string, nullable: Guidance for what to write here — always populated (a sensible default when the template didn't set one).
        - `max_characters` integer, nullable: Character limit for this field, if any. create_design rejects copy longer than this with a 422.
        - `example` string, nullable: A short example of good copy for this field, to show the shape/length expected.
  - `error` string, nullable: 'no_image_slot_templates' when has_image_slot was requested but none exist.
  - `message` string, nullable: Human guidance when `error` is set (e.g. use an image-only post).

## Other responses

- `400`: Bad request — the input was malformed or otherwise invalid.
- `401`: Authentication failed — the API key is missing or invalid.
- `403`: Forbidden — the key is valid but may not access this resource.
- `404`: Not found — no resource matches the id in the path.
- `422`: Validation error — one or more fields failed validation.
- `429`: Rate limited — retry after the window resets (see Retry-After).
- `500`: Server error — something failed on our side; retry or quote X-Request-Id.

---

[API](https://skmtc.dev/mymarky/apis/marky-public-api.md) · [All operations](https://skmtc.dev/mymarky/apis/marky-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mymarky/apis/marky-public-api/revisions/25aeacae455c?raw)
