Skip to content
campaiDeveloper
campai.com

Templates

POST/{organizationId}/templates/search

List templates

Searches an organization's templates by folder, type, status and other filters, with sorting and pagination. Returns matching templates, a count and thumbnail links for published designs; designs themselves are omitted. Thumbnail links are valid for one day.

Permissions

Send an API key of the organization in the path, using the X-API-Key header.

Who may call it

  • Organization access with the template.read permission is required.
  • Without receipt.read, receipt templates are excluded.
  • Without donationsSettings.read, donation confirmation templates are excluded.

Request

Path parameters

  • organizationIdidrequired

Body

Content-Type: application/json

  • searchstringnullable

    at most 240 characters

  • typesobject[]
    2 properties
    • typestringrequired
      transactional contact booking receipt donationConfirmation
    • subtypestringnullable

      at most 64 characters

  • contactTypestringnullable
    member address customer sponsor contributor employee supplier
  • includeAllContactsboolean

    default false

  • hasEmailDesignboolean
  • hasLetterDesignboolean
  • receiptTypesstring[]
    invoice deposit donation offer confirmation reminder returnedPayment
  • folderIdidnullable
  • statusstring

    default "active"

    active published draft archived
  • standardFirstboolean

    default false

  • defaultsstring
    only exclude
  • sortstring

    default "name"

    name createdAt updatedAt
  • sortBystring

    default "asc"

    asc desc
  • offsetinteger

    at least 0 · default 0

  • limitinteger

    1–60 · default 30

Request
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
  --request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/templates/search' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "types": [
    {
      "type": "receipt"
    }
  ],
  "receiptTypes": [
    "invoice"
  ],
  "status": "published",
  "limit": 1
}'

A request the admin app sent for “Create a receipt”.

Response

200 Successful response

Content-Type: application/json

  • templatesobject[]
  • countnumber
  • thumbnailsobject of object

More about the fields

  • templates[].email: For a contact template, templates[].email is null if the email channel is absent.
  • templates[].letter: For a contact template, templates[].letter is null if the letter channel is absent.
Response200
{
  "templates": [
    {
      "_id": "000000000000000000000001",
      "folder": "000000000000000000000001",
      "publishedAt": "2026-06-15T22:30:00Z",
      "archivedAt": "2026-06-15T22:30:00Z",
      "name": "string",
      "description": "string",
      "type": "transactional",
      "standard": true,
      "transactionalType": "content"
    }
  ],
  "count": 1,
  "thumbnails": {
    "key": {
      "email": {
        "width": 1,
        "height": 1,
        "pages": 1,
        "background": "string",
        "url": "string"
      },
      "letter": {
        "width": 1,
        "height": 1,
        "pages": 1,
        "background": "string",
        "url": "string"
      },
      "current": true
    }
  }
}

What else happens

  • May queue misc.renderTemplateThumbnails jobs on DefaultQueue for template thumbnails.

Errors

No errors of its own are known for this endpoint.

Errors nearly every request can meet are listed under Errors.