# Video Summarization API

> Generate AI-powered video overviews, hashtags, and timeline highlights.

> **Recommended: Use [Video Notes API](https://wayin.ai/api-docs/video-notes/)** — same cost, richer features, prompt control.
>
> _Legacy Video Summarization API remains fully supported._

## Video Summarization API

Submit a video of any length and receive an AI-generated structured overview, hashtags, and timeline highlights. The API supports everything from short clips to hours-long videos across major platforms and locally uploaded files, along with language settings.

## Supported Video Sources

The API accepts URLs from the following platforms: YouTube, Vimeo, Dailymotion, Kick, Twitch, TikTok, Facebook, Zoom, Rumble and more.

You can also summarize [local video or audio files you upload](https://wayin.ai/api-docs/upload/) — local upload requires a **Starter** plan or above.

### Workflow

1. **Submit** a summarization task from a video URL
2. **Poll** the results until status is `SUCCEEDED`

---

## Submit Summarization Task

Submit a new summarization task. This is the entry point for all summarization features.

```http
POST https://wayinvideo-api.wayin.ai/api/v2/summaries
```

### Request Body

| Parameter     | Type   | Required | Default | Description                                                                                                                                                                                             |
| ------------- | ------ | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `video_url`   | string | Yes      | —       | The source video URL or uploaded file identifier                                                                                                                                                        |
| `source_lang` | string | No       | `null`  | Source language of the video (see [Supported Languages](https://wayin.ai/api-docs/supported-languages/)). When `null`, the system auto-detects the original language.                                                   |
| `target_lang` | string | No       | `null`  | Target language for output content including summary, descriptions, and highlights (see [Supported Languages](https://wayin.ai/api-docs/supported-languages/)). When `null`, the output language matches `source_lang`. |

### Example Request

```bash
curl -X POST https://wayinvideo-api.wayin.ai/api/v2/summaries \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2" \
  -d '{
    "video_url": "https://www.youtube.com/watch?v=example",
    "target_lang": "en"
  }'
```

```python
import requests

requests.post(
    "https://wayinvideo-api.wayin.ai/api/v2/summaries",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "x-wayinvideo-api-version": "v2",
    },
    json={
        "video_url": "https://www.youtube.com/watch?v=example",
        "target_lang": "en",
    },
)
```

```javascript
await fetch('https://wayinvideo-api.wayin.ai/api/v2/summaries', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer YOUR_API_KEY',
    'x-wayinvideo-api-version': 'v2',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    video_url: 'https://www.youtube.com/watch?v=example',
    target_lang: 'en',
  }),
});
```

### Response

```json
{
  "data": {
    "id": "sum_proj_001",
    "name": "sample project name",
    "status": "CREATED"
  }
}
```

| Field    | Type   | Description                                           |
| -------- | ------ | ----------------------------------------------------- |
| `id`     | string | Task identifier (used in subsequent requests)         |
| `name`   | string | Task name                                             |
| `status` | string | `CREATED`, `QUEUED`, `ONGOING`, `SUCCEEDED`, `FAILED` |

---

## Examples

Common summarization scenarios. Replace `YOUR_API_KEY` with a key from the [API Dashboard](https://wayin.ai/wayinvideo/api-dashboard).

### Summarize a YouTube video

```bash
curl -X POST https://wayinvideo-api.wayin.ai/api/v2/summaries \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2" \
  -H "Content-Type: application/json" \
  -d '{"video_url": "https://www.youtube.com/watch?v=EXAMPLE"}'
```

### Summarize a long podcast episode

Multi-hour podcasts work the same way — submit and poll. The response includes timeline highlights so you can navigate hours of audio quickly.

```bash
curl -X POST https://wayinvideo-api.wayin.ai/api/v2/summaries \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2" \
  -H "Content-Type: application/json" \
  -d '{"video_url": "https://www.youtube.com/watch?v=EXAMPLE"}'
```

### Summarize a webinar in another language

Set `target_lang` to translate the summary, highlights, and descriptions into the target language even when the source video is in a different language.

```bash
curl -X POST https://wayinvideo-api.wayin.ai/api/v2/summaries \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2" \
  -H "Content-Type: application/json" \
  -d '{
    "video_url": "https://www.youtube.com/watch?v=EXAMPLE",
    "source_lang": "en",
    "target_lang": "ja"
  }'
```

---

## Get Summary Results

Retrieve the summary, highlights, and tags. Poll until `status` is `SUCCEEDED`.

```http
GET https://wayinvideo-api.wayin.ai/api/v2/summaries/results/{id}
```

### Path Parameters

| Parameter | Type   | Required | Description                                 |
| --------- | ------ | -------- | ------------------------------------------- |
| `id`      | string | Yes      | The task ID returned by the submit endpoint |

### Results Request

```bash
curl -X GET https://wayinvideo-api.wayin.ai/api/v2/summaries/results/sum_proj_001 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2"
```

### Results Response

```json
{
  "data": {
    "status": "SUCCEEDED",
    "title": "sample title",
    "video_thumbnail": "https://cdn.example.com/thumb/video_001.jpg",
    "summary": "sample summary text",
    "tags": ["#topic1", "#topic2", "#topic3"],
    "highlights": [
      {
        "start": 0,
        "end": 196000,
        "desc": "sample section title",
        "events": [
          {
            "timestamp": 160,
            "desc": "sample event description"
          },
          {
            "timestamp": 17920,
            "desc": "sample event description"
          }
        ]
      }
    ],
    "cost_usage": 54.0
  }
}
```

### Summary Response Fields

| Field             | Type     | Description                                           |
| ----------------- | -------- | ----------------------------------------------------- |
| `status`          | string   | `CREATED`, `QUEUED`, `ONGOING`, `SUCCEEDED`, `FAILED` |
| `error_message`   | string   | Error reason (only present when `status` is `FAILED`) |
| `title`           | string   | AI-generated title                                    |
| `video_thumbnail` | string   | Video thumbnail URL                                   |
| `summary`         | string   | Full text overview                                    |
| `tags`            | string[] | AI-generated hashtags                                 |
| `highlights`      | array    | Timeline highlight segments (see below)               |
| `cost_usage`      | number   | API units consumed for this request                   |

### Highlight Object

| Field    | Type   | Description                     |
| -------- | ------ | ------------------------------- |
| `start`  | number | Start time in milliseconds      |
| `end`    | number | End time in milliseconds        |
| `desc`   | string | Section title / description     |
| `events` | array  | Key events within the highlight |

### Event Object

| Field       | Type   | Description                |
| ----------- | ------ | -------------------------- |
| `timestamp` | number | Event time in milliseconds |
| `desc`      | string | Event description          |

---

## FAQ

### What is the maximum video length?

There is no hard length limit. The API supports both short clips and long-form videos, including podcast episodes, full-length webinars, lecture recordings, and live-stream replays.

### What does the summary response contain?

A structured overview, hashtags, and a timeline of highlight segments with start/end timestamps and descriptions. Highlights make it easy to render a timeline UI or auto-generate chapter markers.

### Can I get a summary in a different language than the source?

Yes — pass `target_lang` to translate the overview, descriptions, and highlights into the target language even when the source video is in a different language.

### Which video sources are supported?

URLs from YouTube, Vimeo, Dailymotion, Kick, Twitch, TikTok, Facebook, Zoom, Rumble and more, plus local file uploads via the [Upload API](https://wayin.ai/api-docs/upload/).
