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

# Delete measurements by source file

> Permanently deletes all measurements for a spacecraft from a specific source file. This is useful when an uploaded file contains incorrect data. WARNING: This operation cannot be undone. Returns 200 with deletedCount=0 if no matching measurements are found.



## OpenAPI

````yaml https://api.valar.space/api-docs/mintlify delete /operations/measurements/by-file
openapi: 3.0.1
info:
  contact:
    email: api@valar.space
    name: Valar Space
    url: https://valar.space
  description: >-
    <H4>Welcome to the documentation for the Valar Operations API, here are some
    quick tips if you just landed!</H4><ol><li> The top level elements are the
    <b>Resources</b> accessible via the API and the different queries used to
    interact with each resource via the appropriate HTTP method call.</li><li>
    You can expand each method to get further information on the expected input
    parameters and the different responses that can be received.</li><li>For
    both the input parameters and responses, an <b>Example</b> is present for
    clarification.</li><li>For further details, the example snipped can be
    switched to <b>Schema</b> view, where a detailed explanation of each element
    can be found.</li><li>The <b>Try it out</b> button can be used to call the
    API directly from the documentation page, which allows for some easy testing
    and also provides the equivalent 'curl' command line code for easy
    portability of the call execution.</li><li><b>Before starting</b>, remember
    to use the token endpoint and activate the token with the <b>Authorize</b>
    button.</li></ol>
  title: API Documentation
  version: 1.0.0
servers:
  - url: /
    description: Default Server URL
  - url: https://api.valar.space
    description: API Server
security:
  - apiKeyAuth: []
tags:
  - description: >-
      Operations for managing state vectors — listing, importing, exporting, and
      deleting spacecraft state data
    name: State Vectors
paths:
  /operations/measurements/by-file:
    delete:
      tags:
        - Measurements
      summary: Delete measurements by source file
      description: >-
        Permanently deletes all measurements for a spacecraft from a specific
        source file. This is useful when an uploaded file contains incorrect
        data. WARNING: This operation cannot be undone. Returns 200 with
        deletedCount=0 if no matching measurements are found.
      operationId: deleteByFile
      parameters:
        - description: Spacecraft identifier
          example: SAT-1
          in: query
          name: spacecraftId
          required: true
          schema:
            type: string
        - description: Source file name to delete measurements from
          example: tracking_data_2025-01-15.tdm
          in: query
          name: file
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteByFileResponse'
          description: Measurements deleted successfully
        '400':
          content:
            application/json:
              example:
                timestamp: '2025-01-15T10:30:00.000Z'
                status: 400
                error: Bad Request
                message: Validation failed
                path: /operations/measurements/by-file
                fieldErrors:
                  spacecraftId: spacecraftId is required
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid request — missing required parameters
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BearerTokenErrorResponse'
          description: Not authenticated — missing or invalid bearer token
        '403':
          content:
            application/json:
              example:
                timestamp: '2025-01-15T10:30:00.000Z'
                status: 403
                error: ACCESS_ERROR
                message: Access denied
                path: /operations/measurements/by-file
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Insufficient permissions — requires write:tracking authority
        '500':
          content:
            application/json:
              example:
                timestamp: '2025-01-15T10:30:00.000Z'
                status: 500
                error: Internal Server Error
                message: An unexpected error occurred
                path: /operations/measurements/by-file
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
components:
  schemas:
    DeleteByFileResponse:
      type: object
      properties:
        deletedCount:
          type: integer
          description: Number of measurements permanently deleted
          format: int64
          example: 100
      description: Response for bulk deletion of measurements by source file
    ErrorResponse:
      type: object
      properties:
        details:
          type: object
          additionalProperties:
            type: object
            description: Structured error details with scenario-specific context fields
            nullable: true
          description: Structured error details with scenario-specific context fields
          nullable: true
        error:
          type: string
          description: HTTP status reason phrase or error category
          example: Bad Request
        fieldErrors:
          type: object
          additionalProperties:
            type: string
            description: >-
              Per-field validation error messages, present only for validation
              errors
            nullable: true
          description: >-
            Per-field validation error messages, present only for validation
            errors
          nullable: true
        message:
          type: string
          description: Detailed error message
          example: Validation failed
        path:
          type: string
          description: The request path where the error occurred
          example: /measurements
        status:
          type: integer
          description: The HTTP status code
          format: int32
          example: 400
        timestamp:
          type: string
          description: The timestamp when the error occurred
          format: date-time
          example: '2025-11-14T10:15:30.123Z'
    BearerTokenErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: OAuth 2.0 error code
          example: invalid_token
        error_description:
          type: string
          description: Human-readable error description
          example: An error occurred while attempting to decode the Jwt
      description: OAuth 2.0 Bearer Token error response (RFC 6750)
  securitySchemes:
    apiKeyAuth:
      description: 'API Key (format: vsp_sk_...)'
      scheme: bearer
      type: http

````