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

# End Live Activity Stream

> Use this endpoint when the process you are tracking is finished and you no longer want the Live Activity on your devices. ActivitySmith ends the current Live Activity for this stream and dismisses it from devices. If you need direct lifecycle control, use /live-activity/start, /live-activity/update, and /live-activity/end instead. Use secondary_action for a second button on alert, progress, and segmented_progress Live Activities.

Use this endpoint when the process you are tracking is finished and you want to
dismiss the managed Live Activity stream.

* Call it with the same `stream_key` you used for stream updates.
* You can include optional `content_state` with final values.
* By default, iOS removes the Live Activity after two minutes.
* Set `auto_dismiss_minutes` to choose a different dismissal time, including `0`
  for immediate dismissal.


## OpenAPI

````yaml DELETE /live-activity/stream/{stream_key}
openapi: 3.1.0
info:
  title: ActivitySmith API
  description: >-
    Send push notifications and Live Activities to your own devices via a single
    API key.
  version: 1.0.0
servers:
  - url: https://activitysmith.com/api
security:
  - apiKeyAuth: []
tags:
  - name: PushNotifications
    description: Send push notifications to paired devices.
  - name: AppIconBadges
    description: Update App Icon Badge Counts on paired devices.
  - name: LiveActivities
    description: Start, update, stream, and end Live Activities.
  - name: Metrics
    description: Update metric values shown in ActivitySmith widgets.
