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

# Run a media tool against a stored file

> Apply any Media Tools API operation (remove-background, transform, adjust, trim, convert, watermark, etc.) to a file that already lives in Convertly Storage, without re-uploading the source bytes. The output is saved as a new stored file in the same folder as the source unless overage limits force a 403. Set `preview: true` to receive a data-URL preview without writing to storage.



## OpenAPI

````yaml /openapi.json post /api/files/{id}/tools
openapi: 3.1.0
info:
  title: Convertly API
  version: 1.0.0
  description: >-
    Convertly provides production API endpoints for media conversion,
    compression, Image CDN delivery, Forma AI, HLS/DASH video streaming, media
    tools, async jobs, workflows, webhooks, and Convertly Storage.
  license:
    name: Proprietary
    url: https://convertly.sh/terms
servers:
  - url: https://convertly.sh
security:
  - bearerAuth: []
  - apiKeyAuth: []
paths:
  /api/files/{id}/tools:
    post:
      tags:
        - Files
      summary: Run a media tool against a stored file
      description: >-
        Apply any Media Tools API operation (remove-background, transform,
        adjust, trim, convert, watermark, etc.) to a file that already lives in
        Convertly Storage, without re-uploading the source bytes. The output is
        saved as a new stored file in the same folder as the source unless
        overage limits force a 403. Set `preview: true` to receive a data-URL
        preview without writing to storage.
      operationId: runStoredFileTool
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoredFileToolRequest'
      responses:
        '200':
          description: New stored file (or preview when `preview=true`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoredFileToolResponse'
        '400':
          $ref: '#/components/responses/Error'
        '401':
          $ref: '#/components/responses/Error'
        '402':
          $ref: '#/components/responses/Error'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '429':
          $ref: '#/components/responses/Error'
components:
  schemas:
    StoredFileToolRequest:
      type: object
      properties:
        tool:
          type: string
          enum:
            - remove-background
            - transform
            - vectorize
            - watermark
            - adjust
            - trim
            - convert
            - extract-audio
            - gif
            - poster-frame
            - storyboard
          description: Which Media Tools operation to run against the stored file.
        params:
          type: object
          additionalProperties:
            type: string
          description: >-
            Tool-specific parameters. Send the same fields you would send as
            form data to the equivalent /api/media/* route, as a JSON object of
            string values.
        preview:
          type: boolean
          default: false
          description: >-
            When true, returns a base64 data URL in the response without writing
            a new stored file. Useful for in-app previews.
        watermarkLogoDataUrl:
          type: string
          description: >-
            Watermark only. A data: URL containing the logo image. Required for
            `tool=watermark` with a logo input.
      required:
        - tool
    StoredFileToolResponse:
      oneOf:
        - $ref: '#/components/schemas/StoredFileResponse'
        - type: object
          properties:
            preview:
              type: object
              properties:
                filename:
                  type: string
                mimeType:
                  type: string
                finalSize:
                  type: integer
                downloadUrl:
                  type: string
                  description: 'data: URL containing the preview bytes.'
    StoredFileResponse:
      type: object
      properties:
        file:
          $ref: '#/components/schemas/StoredFile'
      required:
        - file
    Error:
      type: object
      properties:
        error:
          type: string
        upgradeUrl:
          type: string
      required:
        - error
    StoredFile:
      type: object
      properties:
        id:
          type: string
          format: uuid
        filename:
          type: string
        mime_type:
          type: string
        size_bytes:
          type: integer
        folder_id:
          type:
            - string
            - 'null'
          format: uuid
        created_at:
          type: string
          format: date-time
        downloadUrl:
          type:
            - string
            - 'null'
          format: uri
      required:
        - id
        - filename
        - mime_type
        - size_bytes
        - created_at
  responses:
    Error:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Dashboard-generated Convertly API key. Keys currently begin with
        `cvly_`.
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Alternative API key header for server-side clients.

````