Skip to Content

Create a journey

Creates a draft journey from a definition: a trigger, a root node, and a graph of at most 200 nodes that is acyclic and fully reachable.

POST
/v1/journeys

Creates a draft journey from a definition: a trigger, a root node, and a graph of at most 200 nodes that is acyclic and fully reachable. Templates, senders, and groups the definition names must belong to the organization. Requires a plan that includes journeys.

Authorization

apiKey
headerx-api-key<token>

Request Body

application/json
  1. body
name*JourneyName
Match^\S[\s\S]*\S$|^\S$|^$
Length1 <= length <= 200
definition*

Response Body

Journey

application/json
  1. response
id*JourneyId
Match^jrny_[0-9a-hjkmnp-tv-z]{16,24}$
name*string
status*JourneyStatus
Value in"draft""active""paused""archived"
revision*string
draft*
publishedVersion*|null
publishedAt*string|null
createdAt*string
updatedAt*string
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.journeys.create({
  "name": "example",
  "definition": {
    "trigger": {
      "type": "event",
      "eventName": "example"
    },
    "rootNodeId": "example",
    "nodes": {}
  }
});
Example Response
{
  "id": "string",
  "name": "string",
  "status": "draft",
  "revision": "string",
  "draft": {
    "trigger": {
      "type": "event",
      "eventName": "string"
    },
    "rootNodeId": "string",
    "nodes": {
      "property1": {
        "type": "send_email",
        "config": {
          "template": "string",
          "senderId": "string",
          "templateData": {
            "property1": "string",
            "property2": "string"
          }
        },
        "next": [
          {
            "nodeId": "string"
          }
        ]
      },
      "property2": {
        "type": "send_email",
        "config": {
          "template": "string",
          "senderId": "string",
          "templateData": {
            "property1": "string",
            "property2": "string"
          }
        },
        "next": [
          {
            "nodeId": "string"
          }
        ]
      }
    },
    "goal": {
      "eventName": "string"
    },
    "reentry": true
  },
  "publishedVersion": -9007199254740991,
  "publishedAt": "string",
  "createdAt": "string",
  "updatedAt": "string"
}

Related documentation