> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequenzy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel Sequence Enrollments

> Cancel active or waiting subscriber enrollments in one sequence

# Cancel Sequence Enrollments

Cancel active or waiting enrollments in a single sequence. Target either one subscriber by `subscriberId`, or all enrollments whose stored entry event properties match `fieldValues`.

## Request

<ParamField path="sequenceId" type="string" required>
  Sequence ID.
</ParamField>

<ParamField body="subscriberId" type="string">
  Subscriber ID to cancel in this sequence. Provide `subscriberId` or
  `fieldValues`, not both.
</ParamField>

<ParamField body="fieldPath" type="string">
  Dot-path inside the token's entry event properties, such as `order.id` or
  `event.id`. If omitted, the sequence's `enrollmentFieldPath` is used.
</ParamField>

<ParamField body="fieldValues" type="array">
  Entry field values to match. Provide `fieldValues` or `subscriberId`, not
  both.
</ParamField>

<ParamField body="dryRun" type="boolean">
  When `true`, returns matching enrollments without cancelling them. Field-value
  targeting defaults to dry run unless you set `dryRun` to `false`.
</ParamField>

<ParamField body="reason" type="string">
  Optional reason stored on cancelled enrollment tokens.
</ParamField>

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/sequences/seq_abc123/enrollments/cancel" \
  -H "Authorization: Bearer seq_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "fieldPath": "order.id",
    "fieldValues": ["ord_123", "ord_456"],
    "dryRun": false,
    "reason": "Order cancelled"
  }'
```

## Responses

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "sequenceId": "seq_abc123",
    "dryRun": false,
    "matchedCount": 2,
    "cancelledCount": 2,
    "enrollments": [
      {
        "tokenId": "tok_abc123",
        "subscriberId": "sub_abc123",
        "subscriberEmail": "customer@example.com",
        "status": "cancelled",
        "enrollmentKey": "event:ecommerce.order_placed:field:order.id:ord_123"
      }
    ],
    "hasMore": false,
    "message": "Cancelled 2 sequence enrollments."
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Provide exactly one target: subscriberId or fieldValues."
  }
  ```

  ```json 401 theme={null}
  {
    "error": "Invalid API key"
  }
  ```

  ```json 403 theme={null}
  {
    "error": "No companies found. Create a company first using the create_company tool."
  }
  ```

  ```json 404 theme={null}
  {
    "error": "Sequence not found"
  }
  ```
</ResponseExample>