paths:
  /live-activity/stream/{stream_key}:
    delete:
      tags:
        - LiveActivities
      summary: End a stream
      description: >-
        Use this endpoint when the process you are tracking is finished and you
        no longer want the Live Activity on your devices. ActivitySmith ends the
        current Live Activity for this stream and dismisses it from devices. If
        you need direct lifecycle control, use /live-activity/start,
        /live-activity/update, and /live-activity/end instead. Use
        secondary_action for a second button on alert, progress, and
        segmented_progress Live Activities.
      operationId: endLiveActivityStream
      parameters:
        - name: stream_key
          in: path
          required: true
          description: >-
            Stable identifier for one ongoing thing. Allowed characters:
            letters, numbers, underscores, and hyphens.
          schema:
            type: string
            maxLength: 255
            pattern: ^[A-Za-z0-9_-]+$
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LiveActivityStreamDeleteRequest'
            examples:
              default:
                value: {}
              with_content_state:
                value:
                  content_state:
                    title: Server Health
                    subtitle: prod-web-1
                    type: metrics
                    metrics:
                      - label: CPU
                        value: 0
                        unit: '%'
                      - label: MEM
                        value: 0
                        unit: '%'
                    auto_dismiss_minutes: 2
      responses:
        '200':
          description: Managed stream ended
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LiveActivityStreamDeleteResponse'
              examples:
                ended:
                  value:
                    success: true
                    operation: ended
                    stream_key: prod-web-1
                    activity_id: h8QmSyYFTuwOIF6Wh3YcZlzHLhUcr034
                    devices_queued: 1
                    timestamp: '2025-08-12T12:10:00.000Z'
                already_inactive:
                  value:
                    success: true
                    operation: ended
                    stream_key: prod-web-1
                    activity_id: null
                    timestamp: '2025-08-12T12:10:00.000Z'
        '400':
          description: Bad request (invalid stream_key or action)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
              examples:
                invalid_stream_key:
                  value:
                    error: Invalid stream_key
                    message: >-
                      stream_key must contain only letters, numbers,
                      underscores, and hyphens
        '404':
          description: Managed stream not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
              examples:
                not_found:
                  value:
                    error: Live Activity stream not found
                    message: 'No Live Activity stream found for stream_key: prod-web-1'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
              examples:
                rate_limited:
                  value:
                    error: Rate limit exceeded
                    message: Too many requests, please try again later.
      x-codeSamples:
        - lang: javascript
          label: Node
          source: |-
            import ActivitySmith from "activitysmith";

            const activitysmith = new ActivitySmith({
              apiKey: process.env.ACTIVITYSMITH_API_KEY,
            });

            await activitysmith.liveActivities.endStream("prod-web-1", {
              content_state: {
                title: "Server Health",
                subtitle: "prod-web-1",
                type: "metrics",
                metrics: [
                  { label: "CPU", value: 7, unit: "%" },
                  { label: "MEM", value: 38, unit: "%" },
                ],
              },
            });
        - lang: python
          label: Python
          source: >-
            import os

            from activitysmith import ActivitySmith


            activitysmith =
            ActivitySmith(api_key=os.environ["ACTIVITYSMITH_API_KEY"])


            activitysmith.live_activities.end_stream(
                "prod-web-1",
                {
                    "content_state": {
                        "title": "Server Health",
                        "subtitle": "prod-web-1",
                        "type": "metrics",
                        "metrics": [
                            {"label": "CPU", "value": 7, "unit": "%"},
                            {"label": "MEM", "value": 38, "unit": "%"},
                        ],
                    },
                },
            )
        - lang: go
          label: Go
          source: "package main\n\nimport (\n\t\"log\"\n\n\tactivitysmithsdk \"github.com/ActivitySmithHQ/activitysmith-go\"\n\t\"github.com/ActivitySmithHQ/activitysmith-go/generated\"\n)\n\nfunc main() {\n\tactivitysmith, err := activitysmithsdk.New(\"YOUR-API-KEY\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, err = activitysmith.LiveActivities.EndStream(\"prod-web-1\", activitysmithsdk.LiveActivityStreamEndInput{\n\t\tTitle:    \"Server Health\",\n\t\tSubtitle: \"prod-web-1\",\n\t\tType:     \"metrics\",\n\t\tMetrics: []generated.ActivityMetric{\n\t\t\t{Label: \"CPU\", Value: 7, Unit: generated.PtrString(\"%\")},\n\t\t\t{Label: \"MEM\", Value: 38, Unit: generated.PtrString(\"%\")},\n\t\t},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}"
        - lang: php
          label: PHP
          source: |-
            <?php

            use ActivitySmith\ActivitySmith;

            $activitysmith = new ActivitySmith($_ENV['ACTIVITYSMITH_API_KEY']);

            $activitysmith->liveActivities->endStream('prod-web-1', [
                'content_state' => [
                    'title' => 'Server Health',
                    'subtitle' => 'prod-web-1',
                    'type' => 'metrics',
                    'metrics' => [
                        ['label' => 'CPU', 'value' => 7, 'unit' => '%'],
                        ['label' => 'MEM', 'value' => 38, 'unit' => '%'],
                    ],
                ],
            ]);
        - lang: ruby
          label: Ruby
          source: >-
            require "activitysmith"


            activitysmith = ActivitySmith::Client.new(api_key:
            ENV.fetch("ACTIVITYSMITH_API_KEY"))


            activitysmith.live_activities.end_stream(
              "prod-web-1",
              {
                content_state: {
                  title: "Server Health",
                  subtitle: "prod-web-1",
                  type: "metrics",
                  metrics: [
                    { label: "CPU", value: 7, unit: "%" },
                    { label: "MEM", value: 38, unit: "%" }
                  ]
                }
              }
            )
        - lang: bash
          label: cURL
          source: >-
            curl -X DELETE
            "https://activitysmith.com/api/live-activity/stream/prod-web-1" \
              -H "Authorization: Bearer $ACTIVITYSMITH_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "content_state": {
                  "title": "Server Health",
                  "subtitle": "prod-web-1",
                  "type": "metrics",
                  "metrics": [
                    { "label": "CPU", "value": 7, "unit": "%" },
                    { "label": "MEM", "value": 38, "unit": "%" }
                  ]
                }
              }'
