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

# Extract Video

> Extract transcripts, frames, and metadata from video files or URLs.

# Extract Video API Documentation

## Description

This endpoint extracts structured data from video files based on a user-defined prompt. It supports input via URL or base64-encoded video content and uses vision-capable Large Language Models (LLMs) to interpret and extract relevant information from the videos.

Please note that this endpoint is charged per **second of video duration**!

## Endpoint

```
POST https://app.dumplingai.com/api/v1/extract-video
```

## Headers

* **Content-Type:** `application/json`
* **Authorization:** Bearer `<API_KEY>` (required)

## Request Body

```json theme={null}
{
  "inputMethod": "string", // Required. Either "url" or "base64".
  "video": "string", // Required. URL or base64-encoded video content.
  "prompt": "string", // Required. The prompt describing the data to extract.
  "jsonMode": boolean // Optional. Whether to return the result in JSON format. Default: false.
}
```

## Responses

### Success (200)

Returns the extracted data based on the provided prompt, along with additional information.

```json theme={null}
{
  "results": "string", // Extracted data based on the prompt
  "prompt": "string", // The original prompt used for extraction
  "videoDuration": number, // Duration of the video in seconds
  "creditUsage": number // Total credits used for this request
}
```

* **Content-Type:** application/json
* **X-RateLimit-Limit:** The rate limit for the user.
* **X-RateLimit-Remaining:** The remaining number of requests for the user.

### Bad Request (400)

Returned if the request is invalid or the video file exceeds size or duration limits.

```json theme={null}
{
  "error": "Error message describing the issue"
}
```

### Unauthorized (401)

Returned if the API key is invalid or missing.

```json theme={null}
{
  "error": "Invalid or missing Authorization header"
}
```

### Internal Server Error (500)

Returned if there's an error during the video extraction process.

```json theme={null}
{
  "error": "Failed to extract video data: [error details]"
}
```

## Example Request

```bash theme={null}
curl -X POST https://app.dumplingai.com/api/v1/extract-video \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
  "inputMethod": "url",
  "video": "https://example.com/sample-video.mp4",
  "prompt": "Describe the main events in this video.",
  "jsonMode": false
}'
```

## Notes

* The maximum file size for a video is 2GB.
* The maximum video duration is 1 hour (3600 seconds).
* Supported video formats: mp4, mpeg, mov, avi, flv, mpg, webm, wmv, 3gpp
* Credit usage:
  * Base cost: 100 credits
  * Additional 10 credits per second of video duration
* The total credit usage is returned in the response as `creditUsage`.
* If using the URL method, ensure the video is publicly accessible.
* The `jsonMode` parameter determines whether the output is formatted as JSON (true) or plain text (false).
* The endpoint uses the Gemini 1.5 Pro model for video analysis and data extraction.
* Temporary files are created during processing and are deleted after use.
* You can get a list of supported video formats by calling:

```
GET /api/v1/extract-video
```

## Rate Limiting

Rate limit headers (`X-RateLimit-Limit` and `X-RateLimit-Remaining`) are included in the response to indicate the user's current rate limit status.

## Error Handling

* If the required parameters (`video` or `prompt`) are missing, a 400 Bad Request error is returned.
* If the video file size exceeds 2GB, a 400 Bad Request error is returned.
* If the video duration exceeds 1 hour, a 400 Bad Request error is returned.
* If there's an error during extraction, a 500 Internal Server Error is returned with details about the failure.

## Security and Privacy

* Uploaded videos are temporarily stored and then deleted after processing.
* Video metadata (including duration) is checked using a separate Python service before processing.


## OpenAPI

````yaml POST /api/v1/extract-video
openapi: 3.0.3
info:
  title: DumplingAI API
  version: 1.0.0
  description: >
    REST API for DumplingAI's content intelligence and automation platform.

    All endpoints are grouped under `/api/v1`; most are secured via Bearer API
    keys unless an operation explicitly sets `security: []`.
servers:
  - url: https://app.dumplingai.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: YouTube
    description: Access metadata, search results, and transcripts from YouTube.
  - name: TikTok
    description: Retrieve TikTok profile, video, follower, and transcript data.
  - name: LinkedIn
    description: Programmatically fetch LinkedIn company and profile data.
  - name: Search
    description: Search-orientated endpoints spanning web, news, maps, and autocomplete.
  - name: Google
    description: Integrations with Google business listings and location data.
  - name: Scraping
    description: Webpage capture, crawling, and structured content extraction utilities.
  - name: Documents
    description: Document processing, conversion, and metadata utilities.
  - name: AI
    description: DumplingAI agent and knowledge base endpoints.
  - name: Developer Tools
    description: Utilities for executing sandboxed code via API.
paths:
  /api/v1/extract-video:
    post:
      tags:
        - Documents
      summary: Extract insights from video
      description: Extract transcripts, frames, and metadata from video files or URLs.
      operationId: extractVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExtractVideoRequest'
            examples:
              default:
                value:
                  inputMethod: url
                  video: https://example.com/demo.mp4
                  prompt: Summarize the main takeaways and capture speaker quotes.
                  jsonMode: true
      responses:
        '200':
          description: Video extraction results returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtractVideoResponse'
        '400':
          description: Invalid request payload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ExtractVideoRequest:
      type: object
      required:
        - inputMethod
        - video
        - prompt
      properties:
        inputMethod:
          $ref: '#/components/schemas/FileInputMethod'
        video:
          type: string
          description: Video URL or base64-encoded video content to analyze.
        prompt:
          type: string
          description: Instructions describing the insights to extract from the video.
        jsonMode:
          type: boolean
          description: When true, requests the model to respond with JSON-formatted output.
          default: false
        requestSource:
          $ref: '#/components/schemas/RequestSource'
      additionalProperties: false
    ExtractVideoResponse:
      type: object
      required:
        - results
        - prompt
        - videoDuration
        - creditUsage
      properties:
        results:
          type: string
          description: Model output returned from the extraction prompt.
        prompt:
          type: string
        videoDuration:
          type: number
          format: float
          description: Duration of the processed video in seconds.
        creditUsage:
          type: integer
          description: Credits consumed while processing the request.
      additionalProperties: false
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Human-readable description of what went wrong.
      required:
        - error
    FileInputMethod:
      type: string
      description: >-
        Indicates whether binary content is supplied via URL or base64-encoded
        string.
      enum:
        - url
        - base64
    RequestSource:
      type: string
      description: Optional identifier describing where the API request originated.
      enum:
        - API
        - WEB
        - MAKE_DOT_COM
        - ZAPIER
        - N8N
        - PLAYGROUND
        - DEFAULT_AUTOMATION
        - AGENT_PREVIEW
        - AGENT_LIVE
        - AUTOPILOT
        - STUDIO
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````