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

# Delete a detection

> Delete one detection record and its stored document files.

The delete applies only to a detection that the calling principal owns.
Give `submitted_by` to delete on behalf of one of your end users; the
value must match the one used to create the detection. A detection owned
by anyone else answers `404`.

A detection that is still running is not stopped. The workflow continues
and then finds no record to write. The reasoning text in the artifact
store is not deleted; it expires on its own.

**Scope:** `DocumentVerification:detections:delete`



## OpenAPI

````yaml document-verification/api-reference/openapi.json DELETE /v1/detection/{detection_id}
openapi: 3.1.0
info:
  title: Trelent Document Verification API
  description: >

    Trelent Document Verification integrates with your platform to assess fraud

    risk in financial and identity documents. The API returns a fraud score

    and detailed reasoning. Your team builds the integration to display these

    results in your interface and support human review. Trelent can help you
    build

    that integration.


    Use cases include loan application review and legal document review.


    Your end-users submit documents through your platform.


    Document Verification is always deployed in your cloud environment. Your
    data

    is never sent to or retained on Trelent servers.


    ## How a detection runs


    Detection is asynchronous. `POST /v1/detection` answers `202` immediately
    with

    a detection id and the status `QUEUED`. A workflow then prepares the
    document,

    runs the deterministic checks, and runs the analysis agent. Read the result

    with `GET /v1/detection/{detection_id}` until the status is `COMPLETED` or

    `FAILED`.


    ## How you supply a document


    Each create request names its documents in one of two ways, and exactly one
    of

    the two must be present:


    - `source_url` — the API downloads the document
      from a URL that you supply. Use this method for API integrations.
    - `upload_id` — the caller has already written the files to object storage.
      API integrations should use `source_url`.

    ## Authentication


    Every `/v1` operation needs an OAuth2 access token from the

    `client_credentials` grant. Put the token in the `Authorization` header as

    `Bearer <token>`.


    In most cases the scope `DocumentVerification:*` covers every operation, so

    request that if your client holds it. The description of each operation also

    names the narrower scope it needs.
  version: 1.0.0
servers: []
security: []
tags:
  - name: Detections
    description: >-
      Verify one document. A detection starts as `QUEUED` and gives no verdict
      until the status becomes `COMPLETED`.
  - name: Authentication
    description: Exchange client credentials for an access token.
paths:
  /v1/detection/{detection_id}:
    delete:
      tags:
        - Detections
      summary: Delete a detection
      description: |-
        Delete one detection record and its stored document files.

        The delete applies only to a detection that the calling principal owns.
        Give `submitted_by` to delete on behalf of one of your end users; the
        value must match the one used to create the detection. A detection owned
        by anyone else answers `404`.

        A detection that is still running is not stopped. The workflow continues
        and then finds no record to write. The reasoning text in the artifact
        store is not deleted; it expires on its own.

        **Scope:** `DocumentVerification:detections:delete`
      operationId: delete_detection_v1_detection__detection_id__delete
      parameters:
        - name: detection_id
          in: path
          required: true
          schema:
            type: string
            title: Detection Id
        - name: submitted_by
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Submitted By
      responses:
        '204':
          description: The detection and its files are deleted.
        '401':
          description: The bearer token is absent, expired, or not valid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: The token does not hold the necessary scopes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No such record.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ErrorResponse:
      properties:
        detail:
          type: string
          title: Detail
      type: object
      required:
        - detail
      title: ErrorResponse
      description: Every error answer holds one message in `detail`.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````