Survey flows

GET /survey-flows

List the organization's survey flows, the automations that email customers for a review after an order. Supports search, filtering and cursor pagination.

Requires the surveys:read permission.

Query Parameters

limitnumber

The number of records to return.

cursorstring

A pagination cursor. Fetch the next page by passing the nextCursor value from the previous response.

sortname | -name | createdAt | -createdAt

The sort order. Prefix a field with - to sort descending. Defaults to name.

searchstring

A free-text search term, matched case-insensitively against the record's most identifying fields. Combined with filter using AND.

filterstring

A JSON-encoded filter document, for example {"createdAt":{"$gte":"2025-01-01T00:00:00Z"}}. Filterable fields: id, name, isActive, triggerEvent, createdAt. See Filtering for the syntax.

Request
curl \
  "https://api.cascade.dev/survey-flows" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "string",
      "isActive": true,
      "triggerEvent": "orderCreated",
      "condition": "string",
      "steps": ["..."],
      "metadata": "...",
      "createdAt": "2025-01-15T09:30:00Z",
      "updatedAt": "2025-01-15T09:30:00Z"
    }
  ],
  "nextCursor": "string"
}

POST /survey-flows

Create a survey flow. It starts running against new orders as soon as it is active. Triggers the surveyFlow.created webhook.

Requires the surveys:write permission.

Body Parameters

dataobjectrequired

The flow to create.

Request
curl \
  -X POST \
  "https://api.cascade.dev/survey-flows" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "name": "string",
    "isActive": true,
    "triggerEvent": "orderCreated",
    "condition": "string",
    "steps": [
      {
        "id": "...",
        "type": "...",
        "emailTemplateId": "...",
        "waitSeconds": "..."
      }
    ],
    "metadata": "..."
  }
}'
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "isActive": true,
  "triggerEvent": "orderCreated",
  "condition": "string",
  "steps": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": "sendEmail",
      "position": 0,
      "emailTemplateId": "string",
      "url": "string",
      "waitSeconds": 0
    }
  ],
  "metadata": "...",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}

GET /survey-flows/{id}

Get a single survey flow by ID, including its steps.

Requires the surveys:read permission.

Path Parameters

idstring (uuid)required

The ID of the survey flow.

Request
curl \
  "https://api.cascade.dev/survey-flows/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "isActive": true,
  "triggerEvent": "orderCreated",
  "condition": "string",
  "steps": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": "sendEmail",
      "position": 0,
      "emailTemplateId": "string",
      "url": "string",
      "waitSeconds": 0
    }
  ],
  "metadata": "...",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}

PUT /survey-flows/{id}

Update a survey flow. Sending steps replaces the whole list, and surveys already in flight keep running against the old steps. Triggers the surveyFlow.updated webhook.

Requires the surveys:write permission.

Path Parameters

idstring (uuid)required

The ID of the survey flow to update.

Body Parameters

dataobjectrequired

The fields to update.

Request
curl \
  -X PUT \
  "https://api.cascade.dev/survey-flows/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "name": "string",
    "isActive": true,
    "triggerEvent": "orderCreated",
    "condition": "string",
    "steps": [
      {
        "id": "...",
        "type": "...",
        "emailTemplateId": "...",
        "waitSeconds": "..."
      }
    ],
    "metadata": "..."
  }
}'
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "isActive": true,
  "triggerEvent": "orderCreated",
  "condition": "string",
  "steps": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": "sendEmail",
      "position": 0,
      "emailTemplateId": "string",
      "url": "string",
      "waitSeconds": 0
    }
  ],
  "metadata": "...",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}

DELETE /survey-flows/{id}

Delete a survey flow and its steps. To stop it temporarily, set isActive to false instead. Triggers the surveyFlow.deleted webhook.

Requires the surveys:write permission.

Path Parameters

idstring (uuid)required

The ID of the survey flow to delete.

Request
curl \
  -X DELETE \
  "https://api.cascade.dev/survey-flows/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "isActive": true,
  "triggerEvent": "orderCreated",
  "condition": "string",
  "steps": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": "sendEmail",
      "position": 0,
      "emailTemplateId": "string",
      "url": "string",
      "waitSeconds": 0
    }
  ],
  "metadata": "...",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}