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

# Video

> Analyze a **video file** to determine if it contains AI-generated content.

This endpoint analyzes both the video and audio components of the file, providing separate confidence scores for AI-generated video, voice, and music. It can also optionally detect deepfake video content when explicitly requested.

**Caveats**:
* This endpoint can take up to two minutes for longer video files or if our backend is spinning up additional processing nodes. Please set a 120 second timeout in your client.
* This endpoint is synchronous and will only analyze a portion of the content for longer duration videos. The response includes the duration tested. For videos longer than 30 seconds, we recommend breaking them into 30-second segments on the client side for complete analysis.
* Due to a limitation in our document provider, the playground only supports small files of up to 10MB. This limit does not apply when using the API directly.



## OpenAPI

````yaml api-reference/openapi.yaml post /v2/video/sync
openapi: 3.1.0
info:
  title: AIORNOT API
  summary: |2-

            Welcome to AI or Not`s documentation, the developer guide to discerning digital authenticity!
            
  termsOfService: https://aiornot.com/terms-of-service
  contact:
    name: AIORNOT
    url: https://aiornot.com/
    email: support@aiornot.com
  version: 5.0.2
servers:
  - url: https://api.aiornot.com
    description: Production environment
security: []
paths:
  /v2/video/sync:
    post:
      tags:
        - Reports by Modality
      summary: Video
      description: >-
        Analyze a **video file** to determine if it contains AI-generated
        content.


        This endpoint analyzes both the video and audio components of the file,
        providing separate confidence scores for AI-generated video, voice, and
        music. It can also optionally detect deepfake video content when
        explicitly requested.


        **Caveats**:

        * This endpoint can take up to two minutes for longer video files or if
        our backend is spinning up additional processing nodes. Please set a 120
        second timeout in your client.

        * This endpoint is synchronous and will only analyze a portion of the
        content for longer duration videos. The response includes the duration
        tested. For videos longer than 30 seconds, we recommend breaking them
        into 30-second segments on the client side for complete analysis.

        * Due to a limitation in our document provider, the playground only
        supports small files of up to 10MB. This limit does not apply when using
        the API directly.
      operationId: get_video_report_reports_video_post
      parameters:
        - name: excluding
          in: query
          description: >-
            Array of analysis types to exclude. Valid values are `ai_video`,
            `ai_music`, `ai_voice`, `deepfake_video`.
          required: false
          schema:
            type: array
            items:
              type: string
              enum:
                - ai_video
                - ai_music
                - ai_voice
                - deepfake_video
        - name: only
          in: query
          description: >-
            Array of analysis types to include. Valid values are `ai_video`,
            `ai_music`, `ai_voice`, `deepfake_video`. **Note:** `deepfake_video`
            is OFF by default and must be explicitly included using this
            parameter if you want deepfake detection.
          required: false
          schema:
            type: array
            items:
              type: string
              enum:
                - ai_video
                - ai_music
                - ai_voice
                - deepfake_video
        - name: external_id
          in: query
          description: An optional external identifier for tracking this video analysis.
          required: false
          schema:
            type: string
            nullable: true
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                video:
                  type: string
                  format: binary
                  title: Video
                  description: >
                    The video file to analyze. Must be a valid video file.


                    Supported formats include:

                    - 3gp

                    - avi 

                    - flv

                    - gif

                    - m4v

                    - mkv

                    - mov

                    - mp4

                    - mpeg

                    - mpg

                    - mxf

                    - ts

                    - vob

                    - webm

                    - wmv


                    Maximum file size: 200MB


                    For videos with multiple audio or video tracks, only the
                    first track of each type will be analyzed. Videos without
                    audio are allowed - in this case, no audio analysis will be
                    performed.
              required:
                - video
            encoding:
              video:
                contentType: video/*
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoReportResponse'
      security:
        - HTTPBearer: []
      x-codeSamples:
        - lang: python
          label: Python
          source: |
            import os, requests


            # Set API key ENV variable or replace with your own API key
            API_KEY = os.getenv("AIORNOT_API_KEY")
            VIDEO_ENDPOINT = "https://api.aiornot.com/v2/video/sync"

            with open("video.mp4", "rb") as video_file:
                files = {"video": video_file}
                resp = requests.post(
                    VIDEO_ENDPOINT,
                    headers={"Authorization": f"Bearer {API_KEY}"},
                    files=files,
                    # Uncomment below to use only, excluding, or external_id params.
                    # params={
                    #   "only": ["ai_video", "ai_voice"],
                    #   "excluding": ["ai_music"],
                    #   "external_id": "my-tracking-id-123"
                    # },
                    # To enable deepfake detection (OFF by default), include it in the only param:
                    # params={
                    #   "only": ["deepfake_video"]
                    # },
                    timeout=120
                )
                if resp.status_code != 200:
                    raise Exception(f"Failed to analyze video: {resp.status_code} {resp.text}")

                print(resp.json())
        - lang: curl
          label: cURL
          source: |
            curl --request POST \
              --url https://api.aiornot.com/v2/video/sync \
              --header 'Authorization: Bearer $AIORNOT_API_KEY' \
              --form 'video=@video.mp4' \
              --max-time 120
        - lang: javascript
          label: JavaScript
          source: |
            const fs = require('fs');
            const FormData = require('form-data');
            const fetch = require('node-fetch');

            const API_KEY = process.env.AIORNOT_API_KEY;
            const VIDEO_ENDPOINT = 'https://api.aiornot.com/v2/video/sync';

            const form = new FormData();
            form.append('video', fs.createReadStream('video.mp4'));

            fetch(VIDEO_ENDPOINT, {
              method: 'POST',
              headers: {
                'Authorization': `Bearer ${API_KEY}`,
                ...form.getHeaders()
              },
              body: form,
              timeout: 120000
            })
              .then(response => {
                if (!response.ok) {
                  throw new Error(`Failed to analyze video: ${response.status} ${response.statusText}`);
                }
                return response.json();
              })
              .then(data => console.log(data))
              .catch(error => console.error('Error:', error));
        - lang: php
          label: PHP
          source: |
            <?php

            $API_KEY = getenv('AIORNOT_API_KEY');
            $VIDEO_ENDPOINT = 'https://api.aiornot.com/v2/video/sync';

            $curl = curl_init();

            $videoFile = new CURLFile('video.mp4', 'video/mp4', 'video');

            curl_setopt_array($curl, [
              CURLOPT_URL => $VIDEO_ENDPOINT,
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_TIMEOUT => 120,
              CURLOPT_POST => true,
              CURLOPT_POSTFIELDS => [
                'video' => $videoFile
              ],
              CURLOPT_HTTPHEADER => [
                "Authorization: Bearer $API_KEY"
              ],
            ]);

            $response = curl_exec($curl);
            $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } elseif ($httpCode !== 200) {
              echo "Failed to analyze video: HTTP $httpCode - $response";
            } else {
              $data = json_decode($response, true);
              print_r($data);
            }
        - lang: go
          label: Go
          source: |
            package main

            import (
              "bytes"
              "fmt"
              "io"
              "io/ioutil"
              "mime/multipart"
              "net/http"
              "os"
              "time"
            )

            func main() {
              APIKey := os.Getenv("AIORNOT_API_KEY")
              videoEndpoint := "https://api.aiornot.com/v2/video/sync"

              file, err := os.Open("video.mp4")
              if err != nil {
                panic(err)
              }
              defer file.Close()

              var requestBody bytes.Buffer
              writer := multipart.NewWriter(&requestBody)

              part, err := writer.CreateFormFile("video", "video.mp4")
              if err != nil {
                panic(err)
              }

              _, err = io.Copy(part, file)
              if err != nil {
                panic(err)
              }

              err = writer.Close()
              if err != nil {
                panic(err)
              }

              client := &http.Client{
                Timeout: 120 * time.Second,
              }

              req, err := http.NewRequest("POST", videoEndpoint, &requestBody)
              if err != nil {
                panic(err)
              }

              req.Header.Set("Authorization", "Bearer "+APIKey)
              req.Header.Set("Content-Type", writer.FormDataContentType())

              resp, err := client.Do(req)
              if err != nil {
                panic(err)
              }
              defer resp.Body.Close()

              body, err := ioutil.ReadAll(resp.Body)
              if err != nil {
                panic(err)
              }

              if resp.StatusCode != 200 {
                fmt.Printf("Failed to analyze video: %d %s\n", resp.StatusCode, string(body))
                return
              }

              fmt.Println(string(body))
            }
        - lang: java
          label: Java
          source: |
            import java.io.File;
            import java.io.IOException;
            import java.util.concurrent.TimeUnit;
            import okhttp3.*;

            public class VideoAnalysis {
                public static void main(String[] args) {
                    String apiKey = System.getenv("AIORNOT_API_KEY");
                    String videoEndpoint = "https://api.aiornot.com/v2/video/sync";
                    
                    OkHttpClient client = new OkHttpClient.Builder()
                        .readTimeout(120, TimeUnit.SECONDS)
                        .build();
                    
                    File videoFile = new File("video.mp4");
                    
                    RequestBody requestBody = new MultipartBody.Builder()
                        .setType(MultipartBody.FORM)
                        .addFormDataPart("video", videoFile.getName(),
                            RequestBody.create(MediaType.parse("video/mp4"), videoFile))
                        .build();
                    
                    Request request = new Request.Builder()
                        .url(videoEndpoint)
                        .header("Authorization", "Bearer " + apiKey)
                        .post(requestBody)
                        .build();
                    
                    try {
                        Response response = client.newCall(request).execute();
                        if (!response.isSuccessful()) {
                            System.err.println("Failed to analyze video: " + response.code() + " " + response.body().string());
                        } else {
                            System.out.println(response.body().string());
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
components:
  schemas:
    VideoReportResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        external_id:
          type: string
          nullable: true
          title: External ID
          description: The external identifier provided in the request, if any.
        created_at:
          type: string
          format: date-time
          title: Created At
        report:
          $ref: '#/components/schemas/ShareVideoReport'
      type: object
      required:
        - id
        - report
      title: VideoReportResponse
    ShareVideoReport:
      properties:
        ai_video:
          $ref: '#/components/schemas/AIONPredictionBase'
        ai_voice:
          anyOf:
            - $ref: '#/components/schemas/AIONPredictionBase'
            - type: 'null'
        ai_music:
          anyOf:
            - $ref: '#/components/schemas/AIONPredictionBase'
            - type: 'null'
        deepfake_video:
          anyOf:
            - $ref: '#/components/schemas/DeepfakeVideoReportScheme'
            - type: 'null'
        meta:
          type: object
          properties:
            duration:
              type: integer
              title: Duration
              description: Duration of video processed.
              example: 120
            total_bytes:
              type: integer
              title: Total Bytes
              description: Total size of the video file in bytes.
              example: 362594
            md5:
              type: string
              title: MD5
              description: MD5 hash of the uploaded video file.
              example: db36d923800f6ca6b7f87cff8a19d1d1
            audio:
              type: string
              title: Audio
              description: >-
                Should be 'processed' if successful. If unable to process audio,
                it will be 'error'.
              example: processed
            video:
              type: string
              title: Video
              description: >-
                Should be 'processed' if successful. If unable to process video,
                it will be 'error'.
              example: processed
          required:
            - duration
            - total_bytes
            - md5
            - audio
            - video
      type: object
      required:
        - ai_video
        - ai_voice
        - ai_music
        - meta
      title: ShareVideoReport
    AIONPredictionBase:
      properties:
        is_detected:
          type: boolean
          title: Is Detected
          description: Indicates whether the particular class was detected.
        confidence:
          type: number
          title: Confidence
          minimum: 0
          maximum: 1
          example: 0.95
          description: Confidence score for the particular class.
      type: object
      required:
        - is_detected
        - confidence
      title: AIONPredictionBase
    DeepfakeVideoReportScheme:
      properties:
        is_detected:
          type: boolean
          title: Is Detected
          description: Whether deepfake video content was detected
          example: true
        confidence:
          type: number
          title: Confidence
          description: Confidence score for deepfake detection
          example: 0.936413076150301
          minimum: 0
          maximum: 1
        no_faces_found:
          type: boolean
          title: No Faces Found
          description: Indicates whether no faces were found in the video
          example: false
      type: object
      required:
        - is_detected
        - confidence
        - no_faces_found
      title: DeepfakeVideoReportScheme
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      description: >-
        Your [API key](https://www.aiornot.com/dashboard/api) as the `Bearer`
        token in the `Authorization` header.

````