Journeys

Operations related to Journeys

Create Journey

Creates Journey.

• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.

• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.

Securitytoken
Request
path Parameters
spaceId
required
string [ 1 .. 255 ]
Example: space_id
Request Body schema: application/vnd.segment.v1alpha+json
required
name
required
string (name)

The name of the journey.

description
required
string (description)

The description of the journey.

required
object (definition)

The journey definition.

Responses
201

Created

404

Resource not found

422

Validation failure

429

Too many requests

post/spaces/{spaceId}/journeys
Request samples
application/vnd.segment.v1alpha+json
{
  • "name": "Journey from API",
  • "description": "This is a journey created from the API",
  • "definition": {
    }
}
Response samples
application/vnd.segment.v1alpha+json
{
  • "data": {
    }
}

Get Journey

Returns the journey by containerId

• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.

• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.

Securitytoken
Request
path Parameters
spaceId
required
string [ 1 .. 255 ]
Example: space_id
containerId
required
string [ 1 .. 255 ]
Example: jcon_2tG95HZh4oPsgHfcOlznyfcDDAg
Responses
200

OK

404

Resource not found

422

Validation failure

429

Too many requests

get/spaces/{spaceId}/journeys/{containerId}
Request samples
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript'

const api = configureApis('/* Insert your Public API token here */')

try {
  const result = await unwrap(api.journeys.getJourney('space_id', 'jcon_2tG95HZh4oPsgHfcOlznyfcDDAg'))
  console.log(JSON.stringify(result))
} catch (e) {
  console.log('ERROR:', e)
}
Response samples
application/vnd.segment.v1alpha+json
{
  • "data": {
    }
}

Remove Journey from Space

Delete a journey

• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.

• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.

Securitytoken
Request
path Parameters
spaceId
required
string [ 1 .. 255 ]
Example: spaceId
containerId
required
string [ 1 .. 255 ]
Example: jcon_2tG95HZh4oPsgHfcOlznyfcDDAg
query Parameters
version
required
number (version)

The journey version.

This parameter exists in alpha.

Example: version=1
Responses
200

OK

404

Resource not found

422

Validation failure

429

Too many requests

delete/spaces/{spaceId}/journeys/{containerId}
Request samples
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript'

const api = configureApis('/* Insert your Public API token here */')

try {
  const result = await unwrap(api.journeys.removeJourneyFromSpace('spaceId', 'jcon_2tG95HZh4oPsgHfcOlznyfcDDAg', 1))
  console.log(JSON.stringify(result))
} catch (e) {
  console.log('ERROR:', e)
}
Response samples
application/vnd.segment.v1alpha+json
{
  • "data": {
    }
}

Get Journey Analytics

Get Analytics for a journey

• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.

• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.

Securitytoken
Request
path Parameters
spaceId
required
string [ 1 .. 255 ]
Example: spaceId
containerId
required
string [ 1 .. 255 ]
Example: jcon_2tG95HZh4oPsgHfcOlznyfcDDAg
query Parameters
version
required
number (version)

The journey version.

This parameter exists in alpha.

Example: version=1
fromDate
required
string (fromDate)

This parameter exists in alpha.

Example: fromDate=2006-01-02T15:04:05.000Z
toDate
string (toDate)

This parameter exists in alpha.

Example: toDate=2006-01-02T15:04:05.000Z
Responses
200

OK

404

Resource not found

422

Validation failure

429

Too many requests

get/spaces/{spaceId}/journeys/{containerId}/analytics
Request samples
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript'

const api = configureApis('/* Insert your Public API token here */')

try {
  const result = await unwrap(
    api.journeys.getJourneyAnalytics('spaceId', 'jcon_2tG95HZh4oPsgHfcOlznyfcDDAg', 1, '2006-01-02T15:04:05.000Z')
  )
  console.log(JSON.stringify(result))
} catch (e) {
  console.log('ERROR:', e)
}
Response samples
application/vnd.segment.v1alpha+json
{
  • "data": {
    }
}

Replace Steps for Journey

Replace steps for a journey

• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.

• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.

Securitytoken
Request
path Parameters
spaceId
required
string [ 1 .. 255 ]
Example: spaceId
containerId
required
string [ 1 .. 255 ]
Example: jcon_2tG95HZh4oPsgHfcOlznyfcDDAg
Request Body schema: application/vnd.segment.v1alpha+json
required
initialState
required
string (initialState)

The Initial state of the journey.

required
Array of EventEntryState (object) or AudienceEntryState (object) or ExitState (object) or DestinationState (object) or SimpleDelayState (object) or EventSplitWithTimeoutState (object) or ConditionSplitState (object) or RandomSplitState (object) (states)

States of the journey.

Responses
200

OK

404

Resource not found

422

Validation failure

429

Too many requests

put/spaces/{spaceId}/journeys/{containerId}/steps
Request samples
application/vnd.segment.v1alpha+json
{
  • "initialState": "entry_12345",
  • "states": [
    ]
}
Response samples
application/vnd.segment.v1alpha+json
{
  • "data": {
    }
}

Update Destinations for Journey

Update DESTINATIONS for a journey

• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.

• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.

Securitytoken
Request
path Parameters
spaceId
required
string [ 1 .. 255 ]
Example: spaceId
containerId
required
string [ 1 .. 255 ]
Example: jcon_2tG95HZh4oPsgHfcOlznyfcDDAg
Request Body schema: application/vnd.segment.v1alpha+json
required
required
Array of objects (stateDestinations)

The updated DESTINATIONS.

Responses
200

OK

404

Resource not found

422

Validation failure

429

Too many requests

patch/spaces/{spaceId}/journeys/{containerId}/destinations
Request samples
application/vnd.segment.v1alpha+json
{
  • "stateDestinations": [
    ]
}
Response samples
application/vnd.segment.v1alpha+json
{
  • "data": {
    }
}

Update Status for Journey

Update status of the journey

• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.

• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.

Securitytoken
Request
path Parameters
spaceId
required
string [ 1 .. 255 ]
Example: spaceId
containerId
required
string [ 1 .. 255 ]
Example: jcon_2tG95HZh4oPsgHfcOlznyfcDDAg
Request Body schema: application/vnd.segment.v1alpha+json
required
version
required
number (version)

The journey version.

action
required
string (action)

The action to perform for the journey.

Enum: "ARCHIVE" "PAUSE_ENTRY" "PUBLISH"
Responses
200

OK

404

Resource not found

422

Validation failure

429

Too many requests

patch/spaces/{spaceId}/journeys/{containerId}/status
Request samples
application/vnd.segment.v1alpha+json
{
  • "action": "PUBLISH",
  • "version": 1
}
Response samples
application/vnd.segment.v1alpha+json
{
  • "data": {
    }
}