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

# Check Once

> Perform a single synchronous condition check on a YouTube Live stream

Runs one immediate condition check and returns a single result.

Use this when you need a fast yes/no answer now, or when validating a condition before long-running jobs.

## How It Differs From Async Jobs

* `POST /check-once` is synchronous and returns one result.
* `POST /live-monitor` creates/streams a monitoring job.
* `POST /live-digest` creates/streams summary windows.

## Suggested Flow

1. Validate stream liveness: [Validate Stream](/api-reference/streams-validate)
2. Test condition wording: `POST /check-once`
3. Move to monitor/digest only when wording is reliable.

## Response Semantics

The response is immediate and includes:

* `triggered`: boolean decision
* `explanation`: human-readable reason tied to visible evidence
* `latency_ms`: end-to-end request latency
* `frame_b64`: optional frame payload when requested

Client handling recommendation:

* if `triggered = true`, execute your success path
* if `triggered = false`, refine condition or continue monitoring workflow

## Related

* Workflow selection: [Choose Your Workflow](/start-here/choose-workflow)
* Condition quality: [Writing Reliable Conditions](/guides/writing-conditions)
* Continuous detection: [Live Monitor](/api-reference/live-monitor)


## OpenAPI

````yaml POST /check-once
openapi: 3.1.0
info:
  title: Trio API
  description: Reality as an API - Monitor YouTube Live streams with vision models
  version: 1.0.0
servers:
  - url: https://trio.machinefi.com/api
security: []
paths:
  /check-once:
    post:
      tags:
        - Monitoring
      summary: Check Once
      description: Perform a single synchronous condition check on a YouTube Live stream
      operationId: check_once_check_once_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckOnceRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckOnceResponse'
        '400':
          description: Stream is offline, inaccessible, invalid URL, or not a live stream
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
            text/plain:
              example: Invalid HTTP request received.
        '422':
          description: Invalid request format or missing fields
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    CheckOnceRequest:
      properties:
        stream_url:
          type: string
          maxLength: 500
          minLength: 1
          title: Stream Url
          description: YouTube Live URL or RTSP stream
        condition:
          type: string
          maxLength: 1000
          minLength: 1
          title: Condition
          description: Condition to check
        include_frame:
          type: boolean
          title: Include Frame
          description: Include base64 frame in response
          default: false
        input_mode:
          type: string
          enum:
            - frames
            - clip
            - hybrid
          title: Input Mode
          description: >-
            Input mode: 'frames' for single frame, 'clip' for video clip,
            'hybrid' for frame+clip combined
          default: frames
        clip_duration_seconds:
          type: integer
          maximum: 10
          minimum: 1
          title: Clip Duration Seconds
          description: >-
            Duration of video clip in seconds (used when input_mode is 'clip' or
            'hybrid')
          default: 3
      type: object
      required:
        - stream_url
        - condition
      title: CheckOnceRequest
      description: Request for a single synchronous check.
    CheckOnceResponse:
      properties:
        triggered:
          type: boolean
          title: Triggered
        explanation:
          type: string
          title: Explanation
        latency_ms:
          type: integer
          title: Latency Ms
        frame_b64:
          anyOf:
            - type: string
            - type: 'null'
          title: Frame B64
      type: object
      required:
        - triggered
        - explanation
        - latency_ms
      title: CheckOnceResponse
      description: Response for a single check.
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - error
      title: ErrorResponse
      description: Wrapper for error responses.
    ErrorDetail:
      properties:
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        remediation:
          type: string
          title: Remediation
      type: object
      required:
        - code
        - message
        - remediation
      title: ErrorDetail
      description: Standardized error response for better DX.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````