> ## 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.

# List detections

> Read one page of detection records.

The answer is a plain array and gives no total. To find out if another page
exists, ask for one more record than you show.

Set `ungrouped` to `true` to get only the detections that are in no batch.
`ungrouped` has precedence over `batch_id`.

**Scope:** `DocumentVerification:detections:get`



## OpenAPI

````yaml document-verification/api-reference/openapi.json GET /v1/detections
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/detections:
    get:
      tags:
        - Detections
      summary: List detections
      description: >-
        Read one page of detection records.


        The answer is a plain array and gives no total. To find out if another
        page

        exists, ask for one more record than you show.


        Set `ungrouped` to `true` to get only the detections that are in no
        batch.

        `ungrouped` has precedence over `batch_id`.


        **Scope:** `DocumentVerification:detections:get`
      operationId: list_detections_v1_detections_get
      parameters:
        - name: submitted_by
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Submitted By
        - name: batch_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Batch Id
        - name: ungrouped
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Ungrouped
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 2001
            minimum: 1
            default: 100
            title: Limit
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
            title: Offset
      responses:
        '200':
          description: One page of detections, newest first.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DetectionRecord'
                title: Response List Detections V1 Detections Get
        '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'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    DetectionRecord:
      properties:
        id:
          type: string
          title: Id
        status:
          $ref: '#/components/schemas/DetectionStatus'
          description: '`QUEUED`, `RUNNING`, `COMPLETED`, or `FAILED`.'
        failure_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Failure Code
          description: The reason for a `FAILED` status. Null in all other states.
        score:
          anyOf:
            - type: integer
            - type: 'null'
          title: Score
          description: >-
            The fraud score, normally 0 to 100. A higher score means a higher
            likelihood of fraud, but does not guarantee fraud. Humans should
            always review high-risk cases. Null while the detection runs, and
            null when one check determined the document verification result
            alone.
        billable:
          type: boolean
          title: Billable
        created_at:
          type: string
          format: date-time
          title: Created At
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
        submitted_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Submitted By
        batch_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Batch Id
          description: The batch that holds this detection, if one exists.
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
        content_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Type
        size_bytes:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size Bytes
        s3_key:
          anyOf:
            - type: string
            - type: 'null'
          title: S3 Key
          description: Where the API keeps the document.
        failure_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Failure Message
          description: A sentence that explains `failure_code`.
          readOnly: true
      type: object
      required:
        - id
        - status
        - score
        - billable
        - created_at
        - completed_at
        - submitted_by
        - batch_id
        - filename
        - content_type
        - size_bytes
        - s3_key
        - failure_message
      title: DetectionRecord
      description: The durable detection row; status always reports row state.
    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
    DetectionStatus:
      type: string
      enum:
        - QUEUED
        - RUNNING
        - COMPLETED
        - FAILED
      title: DetectionStatus
    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

````