Ranla Templates API
Email templates with `{{variable}}` interpolation
Email templates with `{{variable}}` interpolation
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/ranla-ai:ranla-ai-templates-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Ranla Templates API
version: 0.12.0
description: 'Transactional email API for developers.
Auth: `Authorization: Bearer rnl_…` or `stx_…` (or dashboard session cookie for integrations).
Production base URL: https://api.ranla.ai'
servers:
- url: https://api.ranla.ai
description: Production
tags:
- name: Templates
description: Email templates with `{{variable}}` interpolation
paths:
/templates:
get:
operationId: listTemplates
summary: List email templates
tags:
- Templates
security:
- bearerAuth: []
parameters:
- name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 100
default: 25
- name: cursor
in: query
schema:
type: string
- name: status
in: query
schema:
type: string
enum:
- draft
- published
description: Filter by draft or published
responses:
'200':
description: Template list
content:
application/json:
schema:
$ref: '#/components/schemas/ListTemplatesResponse'
'401':
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
operationId: createTemplate
summary: Create an email template (draft)
tags:
- Templates
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateTemplateRequest'
responses:
'201':
description: Template created
content:
application/json:
schema:
$ref: '#/components/schemas/TemplateResponse'
'400':
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Name or alias conflict
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/templates/starters:
get:
operationId: listTemplateStarters
summary: List starter template catalog
description: Returns the global starter catalog (password-reset, welcome, etc.). Copy into the account with POST /templates/from-starter.
tags:
- Templates
security:
- bearerAuth: []
responses:
'200':
description: Starter catalog
content:
application/json:
schema:
type: object
required:
- data
properties:
data:
type: array
items:
$ref: '#/components/schemas/TemplateStarter'
'401':
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/templates/from-starter:
post:
operationId: createTemplateFromStarter
summary: Create a published template from a starter
description: Copies a catalog starter into the account as a published template using the starter alias (e.g. password-reset). When the account's Brand colors are known (measured from its website or set on Brand), the template uses them for its page, text, links and buttons. Returns 409 if name or alias already exists.
tags:
- Templates
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- alias
properties:
alias:
type: string
description: Starter alias from GET /templates/starters
example: password-reset
responses:
'201':
description: Published template created
content:
application/json:
schema:
$ref: '#/components/schemas/TemplateResponse'
'400':
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Unknown starter alias
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Name or alias already in use
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/templates/{id}:
get:
operationId: getTemplate
summary: Retrieve a template by id or alias
tags:
- Templates
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
description: Template UUID or alias
schema:
type: string
responses:
'200':
description: Template
content:
application/json:
schema:
$ref: '#/components/schemas/TemplateResponse'
'401':
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Template not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
patch:
operationId: updateTemplate
summary: Update a template by id or alias
tags:
- Templates
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateTemplateRequest'
responses:
'200':
description: Template updated
content:
application/json:
schema:
$ref: '#/components/schemas/TemplateResponse'
'400':
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Template not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Name or alias conflict
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
delete:
operationId: deleteTemplate
summary: Delete a template by id or alias
tags:
- Templates
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: Template deleted
content:
application/json:
schema:
type: object
required:
- ok
properties:
ok:
type: boolean
'401':
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Template not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
operationId: templateAction
summary: Publish or duplicate a template
tags:
- Templates
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TemplateActionRequest'
responses:
'200':
description: Publish succeeded
content:
application/json:
schema:
$ref: '#/components/schemas/TemplateResponse'
'201':
description: Duplicate created
content:
application/json:
schema:
$ref: '#/components/schemas/TemplateResponse'
'400':
description: Invalid action
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Template not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/templates/{id}/versions:
get:
operationId: listTemplateVersions
summary: List immutable published versions of a template
tags:
- Templates
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: Version list
content:
application/json:
schema:
type: object
required:
- data
- published_version_id
properties:
data:
type: array
items:
$ref: '#/components/schemas/TemplateVersion'
published_version_id:
type: string
format: uuid
nullable: true
'401':
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Template not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/templates/{id}/versions/{version}:
post:
operationId: restoreTemplateVersion
summary: Restore a historical version into the draft
tags:
- Templates
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
- name: version
in: path
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- action
properties:
action:
type: string
enum:
- restore
responses:
'200':
description: Draft restored from version
content:
application/json:
schema:
$ref: '#/components/schemas/TemplateResponse'
'400':
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Template or version not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/templates/{id}/test-send:
post:
operationId: testSendTemplate
summary: Send a one-off test using the current draft
tags:
- Templates
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- to
- from
properties:
to:
type: string
from:
type: string
variables:
type: object
additionalProperties: true
responses:
'200':
description: Test email accepted
'400':
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Template not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/assets:
get:
operationId: listAssets
summary: List uploaded template assets
tags:
- Templates
security:
- bearerAuth: []
parameters:
- name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 100
default: 25
- name: cursor
in: query
schema:
type: string
responses:
'200':
description: Asset list
content:
application/json:
schema:
type: object
required:
- data
- has_more
- next_cursor
- upload_enabled
properties:
data:
type: array
items:
$ref: '#/components/schemas/Asset'
has_more:
type: boolean
next_cursor:
type: string
nullable: true
upload_enabled:
type: boolean
post:
operationId: createAssetUpload
summary: Create a presigned upload URL for a template image
tags:
- Templates
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- content_type
- bytes
properties:
content_type:
type: string
enum:
- image/png
- image/jpeg
- image/gif
- image/webp
bytes:
type: integer
width:
type: integer
height:
type: integer
responses:
'201':
description: Presigned upload created
content:
application/json:
schema:
type: object
required:
- asset
- upload_url
- upload_headers
properties:
asset:
$ref: '#/components/schemas/Asset'
upload_url:
type: string
format: uri
upload_headers:
type: object
additionalProperties:
type: string
'400':
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'503':
description: Uploads not configured
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
CreateTemplateRequest:
type: object
required:
- name
properties:
name:
type: string
subject:
type: string
description: Optional default subject line. Omit for layout-only templates used with per-send subjects.
format:
type: string
enum:
- html
- blocks
preheader:
type: string
html:
type: string
text:
type: string
design:
type: object
additionalProperties: true
description: Required when format is blocks (defaults to empty document, in the account's Brand colors when those are known). Supports `settings.globalCss` for author-supplied CSS compiled at render time.
alias:
type: string
variables:
type: array
items:
type: string
unsubscribe_enabled:
type: boolean
category:
type: string
enum:
- transactional
- product
- newsletter
default: transactional
ErrorResponse:
type: object
required:
- error
properties:
error:
type: object
required:
- message
properties:
message:
type: string
code:
$ref: '#/components/schemas/ErrorCode'
upgrade_url:
type: string
description: Dashboard path to upgrade when code is plan_limit or domain_limit
details:
description: 'Optional structured details. For send blocks this may include `suppressed` (global suppression list) or `category_unsubscribed` plus `category` and `email_id` (category opt-out).
'
UpdateTemplateRequest:
type: object
properties:
name:
type: string
subject:
type: string
format:
type: string
enum:
- html
- blocks
preheader:
type: string
nullable: true
html:
type: string
nullable: true
text:
type: string
nullable: true
design:
type: object
nullable: true
additionalProperties: true
alias:
type: string
nullable: true
variables:
type: array
nullable: true
items:
type: string
unsubscribe_enabled:
type: boolean
category:
type: string
enum:
- transactional
- product
- newsletter
TemplateVersion:
type: object
required:
- id
- template_id
- version
- format
- subject
- html
- text
- variables
- created_at
properties:
id:
type: string
format: uuid
template_id:
type: string
format: uuid
version:
type: integer
format:
type: string
enum:
- html
- blocks
description: Immutable format snapshot from publish time
subject:
type: string
preheader:
type: string
nullable: true
design:
type: object
nullable: true
additionalProperties: true
html:
type: string
nullable: true
text:
type: string
nullable: true
variables:
type: array
nullable: true
items:
type: string
created_by_user_id:
type: string
format: uuid
nullable: true
label:
type: string
nullable: true
created_at:
type: string
format: date-time
ListTemplatesResponse:
type: object
required:
- data
- has_more
- next_cursor
properties:
data:
type: array
items:
$ref: '#/components/schemas/Template'
has_more:
type: boolean
next_cursor:
type: string
nullable: true
TemplateActionRequest:
type: object
required:
- action
properties:
action:
type: string
enum:
- publish
- duplicate
name:
type: string
description: Optional name when action is `duplicate`
TemplateStarter:
type: object
required:
- alias
- name
- description
- subject
- html
- text
- variables
- unsubscribe_enabled
properties:
alias:
type: string
example: password-reset
name:
type: string
description:
type: string
subject:
type: string
preheader:
type: string
nullable: true
html:
type: string
text:
type: string
design:
type: object
nullable: true
additionalProperties: true
variables:
type: array
items:
type: string
unsubscribe_enabled:
type: boolean
Asset:
type: object
required:
- id
- key
- url
- content_type
- bytes
- created_at
properties:
id:
type: string
format: uuid
key:
type: string
url:
type: string
format: uri
content_type:
type: string
bytes:
type: integer
width:
type: integer
nullable: true
height:
type: integer
nullable: true
created_at:
type: string
format: date-time
TemplateLintWarning:
type: object
required:
- code
- message
properties:
code:
type: string
enum:
- svg_image
- relative_image_url
- data_uri_image
- missing_alt
- non_https_image
- empty_href
- raw_html_block
- low_contrast
- html_too_large
message:
type: string
detail:
type: string
nullable: true
Template:
type: object
required:
- id
- name
- alias
- status
- format
- subject
- html
- text
- variables
- published_at
- created_at
- updated_at
- unsubscribe_enabled
- category
properties:
id:
type: string
format: uuid
name:
type: string
alias:
type: string
nullable: true
description: Optional unique alias per account (must not start with `rnl_` or `stx_`)
status:
type: string
enum:
- draft
- published
format:
type: string
enum:
- html
- blocks
description: html is legacy raw HTML; blocks is the visual builder document
subject:
type: string
preheader:
type: string
nullable: true
description: Inbox preview text injected as a hidden preheader
html:
type: string
nullable: true
text:
type: string
nullable: true
design:
description: TemplateDocument JSON when format is blocks. `settings.globalCss` accepts author-supplied CSS; bare-tag rules (body, p, h1, h2, h3, a, img, hr) are inlined on render and everything else is emitted into a style block.
nullable: true
type: object
additionalProperties: true
variables:
type: array
nullable: true
items:
type: string
description: Variable names used in subject/html/text (auto-extracted for blocks)
published_version_id:
type: string
format: uuid
nullable: true
description: Immutable version snapshot used for sends
published_at:
type: string
format: date-time
nullable: true
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
unsubscribe_enabled:
type: boolean
description: 'When true, sends using this published template inherit managed unsubscribe unless
overridden with `unsubscribe` on `POST /emails`.
'
category:
type: string
enum:
- transactional
- product
- newsletter
description: 'Email category for preference management. `transactional` is default and ignores
category opt-outs. `product` and `newsletter` support category-scoped unsubscribe.
'
warnings:
type: array
description: Non-blocking deliverability hints for template HTML (e.g. SVG image URLs)
items:
$ref: '#/components/schemas/TemplateLintWarning'
ErrorCode:
type: string
description: Machine-readable error code
enum:
- validation_error
- unauthorized
- forbidden
- not_found
- conflict
- plan_limit
- domain_limit
- idempotency_conflict
- rate_limited
- upstream_error
- not_configured
- internal_error
TemplateResponse:
type: object
required:
- template
properties:
template:
$ref: '#/components/schemas/Template'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: Ranla API key prefixed with `rnl_` or `stx_`