> ## Documentation Index
> Fetch the complete documentation index at: https://axiom-support-improvements-2025-10-20.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Trim dataset

> Trim dataset

<Note>
  When the endpoint returns the status code 200, it means that the deletion request is queued. The deletion itself might take several hours to complete.
</Note>


## OpenAPI

````yaml v1 post /datasets/{dataset_name}/trim
openapi: 3.0.1
info:
  title: Axiom Public API
  description: A public and stable API for interacting with Axiom services
  termsOfService: http://axiom.co/terms
  contact:
    name: Axiom support team
    url: https://axiom.co
    email: hello@axiom.co
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.0
servers:
  - url: https://api.axiom.co/v1/
security:
  - Auth: []
paths:
  /datasets/{dataset_name}/trim:
    post:
      tags:
        - Datasets
      description: Trim dataset
      operationId: trimDataset
      parameters:
        - name: dataset_name
          in: path
          description: Unique name of the dataset.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrimOptions'
        required: true
      responses:
        '200':
          description: TrimResult
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrimResult'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
      security:
        - Auth:
            - ManageDatasets
components:
  schemas:
    TrimOptions:
      required:
        - maxDuration
      type: object
      properties:
        maxDuration:
          type: string
          example: 1h
      example:
        maxDuration: 1h
    TrimResult:
      required:
        - numDeleted
      type: object
      properties:
        numDeleted:
          type: integer
          description: >-
            numDeleted has been deprecated on 2022-09-14.

            There is currently no way to tell how much was trimmed via the trim
            result.

            If you need to check how much was deleted you can either query the
            removed time range,

            or poll the dataset info endpoint.
          format: int64
          x-go-name: NumDeleted
      x-go-type:
        hints:
          noValidation: true
        import:
          alias: dbdatasets
          package: github.com/axiomhq/axiom/pkg/db/client/swagger/datasets
        type: TrimResult
    ForbiddenError:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
      example:
        code: 403
        message: Forbidden
  securitySchemes:
    Auth:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.google.com/o/oauth2/v2/auth
          tokenUrl: https://www.googleapis.com/oauth2/v4/token
          scopes:
            CanIngest: Allow ingesting of data
            CanQuery: Allow querying
            CanUpdate: Can update Axiom
            ChangeAccess: >-
              Allow editing of users on this organization, and assigning them
              permissions
            ChangeApiKeys: Allow creating and disabling API keys
            ChangeAuthentication: Allow creating and updating authentication mechanisms
            ChangeDashboards: Allow creating and updating dashboards
            ChangeIntegrations: Allow creating and editing of integrations
            ChangeMonitorsAndNotifiers: Allow creating and editing of monitors and notifiers
            ChangeSavedQueries: Allow creating and updating saved queries
            ChangeVirtualFields: Allow creating and editing virtual fields
            ManageAPITokens: Manage API tokens
            ManageBilling: Manage billing, changing pricing tiers, viewing invoices
            ManageDatasets: Allow editing and deleting of datasets
            ManageEndpoints: >-
              Manage endpoints, changing endpoints, viewing endpoints for
              integrations
            ManageSharedAccessKeys: Manage shared access signing keys
            ViewDashboards: Allow viewing of dashboards
            ViewMonitorsAndNotifiers: Allow viewing of monitors and notifiers
            ViewSavedQueries: Allow viewing of saved queries
            ViewVirtualFields: Allow viewing of virtual fields

````