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

# Cancel a Contact's Journey Enrollment

> End a contact's journey enrollment from your system by the idempotency key it was created with or by its external id, with an optional reason.

Send exactly one of `idempotencyKey` or `externalId`. An external id can belong to several enrollments over time, for example a lead enrolled again, and every active one carrying it ends.

The enrollment ends with reason `cancelled`, and the reason you send shows in the contact's history.


## OpenAPI

````yaml POST /journeys/{key}/enrollments/cancel
openapi: 3.1.0
info:
  title: Public API v1
  description: >-
    Public API v1 requiring API keys.


    **Timestamps:** All datetime fields in API responses are returned in UTC
    using ISO 8601 format (e.g., `2024-01-15T14:30:00Z`). When filtering by date
    parameters, provide timestamps in ISO 8601 format.
  version: 0.1.0
servers:
  - url: https://api.usesimple.ai/api/v1
    description: Production API Server
security: []
paths:
  /journeys/{key}/enrollments/cancel:
    post:
      tags:
        - Journeys
      summary: Cancel a Journey Enrollment
      description: >-
        End an enrollment by the idempotencyKey it was created with or by its
        externalId. Every active enrollment carrying the external id ends. The
        enrollment ends with reason cancelled.
      operationId: cancel_enrollment_journeys_key_enrollments_cancel_post
      parameters:
        - name: key
          in: path
          required: true
          description: >-
            The journey's key, such as `appointment-confirmations`. It is shown
            on the journey's Enrollment tab.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JourneyCancelRequest'
            example:
              idempotencyKey: appt-APPT02984416
              reason: Appointment cancelled in Salesforce
      responses:
        '200':
          description: The enrollment ended, or had already ended.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JourneyEnrollmentResult'
        '401':
          description: Authentication failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '404':
          description: >-
            No journey with this key, or no enrollment with this key or external
            id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '422':
          description: Send exactly one of idempotencyKey or externalId.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    JourneyCancelRequest:
      type: object
      additionalProperties: false
      properties:
        idempotencyKey:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          description: The key the enrollment was created with. Send this or externalId.
        externalId:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          description: The enrollment's external id. Send this or idempotencyKey.
        reason:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          description: Why the enrollment was cancelled. Shown in the contact's history.
      title: Cancel Journey Enrollment Request
    JourneyEnrollmentResult:
      type: object
      required:
        - enrollmentId
        - status
        - endedReason
        - skippedReason
        - created
        - nextTouchAt
        - contact
      properties:
        enrollmentId:
          type: string
          description: The enrollment's id. Empty when the contact was skipped.
        status:
          type: string
          enum:
            - active
            - ended
            - skipped
          description: >-
            active while the journey is working the contact, ended once it
            finished, skipped when the contact could not be enrolled.
        endedReason:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Why the enrollment ended, such as goal_met, opted_out, cancelled,
            total_cap or exhausted.
        skippedReason:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Why the contact was not enrolled, in words, such as Active in
            another journey.
        created:
          type: boolean
          description: True when this request created the enrollment.
        nextTouchAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: >-
            When a call or text is going out right away. Null when the next step
            is later; it is planned when it comes due.
        contact:
          anyOf:
            - type: object
              required:
                - timezone
                - timezoneSource
              properties:
                timezone:
                  anyOf:
                    - type: string
                    - type: 'null'
                  description: The time zone used for the contact's calling hours.
                timezoneSource:
                  anyOf:
                    - type: string
                    - type: 'null'
                  description: >-
                    Where the time zone came from: confirmed, provided, address
                    or area_code.
            - type: 'null'
          description: The contact's time zone, when known.
      title: Journey Enrollment Result
    PublicApiError:
      type: object
      required:
        - status
        - success
        - error
        - errors
      properties:
        status:
          type: string
          const: error
        success:
          type: boolean
          const: false
        error:
          type: string
        errors:
          type: array
          items:
            type: string
      title: Public API Error
  securitySchemes:
    APIKeyHeader:
      type: http
      scheme: bearer
      description: 'Your API key, sent as `Authorization: Bearer YOUR_API_KEY`'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.