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

# Request deletion of sessions

> Request deletion of up to 1000 sessions in a project, by session id. The call records the request and returns at once with a request id. A scheduled job then deletes the sessions, so read the request to follow its progress. A session id that does not exist completes as a no-op. A session is `completed` when its data is deleted from object storage and the session is hidden from every query. The physical removal from the query store follows in a daily purge. The caller's key must carry `project.session.delete` for the project. Session deletion is opt-in on a self-hosted data plane: on a data plane where the session deletion job is not enabled, this operation answers 501.



## OpenAPI

````yaml https://raw.githubusercontent.com/honeyhiveai/honeyhive-openapi/main/data_plane_openapi.yaml post /v1/projects/{project_id}/sessions/deletion_requests
openapi: 3.1.0
info:
  title: HoneyHive Data Plane API
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  version: 1.19.0
servers:
  - url: https://api.dp1.us.honeyhive.ai
security: []
tags:
  - name: Charts
    description: >
      Define and manage saved charts. Charts are visualizations that aggregate
      metrics over time with bucketing, filters, and groupings.
  - name: Configurations
    description: >
      Manage prompt configurations, i.e. model parameters, message templates,
      and response settings that can be versioned and deployed without code
      changes.
  - name: Data Plane Api Keys
    description: >
      Create fine-grained data plane API keys for a project from a provisioning
      flow, using an organization-rooted key that is permitted to create keys.
  - name: Datapoints
    description: >
      Manage individual records inside datasets, including batch creation and
      mapping to source events.
  - name: Datasets
    description: >
      Curate collections of datapoints used as test sets for evaluations and
      experiments.
  - name: Evaluators
    description: >
      Manage project-scoped evaluator definitions, immutable versions,
      publication and archival. Requires a fine-grained data plane API key.
  - name: Events
    description: >
      Read and write trace events. Events are the spans that capture every step
      of an AI application's execution.
  - name: Experiments
    description: >
      Run, retrieve, and compare evaluation runs to measure how prompt or
      configuration changes affect agent performance.
  - name: Ingestion Api Keys
    description: >
      Create ingestion API keys for a project from a provisioning flow, using an
      organization-rooted data plane key that is permitted to create keys. An
      ingestion key is the credential an application sends traces with.
  - name: Metric Versions
    description: >
      Snapshot, list, and deploy versions of a metric's definition so changes
      can be reviewed and rolled back without losing history.
  - name: Metrics
    description: >
      Define and run evaluators, i.e. automated quality checks that score traces
      against criteria like accuracy, safety, or correctness.
  - name: Queues
    description: >
      Manage annotation queues for human review of traces, turning expert
      feedback into labeled datasets.
  - name: Sessions
    description: >
      Group related trace events into sessions, the top-level container for a
      multi-step or multi-service AI interaction.
paths:
  /v1/projects/{project_id}/sessions/deletion_requests:
    post:
      tags:
        - Sessions
      summary: Request deletion of sessions
      description: >-
        Request deletion of up to 1000 sessions in a project, by session id. The
        call records the request and returns at once with a request id. A
        scheduled job then deletes the sessions, so read the request to follow
        its progress. A session id that does not exist completes as a no-op. A
        session is `completed` when its data is deleted from object storage and
        the session is hidden from every query. The physical removal from the
        query store follows in a daily purge. The caller's key must carry
        `project.session.delete` for the project. Session deletion is opt-in on
        a self-hosted data plane: on a data plane where the session deletion job
        is not enabled, this operation answers 501.
      operationId: createSessionDeletionRequest
      parameters:
        - in: path
          name: project_id
          required: true
          schema:
            type: string
          description: The unique identifier of the project the sessions belong to
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSessionDeletionRequestRequest'
      responses:
        '200':
          description: Deletion request recorded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSessionDeletionRequestResponse'
        '400':
          description: >-
            The request body is invalid, for example no session ids or more than
            1000.
        '404':
          description: >-
            No project with the given `project_id` exists in the caller's scope,
            or the caller's key does not carry `project.session.delete` for it.
        '501':
          description: The session deletion job is not enabled on this data plane.
      security:
        - DataPlaneApiKey: []
components:
  schemas:
    CreateSessionDeletionRequestRequest:
      type: object
      properties:
        session_ids:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 256
          minItems: 1
          maxItems: 1000
          description: >-
            The sessions to delete, by session id. Up to 1000. A session id that
            does not exist completes as a no-op, and a repeated id counts once.
      required:
        - session_ids
      additionalProperties: false
    CreateSessionDeletionRequestResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/SessionDeletionRequest'
      required:
        - success
        - data
      additionalProperties: false
    SessionDeletionRequest:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the deletion request.
        status:
          $ref: '#/components/schemas/SessionDeletionRequestStatus'
        session_counts:
          $ref: '#/components/schemas/SessionDeletionRequestSessionCounts'
        created_at:
          type: string
          format: date-time
          description: When the request was created.
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the request reached a final status. Null until then.
      required:
        - id
        - status
        - session_counts
        - created_at
        - completed_at
      additionalProperties: false
    SessionDeletionRequestStatus:
      type: string
      enum:
        - pending
        - processing
        - completed
        - failed
        - partially_failed
      description: >-
        Status of the request. `pending` and `processing` mean work remains.
        Every other status is final. `completed` means every session was
        deleted. `failed` means at least one session failed, and other sessions
        in the request can be completed. `session_counts` gives the number of
        sessions in each state. `partially_failed` is reserved and is not
        returned. Treat it as a final status.
    SessionDeletionRequestSessionCounts:
      type: object
      properties:
        pending:
          type: integer
          minimum: 0
          description: Sessions not yet picked up for deletion.
        processing:
          type: integer
          minimum: 0
          description: Sessions being deleted.
        completed:
          type: integer
          minimum: 0
          description: Sessions deleted.
        failed:
          type: integer
          minimum: 0
          description: Sessions whose deletion failed.
      required:
        - pending
        - processing
        - completed
        - failed
      additionalProperties: false
      description: >-
        How many of the sessions in the request are in each status. The counts
        sum to the number of distinct session ids in the request.
  securitySchemes:
    DataPlaneApiKey:
      type: http
      scheme: bearer
      description: >-
        A fine-grained data plane API key (values begin with `hh_fgdp_`). Rooted
        at an organization, workspace, or project, it carries the permissions
        chosen when it was created, and only the operations whose paths begin
        with `/v1/projects/{project_id}/` accept it. Create one in the HoneyHive
        app under the project's, workspace's, or organization's **Settings → API
        Keys**, on the **Data Plane** tab.

````

## Related topics

- [Sessions](https://docs.honeyhive.ai/v2/cli-reference/ref/sessions.md)
- [Sessions Methods](https://docs.honeyhive.ai/v2/sdk-reference/typescript/ref/sessions/index.md)
- [Get a session deletion request](https://docs.honeyhive.ai/v2/api-reference-autogen/sessions/get-a-session-deletion-request.md)


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