Ranla Automations API
Create and manage event-driven transactional automations
Create and manage event-driven transactional automations
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-automations-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 Automations 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: Automations
description: Create and manage event-driven transactional automations
paths:
/automations:
get:
operationId: listAutomations
summary: List automations
description: Returns the 100 most recently created automations, newest first. This list is not paginated.
tags:
- Automations
security:
- bearerAuth: []
responses:
'200':
description: Automation list
content:
application/json:
schema:
$ref: '#/components/schemas/ListAutomationsResponse'
'401':
description: Missing or invalid API key / session
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
operationId: createAutomation
summary: Create a draft automation
description: 'Creates the automation as a `draft`; activate it before events will match. The response
includes `warnings` when the definition saves but should not ship as-is — for example a
`product` or `newsletter` send_email step whose html or text has no `{{unsubscribe_url}}`
link. Inline send_email steps default to category `product`.'
tags:
- Automations
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateAutomationRequest'
examples:
welcome:
value:
name: Welcome email
trigger:
type: event
event: user.created
steps:
- type: send_email
email:
from: you@yourdomain.com
to: '{{event.email}}'
subject: Welcome
html: <p>Hi {{event.data.name}}</p><p><a href="{{unsubscribe_url}}">Unsubscribe</a></p>
responses:
'201':
description: Automation created as draft, with `warnings` when there are any
content:
application/json:
schema:
$ref: '#/components/schemas/AutomationResponse'
'400':
description: Invalid automation definition
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid API key / session
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Automation name already in use
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/automations/{id}:
get:
operationId: getAutomation
summary: Get an automation
description: 'Returns the automation with `conversions` credited to it (total, revenue, and attribution
mix) and any `warnings` about its definition. Pass `preview=1` to also get
`email_previews`: each send_email step rendered with sample event data.'
tags:
- Automations
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
- name: preview
in: query
required: false
schema:
type: string
enum:
- '1'
description: Set to `1` to include `email_previews`. Omitted from the response if the previews cannot be rendered.
responses:
'200':
description: Automation with conversion stats, warnings, and (with `preview=1`) email previews
content:
application/json:
schema:
$ref: '#/components/schemas/AutomationDetailResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
patch:
operationId: updateAutomation
summary: Update an automation definition
tags:
- Automations
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateAutomationRequest'
responses:
'200':
description: Updated automation, with `warnings` when there are any
content:
application/json:
schema:
$ref: '#/components/schemas/AutomationResponse'
'400':
description: Invalid update
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Name conflict
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
delete:
operationId: deleteAutomation
summary: Delete an automation
tags:
- Automations
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: Deleted
content:
application/json:
schema:
type: object
required:
- ok
properties:
ok:
type: boolean
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
operationId: automationAction
summary: Activate or pause an automation
description: 'Activating requires a workspace that has hired Ranla (a paid Ranla plan); otherwise it
returns 402. Pausing works on any plan, so a flow can always be stopped. Drafts can be
created, edited, and deleted on any plan.'
tags:
- Automations
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AutomationActionRequest'
responses:
'200':
description: Updated automation status
content:
application/json:
schema:
$ref: '#/components/schemas/AutomationResponse'
'400':
description: Invalid action
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'402':
description: '`activate` on a workspace that has not hired Ranla. Checked before the automation is looked up. `pause` is never refused for this — stopping mail is always allowed.
'
content:
application/json:
schema:
$ref: '#/components/schemas/SimpleErrorResponse'
example:
error: Hire Ranla to send and run on her own.
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/automations/runs:
get:
operationId: listAutomationRuns
summary: List automation runs
description: 'Returns the 100 most recently created runs (of one automation when `automation_id` is
set), newest first. This list is not paginated.'
tags:
- Automations
security:
- bearerAuth: []
parameters:
- name: automation_id
in: query
required: false
schema:
type: string
description: Filter runs to a single automation
responses:
'200':
description: Run list
content:
application/json:
schema:
$ref: '#/components/schemas/ListAutomationRunsResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/automations/runs/{id}:
get:
operationId: getAutomationRun
summary: Get an automation run
tags:
- Automations
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: Run detail
content:
application/json:
schema:
$ref: '#/components/schemas/AutomationRunResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
operationId: automationRunAction
summary: Cancel or retry an automation run
description: 'Both actions return `{ run }`. `cancel` stops a queued, running, or waiting run and
returns it with status `cancelled`. `retry` starts a new run of the same automation from
the original trigger event and returns that new run; only failed or cancelled runs can be
retried, and a retry is not blocked by `trigger.once_per_contact` or `trigger.cooldown_days`.'
tags:
- Automations
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AutomationRunActionRequest'
responses:
'200':
description: The cancelled run, or the new run started by `retry`
content:
application/json:
schema:
$ref: '#/components/schemas/AutomationRunResponse'
'400':
description: 'Invalid action, the run''s status does not allow it (only queued, running, or waiting runs can be cancelled; only failed or cancelled runs can be retried), or the run cannot be retried because its trigger event no longer exists
'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
SimpleErrorResponse:
type: object
required:
- error
properties:
error:
type: string
AutomationStepEmail:
type: object
required:
- from
- to
additionalProperties: true
description: 'The `email` object of a `send_email` step, sent through the same path as `POST /emails`
(other `POST /emails` fields such as `reply_to`, `cc`, and `tags` pass through). Provide
inline `subject` plus `html` and/or `text`, or a published `template` — not both. String
values accept placeholders such as `{{event.email}}`, `{{contact.first_name}}`, and
`{{unsubscribe_url}}`.
'
properties:
from:
type: string
to:
oneOf:
- type: string
- type: array
items:
type: string
subject:
type: string
html:
type: string
text:
type: string
template:
$ref: '#/components/schemas/SendTemplateRef'
category:
type: string
enum:
- transactional
- product
- newsletter
default: product
description: 'Inline steps default to `product`. `product` and `newsletter` sends honor that
category''s opt-outs, carry `List-Unsubscribe` headers, and replace `{{unsubscribe_url}}`
in `html` and `text` with the managed unsubscribe link. The placeholder is replaced,
never appended, so include it — create, update, and retrieve responses return a
warning when a step has none. A recipient who opted out of the category is not mailed
and the run ends as `completed`. Use `transactional` only for genuinely transactional
mail such as receipts and one-time codes. Template-backed steps use the template''s
category unless this is set.
'
ListAutomationRunsResponse:
type: object
required:
- runs
properties:
runs:
type: array
items:
$ref: '#/components/schemas/AutomationRun'
CreateAutomationRequest:
type: object
required:
- name
- trigger
- steps
properties:
name:
type: string
trigger:
$ref: '#/components/schemas/AutomationTrigger'
steps:
type: array
items:
$ref: '#/components/schemas/AutomationStep'
minItems: 1
maxItems: 20
AutomationRunResponse:
type: object
required:
- run
properties:
run:
$ref: '#/components/schemas/AutomationRun'
AutomationRun:
type: object
required:
- id
- automation_id
- trigger_event_id
- status
- current_step
- waiting_for_event
- wait_timeout_at
- context
- last_error
- cancel_requested_at
- started_at
- completed_at
- created_at
- updated_at
properties:
id:
type: string
automation_id:
type: string
trigger_event_id:
type: string
nullable: true
status:
type: string
enum:
- queued
- running
- waiting
- completed
- failed
- cancelled
current_step:
type: integer
waiting_for_event:
type: string
nullable: true
wait_timeout_at:
type: string
format: date-time
nullable: true
context:
type: object
additionalProperties: true
last_error:
type: string
nullable: true
cancel_requested_at:
type: string
format: date-time
nullable: true
started_at:
type: string
format: date-time
nullable: true
completed_at:
type: string
format: date-time
nullable: true
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
automation:
$ref: '#/components/schemas/Automation'
trigger_event:
$ref: '#/components/schemas/EventRecord'
steps:
type: array
items:
$ref: '#/components/schemas/AutomationRunStep'
description: Present on run detail responses
ListAutomationsResponse:
type: object
required:
- automations
properties:
automations:
type: array
items:
$ref: '#/components/schemas/Automation'
SendTemplateRef:
type: object
required:
- id
description: Reference a published template by UUID or alias. Mutually exclusive with html/text.
properties:
id:
type: string
description: Template UUID or alias
variables:
type: object
additionalProperties:
oneOf:
- type: string
- type: number
- type: boolean
description: Values for `{{variable}}` placeholders (HTML-escaped in html body)
AutomationRunActionRequest:
type: object
required:
- action
properties:
action:
type: string
enum:
- cancel
- retry
AutomationEmailPreview:
type: object
required:
- step_index
- subject
- html
properties:
step_index:
type: integer
description: Zero-based index of the send_email step
subject:
type: string
description: Rendered subject line (empty when the step could not be rendered)
html:
type: string
nullable: true
description: The step rendered as an HTML document with sample event data, or null when it could not be rendered
error:
type: string
description: Why the step could not be rendered, for example `Template not found`
AutomationActionRequest:
type: object
required:
- action
properties:
action:
type: string
enum:
- activate
- pause
EventRecord:
type: object
required:
- id
- name
- user_id
- email
- data
- source
- created_at
properties:
id:
type: string
name:
type: string
user_id:
type: string
nullable: true
email:
type: string
nullable: true
format: email
data:
type: object
additionalProperties: true
source:
type: string
enum:
- api
- dashboard
- on_site
- posthog
- mixpanel
- amplitude
description: 'Where the event came from: `api` (`POST /events` with an API key), `dashboard`,
`on_site` (an on-site message on your website captured an email address), or
`posthog`, `mixpanel`, `amplitude` (synced from a connected product-analytics account).
'
created_at:
type: string
format: date-time
AutomationDetailResponse:
type: object
required:
- automation
- conversions
properties:
automation:
$ref: '#/components/schemas/Automation'
warnings:
$ref: '#/components/schemas/AutomationWarnings'
conversions:
$ref: '#/components/schemas/AutomationConversionStats'
email_previews:
type: array
description: Present only when requested with `preview=1`. One entry per send_email step that has an html body or a template.
items:
$ref: '#/components/schemas/AutomationEmailPreview'
Automation:
type: object
required:
- id
- name
- status
- trigger
- steps
- created_at
- updated_at
properties:
id:
type: string
name:
type: string
status:
type: string
enum:
- draft
- active
- paused
trigger:
$ref: '#/components/schemas/AutomationTrigger'
steps:
type: array
items:
$ref: '#/components/schemas/AutomationStep'
minItems: 1
maxItems: 20
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
AutomationRunStep:
type: object
required:
- id
- step_index
- step_type
- status
- output
- error
- started_at
- completed_at
- created_at
- updated_at
properties:
id:
type: string
step_index:
type: integer
step_type:
type: string
enum:
- delay
- send_email
- send_sms
- condition
- wait_for_event
status:
type: string
enum:
- started
- waiting
- completed
- failed
output:
nullable: true
error:
type: string
nullable: true
started_at:
type: string
format: date-time
completed_at:
type: string
format: date-time
nullable: true
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
AutomationResponse:
type: object
required:
- automation
properties:
automation:
$ref: '#/components/schemas/Automation'
warnings:
$ref: '#/components/schemas/AutomationWarnings'
AutomationWarnings:
type: array
description: 'Advice about a definition that saved but should not ship as-is — for example a `product`
or `newsletter` send_email step whose `html` or `text` has no `{{unsubscribe_url}}` link.
Returned by create, update, and retrieve; omitted when there are none (and never returned
by activate or pause).
'
items:
type: string
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
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).
'
AutomationConversionStats:
type: object
required:
- total
- revenue_cents
- mix
description: 'Conversions credited to this automation — ones whose winning touch inside the goal''s
attribution window was an email this automation sent. List them with
`GET /conversions?automation_id=`.
'
properties:
total:
type: integer
description: Number of conversions credited to this automation
revenue_cents:
type: integer
description: Sum of `value_cents` across those conversions (count-only goals add 0)
mix:
type: object
description: Conversion counts by `attribution_kind`, so weak attribution can be discounted
properties:
click:
type: integer
open:
type: integer
send:
type: integer
none:
type: integer
UpdateAutomationRequest:
type: object
properties:
name:
type: string
trigger:
$ref: '#/components/schemas/AutomationTrigger'
steps:
type: array
items:
$ref: '#/components/schemas/AutomationStep'
minItems: 1
maxItems: 20
AutomationStep:
type: object
required:
- type
properties:
type:
type: string
enum:
- delay
- send_email
- send_sms
- condition
- wait_for_event
email:
$ref: '#/components/schemas/AutomationStepEmail'
additionalProperties: true
description: 'Step object. Shape depends on `type`:
- `delay`: `{ type, seconds }`
- `send_email`: `{ type, email: { from, to, subject?, html?, text?, template?, category? } }` (see `AutomationStepEmail`; inline steps default to category `product`)
- `send_sms`: `{ type, sms: { to, body, from?, messaging_service_sid? } }` (requires Twilio integration)
- `condition`: `{ type, path, operator, value? }` (false stops the run)
- `wait_for_event`: `{ type, event, timeout_seconds?, on_timeout? }` (`on_timeout` is `continue` or `fail`, default `fail`)
'
AutomationTrigger:
type: object
required:
- type
- event
properties:
type:
type: string
enum:
- event
event:
type: string
example: user.created
cancel_on_events:
type: array
items:
type: string
maxItems: 20
description: When any listed event fires for the same recipient, cancel queued/running/waiting runs for this automation.
once_per_contact:
type: boolean
description: '`true` to enroll each person at most once, ever (matched on the event''s `email` or
`user_id`). A later matching event is skipped and reported in the `POST /events`
response under `enrollment_skips` with `reason: once_per_contact`. Returned only when
enabled. Retrying a run is not blocked by it.
'
cooldown_days:
type: integer
minimum: 1
maximum: 3650
description: 'Skip enrollment when the same person already had a run on this automation within the
last N days (`reason: cooldown` in `enrollment_skips`). Returned only when set.
Retrying a run is not blocked by it.
'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: Ranla API key prefixed with `rnl_` or `stx_`