> ## Documentation Index
> Fetch the complete documentation index at: https://axiom.co/docs/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: http
      scheme: bearer
      description: >-
        Authenticate using an API token or personal access token (PAT). Include
        the token as a Bearer token: `Authorization: Bearer <token>`. For more
        information, see [Tokens](/reference/tokens).

````