components:
  schemas:
    LiveActivityStreamDeleteRequest:
      type: object
      description: >-
        Optional payload for ending a managed stream. When omitted,
        ActivitySmith ends the stream using the latest known state when
        possible.
      properties:
        content_state:
          $ref: '#/components/schemas/StreamContentState'
        action:
          $ref: '#/components/schemas/LiveActivityAction'
        secondary_action:
          $ref: '#/components/schemas/LiveActivityAction'
          description: >-
            Optional secondary action button. Supported for alert, progress, and
            segmented_progress Live Activities. Uses the same open_url,
            shortcuts://, and webhook shapes as action.
        alert:
          $ref: '#/components/schemas/AlertPayload'
      additionalProperties: false
    LiveActivityStreamDeleteResponse:
      type: object
      description: Returned after a managed stream is ended and removed.
      properties:
        success:
          type: boolean
        operation:
          type: string
          enum:
            - ended
        stream_key:
          type: string
        activity_id:
          type:
            - string
            - 'null'
        devices_queued:
          type: integer
        devices_notified:
          type: integer
        timestamp:
          type: string
          format: date-time
      required:
        - success
        - operation
        - stream_key
        - timestamp
      additionalProperties: false
    BadRequestError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
      required:
        - error
        - message
      additionalProperties: true
    NotFoundError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
      required:
        - error
        - message
      additionalProperties: true
    RateLimitError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
      required:
        - error
        - message
      additionalProperties: false
    StreamContentState:
      type: object
      description: >-
        Current state for a managed Live Activity stream. Include type on the
        first PUT, and whenever the stream may need to start a fresh activity.
        Supports segmented_progress, progress, metrics, stats, alert, and timer
        types. For timer, send duration_seconds to start or reset a bounded
        timer; omit duration_seconds on later updates to preserve the existing
        timer window.
      required:
        - title
      properties:
        title:
          type: string
        subtitle:
          type: string
        number_of_steps:
          type: integer
          minimum: 1
          description: Use for segmented_progress.
        current_step:
          type: integer
          minimum: 0
          description: >-
            Use for segmented_progress. Set 0 when no segment is complete yet.
            Must be less than or equal to number_of_steps when number_of_steps
            is provided.
        percentage:
          type: number
          minimum: 0
          maximum: 100
          description: >-
            Use for progress. Takes precedence over value/upper_limit if both
            are provided.
        value:
          type: number
          description: Current progress value. Use with upper_limit for progress.
        upper_limit:
          type: number
          exclusiveMinimum: 0
          description: Maximum progress value. Use with value for progress.
        duration_seconds:
          type: number
          exclusiveMinimum: 0
          description: >-
            Timer duration in seconds. For type=timer, send duration_seconds to
            start or reset the timer window; omit it on later stream updates to
            preserve the existing timer window.
        counts_down:
          type: boolean
          default: true
          description: >-
            Use with type=timer. When true or omitted, the timer counts down
            from duration_seconds. Set false for an elapsed timer; omit
            duration_seconds for an open-ended elapsed timer.
        is_running:
          type: boolean
          default: true
          description: >-
            Use with type=timer. Defaults to true. Set false to pause/freeze via
            API; set true on a paused timer to resume.
        type:
          type: string
          enum:
            - segmented_progress
            - progress
            - metrics
            - stats
            - alert
            - timer
          description: >-
            Required on the first PUT or whenever the stream cannot infer the
            current activity type.
        color:
          type: string
          enum:
            - lime
            - green
            - cyan
            - blue
            - purple
            - magenta
            - red
            - orange
            - yellow
            - gray
          description: >-
            Optional. Accent color for progress, segmented_progress, metrics,
            and timer Live Activities. For Alert Live Activities, this tints
            action and secondary_action buttons when included.
        step_color:
          type: string
          enum:
            - lime
            - green
            - cyan
            - blue
            - purple
            - magenta
            - red
            - orange
            - yellow
            - gray
          description: >-
            Optional. Overrides color for the current step. Only applies to
            segmented_progress.
        step_colors:
          type: array
          items:
            type: string
            enum:
              - lime
              - green
              - cyan
              - blue
              - purple
              - magenta
              - red
              - orange
              - yellow
              - gray
          description: >-
            Optional. Colors for completed steps. When used with
            segmented_progress, the array length should match current_step.
        metrics:
          type: array
          description: Use for metrics and stats activities.
          minItems: 1
          maxItems: 8
          items:
            $ref: '#/components/schemas/ActivityMetric'
        message:
          type: string
          minLength: 1
          description: Required for type=alert.
        icon:
          $ref: '#/components/schemas/LiveActivityAlertIcon'
          description: >-
            Optional SF Symbol icon. Supported by alert, progress,
            segmented_progress, metrics, stats, and timer.
        badge:
          $ref: '#/components/schemas/LiveActivityAlertBadge'
          description: >-
            Optional badge. Supported by alert, progress, and
            segmented_progress.
        auto_dismiss_seconds:
          type: integer
          minimum: 0
          description: Optional. Seconds before the ended Live Activity is dismissed.
        auto_dismiss_minutes:
          type: integer
          minimum: 0
          description: Optional. Minutes before the ended Live Activity is dismissed.
      dependentRequired:
        value:
          - upper_limit
        upper_limit:
          - value
      additionalProperties: false
    LiveActivityAction:
      type: object
      description: >-
        Optional action button shown in the Live Activity UI. Use action for the
        primary button, or secondary_action for a secondary button on alert,
        progress, and segmented_progress Live Activities.
      properties:
        title:
          type: string
          description: Button title displayed in the Live Activity UI.
        type:
          $ref: '#/components/schemas/LiveActivityActionType'
        url:
          type: string
          format: uri
          description: >-
            Action URL. For open_url, use an HTTP or HTTPS URL or a
            shortcuts://run-shortcut?name=... URL that runs a specific iPhone
            Shortcut. For webhook, use an HTTPS URL called by the ActivitySmith
            backend.
        method:
          $ref: '#/components/schemas/LiveActivityWebhookMethod'
          description: Webhook HTTP method. Used only when type=webhook.
        body:
          type: object
          additionalProperties: true
          description: Optional webhook payload body. Used only when type=webhook.
      required:
        - title
        - type
        - url
      allOf:
        - if:
            properties:
              type:
                const: open_url
            required:
              - type
          then:
            properties:
              url:
                pattern: ^(http|https|shortcuts)://
        - if:
            properties:
              type:
                const: webhook
            required:
              - type
          then:
            properties:
              url:
                pattern: ^https://
      additionalProperties: false
    AlertPayload:
      type: object
      properties:
        title:
          type: string
        body:
          type: string
      additionalProperties: false
    ActivityMetric:
      type: object
      required:
        - label
        - value
      properties:
        label:
          type: string
          minLength: 1
        value:
          oneOf:
            - type: number
              minimum: 0
            - type: string
              minLength: 1
              maxLength: 64
        unit:
          type: string
        color:
          type: string
          enum:
            - lime
            - green
            - cyan
            - blue
            - purple
            - magenta
            - red
            - orange
            - yellow
            - gray
          description: Optional per-metric accent color for metrics and stats activities.
      additionalProperties: false
    LiveActivityAlertIcon:
      type: object
      description: Optional SF Symbol icon for Live Activities.
      required:
        - symbol
      properties:
        symbol:
          type: string
          minLength: 1
          description: Apple SF Symbol name.
        color:
          $ref: '#/components/schemas/LiveActivityColor'
          description: Optional icon color.
      additionalProperties: false
    LiveActivityAlertBadge:
      type: object
      description: Optional badge for Live Activities.
      required:
        - title
      properties:
        title:
          type: string
          minLength: 1
        color:
          $ref: '#/components/schemas/LiveActivityColor'
          description: Optional badge color.
      additionalProperties: false
    LiveActivityActionType:
      type: string
      enum:
        - open_url
        - webhook
    LiveActivityWebhookMethod:
      type: string
      enum:
        - GET
        - POST
      default: POST
    LiveActivityColor:
      type: string
      enum:
        - lime
        - green
        - cyan
        - blue
        - purple
        - magenta
        - red
        - orange
        - yellow
        - gray
  securitySchemes:
    apiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Required. Include `Authorization: Bearer ask_123456789` in every
        request. Replace `ask_123456789` with your API key.

````