---
title: "Preview YouTube URL"
url: https://docs.gleap.ai/en/reference/rest-api/preview
method: POST
path: "/youtube-source/preview"
api: "API Reference"
tag: "AI content"
operationId: "Preview"
updatedAt: "2026-11-01T18:40:15.677Z"
language: en
---

# Preview YouTube URL

`POST https://api.gleap.io/v3/youtube-source/preview`

Preview a YouTube URL before importing. Fetches metadata + an exact cost estimate (in cents) for the video or full playlist/channel, and on the new terms the plan's YouTube allowance and whether the import fits. For large playlists this can take a few seconds; the client is expected to show a spinner.

## Authorization

- `Authorization` (header, required): `Bearer <token>`

## Headers

- `project` (string, required)

## Request body (`application/json`, required)

- `url` (string, required)

## Example request

```bash
curl --request POST \
  --url https://api.gleap.io/v3/youtube-source/preview \
  --header 'Authorization: Bearer <token>' \
  --header 'project: <project>' \
  --header 'Content-Type: application/json' \
  --data '{
  "url": "<url>"
}'
```

## Responses

### 200 (`application/json`)

Ok

```json
{
  "allowance": {
    "plan": "free",
    "period": "month",
    "allowanceSeconds": 0,
    "usedSeconds": 0,
    "remainingSeconds": 0,
    "resetsAt": "2026-01-01T12:00:00Z",
    "maxVideoSeconds": 0,
    "maxBatchVideos": 0,
    "fits": true,
    "message": "string",
    "requiredPlan": "starter",
    "firstFitting": {
      "estimatedCostCents": 0,
      "durationSeconds": 0,
      "videoCount": 0
    },
    "tooLongCount": 0,
    "unavailableCount": 0,
    "balanceMessage": "string"
  },
  "estimatedCostCents": 0,
  "video": {
    "videoId": "string",
    "title": "string",
    "durationSeconds": 0,
    "thumbnailUrl": "string",
    "channelName": "string",
    "privacyStatus": "string",
    "alreadyImported": true
  },
  "type": "video"
}
```
