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

# Get a data stream operation

> Poll a delete or reset operation kicked off against this data stream. Returns the serialized `DataStreamOperation`. On a terminal status, `records_remaining` is the primary-database count of records left on the stream (`0` on `completed`), so callers can trust the operation instead of re-listing records.



## OpenAPI

````yaml /openapi.json get /data_streams/{key}/operations/{id}
openapi: 3.1.0
info:
  title: End Close API
  description: REST API is used to interact with the End Close platform.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.endclose.com/v1
security:
  - ApiKeyAuth: []
paths:
  /data_streams/{key}/operations/{id}:
    get:
      summary: Get a data stream operation
      description: >-
        Poll a delete or reset operation kicked off against this data stream.
        Returns the serialized `DataStreamOperation`. On a terminal status,
        `records_remaining` is the primary-database count of records left on the
        stream (`0` on `completed`), so callers can trust the operation instead
        of re-listing records.
      parameters:
        - in: path
          name: key
          required: true
          schema:
            type: string
          description: The immutable data stream key
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: >-
            The operation ID returned by DELETE /data_streams/{key} or POST
            /data_streams/{key}/reset
      responses:
        '200':
          description: The operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataStreamOperation'
        '401':
          description: Unauthorized
        '404':
          description: Operation not found or does not belong to this data stream
components:
  schemas:
    DataStreamOperation:
      type: object
      description: >-
        Async operation against a data stream (delete or reset). Poll via GET
        /data_streams/{key}/operations/{id}. An operation only reaches
        `completed` once the stream is verified empty in the primary database;
        if records outlive the wipe (for example, ingestion landing mid-reset),
        it ends `failed` with `records_remaining` > 0 and an `error_message`
        asking you to retry.
      properties:
        id:
          type: integer
        data_stream_id:
          type: integer
        data_stream_key:
          type: string
        kind:
          type: string
          enum:
            - delete
            - reset
        status:
          type: string
          enum:
            - pending
            - running
            - completed
            - failed
        progress:
          type: integer
          description: Percentage 0-100
        error_message:
          type: string
          nullable: true
        records_remaining:
          type: integer
          nullable: true
          description: >-
            Number of records still on the stream when the operation reached a
            terminal state, counted in the primary database (not the analytics
            mirror behind `records_count`, which can lag). `0` on `completed`;
            greater than `0` on a `failed` operation that left records behind;
            `null` while `pending` or `running`. After a reset, trust this field
            rather than re-listing `/records`.
        started_at:
          type: string
          format: date-time
          nullable: true
        completed_at:
          type: string
          format: date-time
          nullable: true
        created_at:
          type: string
          format: date-time
        requested_by_user_id:
          type: integer
          nullable: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````

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