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

# Get Generated Videos

> Retrieve a paginated list of all AI-generated videos

## Overview

This endpoint retrieves a paginated list of all AI-generated videos associated with your account. The results are sorted by creation date in descending order, with the most recent videos returned first. Each item includes the video URL, prompt, model, dimensions, duration, thumbnail images, and other metadata from the original generation request.

<Note>
  A valid API key is required to use this endpoint. Obtain your API key from the [API Access page](https://app.pictory.ai/api-access) in your Pictory dashboard.
</Note>

***

## API Endpoint

```http theme={null}
GET https://api.pictory.ai/pictoryapis/v1/aistudio/videos
```

***

## Request Parameters

### Headers

<ParamField header="Authorization" type="string" required>
  API key for authentication (starts with `pictai_`)

  ```
  Authorization: YOUR_API_KEY
  ```
</ParamField>

### Query Parameters

<ParamField query="nextPageKey" type="string">
  A pagination token returned in the previous response. Pass this value to retrieve the next page of results. Omit this parameter to fetch the first page.
</ParamField>

***

## Response

### Success Response (200)

<ResponseField name="items" type="array">
  An array of generated video objects, sorted by creation date (newest first). Up to 100 items are returned per page.

  <Expandable title="Video Object Properties">
    <ResponseField name="url" type="string">
      Direct download URL for the generated video file (MP4)
    </ResponseField>

    <ResponseField name="id" type="string">
      The unique identifier of the generated video
    </ResponseField>

    <ResponseField name="prompt" type="string">
      The text prompt that was used to generate this video
    </ResponseField>

    <ResponseField name="aspectRatio" type="string">
      The aspect ratio of the generated video (e.g., `"16:9"`, `"9:16"`, `"1:1"`)
    </ResponseField>

    <ResponseField name="createdDate" type="string">
      ISO 8601 timestamp of when the video was generated
    </ResponseField>

    <ResponseField name="model" type="string">
      The AI model that was used for generation (e.g., `"pixverse5.5"`, `"veo3.1"`)
    </ResponseField>

    <ResponseField name="width" type="number">
      Width of the generated video in pixels
    </ResponseField>

    <ResponseField name="height" type="number">
      Height of the generated video in pixels
    </ResponseField>

    <ResponseField name="duration" type="string">
      Duration of the generated video (e.g., `"8s"`)
    </ResponseField>

    <ResponseField name="previewImageUrl" type="string">
      URL for the video preview image (JPG)
    </ResponseField>

    <ResponseField name="thumbnailImageUrl" type="string">
      URL for the video thumbnail image (JPG)
    </ResponseField>

    <ResponseField name="lastFrameImageUrl" type="string">
      URL for the last frame of the video (PNG). This can be used as a `firstFrameImageUrl` in a subsequent generation request.
    </ResponseField>

    <ResponseField name="firstFrameImageUrl" type="string">
      The first frame image URL that was provided in the original request, if applicable
    </ResponseField>

    <ResponseField name="referenceImageUrls" type="array">
      The reference image URLs that were provided in the original request, if applicable
    </ResponseField>

    <ResponseField name="extendVideoUrl" type="string">
      The source video URL that was extended, if applicable
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="nextPageKey" type="string">
  A pagination token to retrieve the next page of results. This field is only present when additional pages are available. Pass this value as the `nextPageKey` query parameter in the next request.
</ResponseField>

### Response Examples

<ResponseExample>
  ```json 200 - Success theme={null}
  {
      "items": [
          {
              "url": "https://example.cloudfront.net/videos/user/a1b2c3d4-e5f6-7890-abcd-ef1234567890/d7c6b5a4-e3f2-1098-dcba-fedcba987654.mp4",
              "id": "20260409185104635ec00b33280fc451f",
              "prompt": "A woman sitting on the grass as children run and play around her in a wide shot",
              "aspectRatio": "9:16",
              "createdDate": "2026-04-09T18:51:47.967Z",
              "model": "pixverse5.5",
              "width": 720,
              "height": 1280,
              "duration": "8s",
              "previewImageUrl": "https://example.cloudfront.net/videos/user/a1b2c3d4-e5f6-7890-abcd-ef1234567890/d7c6b5a4-e3f2-1098-dcba-fedcba987654_preview.jpg",
              "thumbnailImageUrl": "https://example.cloudfront.net/videos/user/a1b2c3d4-e5f6-7890-abcd-ef1234567890/d7c6b5a4-e3f2-1098-dcba-fedcba987654_thumbnail.jpg",
              "lastFrameImageUrl": "https://example.cloudfront.net/videos/user/a1b2c3d4-e5f6-7890-abcd-ef1234567890/d7c6b5a4-e3f2-1098-dcba-fedcba987654_last_frame.png"
          },
          {
              "url": "https://example.cloudfront.net/videos/user/a1b2c3d4-e5f6-7890-abcd-ef1234567890/f8e7d6c5-b4a3-2190-fedc-ba0987654321.mp4",
              "id": "2026040918025436554deba0b339b4a01",
              "prompt": "A woman walking through an open field towards a farmhouse in the distance in a wide shot",
              "aspectRatio": "9:16",
              "createdDate": "2026-04-09T18:02:57.039Z",
              "model": "pixverse5.5",
              "width": 720,
              "height": 1280,
              "duration": "8s",
              "previewImageUrl": "https://example.cloudfront.net/videos/user/a1b2c3d4-e5f6-7890-abcd-ef1234567890/f8e7d6c5-b4a3-2190-fedc-ba0987654321_preview.jpg",
              "thumbnailImageUrl": "https://example.cloudfront.net/videos/user/a1b2c3d4-e5f6-7890-abcd-ef1234567890/f8e7d6c5-b4a3-2190-fedc-ba0987654321_thumbnail.jpg",
              "lastFrameImageUrl": "https://example.cloudfront.net/videos/user/a1b2c3d4-e5f6-7890-abcd-ef1234567890/f8e7d6c5-b4a3-2190-fedc-ba0987654321_last_frame.png",
              "referenceImageUrls": [
                  "https://example.cloudfront.net/videos/user/a1b2c3d4-e5f6-7890-abcd-ef1234567890/a9b8c7d6-e5f4-3210-abcd-ef9876543210_last_frame.png",
                  "https://example.cloudfront.net/images/user/a1b2c3d4-e5f6-7890-abcd-ef1234567890/1a2b3c4d-5e6f-7890-abcd-ef0123456789.png"
              ]
          }
      ],
      "nextPageKey": "eyJwYXJ0aXRpb25LZXkiOiJ1c2VyI..."
  }
  ```

  ```json 200 - Empty Result theme={null}
  {
      "items": []
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
      "message": "Unauthorized"
  }
  ```

  ```json 500 - Internal Server Error theme={null}
  {
      "message": "Internal Server Error"
  }
  ```
</ResponseExample>

***

## Status Codes

| Status Code | Description                                                                                                                                   |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| **200**     | Request processed successfully. The `items` array contains the generated videos. An empty array is returned if no videos have been generated. |
| **401**     | Unauthorized. The API key in the `Authorization` header is missing or invalid.                                                                |
| **500**     | Internal server error. Retry the request after a brief delay.                                                                                 |

***

## Response Fields

| Field                | Type   | Always Present | Description                                                              |
| -------------------- | ------ | -------------- | ------------------------------------------------------------------------ |
| `url`                | string | Yes            | Direct download URL for the generated video (MP4)                        |
| `id`                 | string | Yes            | Unique identifier of the generated video                                 |
| `prompt`             | string | Yes            | The text prompt used to generate the video                               |
| `aspectRatio`        | string | Yes            | Aspect ratio of the video (e.g., `"9:16"`)                               |
| `createdDate`        | string | Yes            | ISO 8601 creation timestamp                                              |
| `model`              | string | Yes            | AI model used for generation                                             |
| `width`              | number | Yes            | Video width in pixels                                                    |
| `height`             | number | Yes            | Video height in pixels                                                   |
| `duration`           | string | Yes            | Video duration (e.g., `"8s"`)                                            |
| `previewImageUrl`    | string | Yes            | Preview image URL (JPG)                                                  |
| `thumbnailImageUrl`  | string | Yes            | Thumbnail image URL (JPG)                                                |
| `lastFrameImageUrl`  | string | Yes            | Last frame image URL (PNG), useful for creating video continuations      |
| `firstFrameImageUrl` | string | No             | Present only if a first frame image was provided in the original request |
| `referenceImageUrls` | array  | No             | Present only if reference images were provided in the original request   |
| `extendVideoUrl`     | string | No             | Present only if the video was generated by extending another video       |

***

## Pagination

The API returns up to 100 videos per page. If more results are available, the response includes a `nextPageKey` field. To retrieve subsequent pages, pass this token as a query parameter in the next request.

**Example paginated request:**

```
GET https://api.pictory.ai/pictoryapis/v1/aistudio/videos?nextPageKey=eyJwYXJ0aXRpb25LZXkiOiJ1c2VyI...
```

When no `nextPageKey` is present in the response, you have reached the last page.

***

## Code Examples

<Tip>
  Replace `YOUR_API_KEY` with your actual API key from the [API Access page](https://app.pictory.ai/api-access).
</Tip>

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.pictory.ai/pictoryapis/v1/aistudio/videos' \
    --header 'Authorization: YOUR_API_KEY' \
    --header 'accept: application/json' | python -m json.tool
  ```

  ```python Python theme={null}
  import requests

  def get_all_videos(api_key):
      """
      Retrieve all generated videos with automatic pagination.
      """
      url = "https://api.pictory.ai/pictoryapis/v1/aistudio/videos"
      headers = {
          "Authorization": api_key,
          "accept": "application/json"
      }

      all_videos = []
      next_page_key = None

      while True:
          params = {}
          if next_page_key:
              params["nextPageKey"] = next_page_key

          response = requests.get(url, headers=headers, params=params)
          response.raise_for_status()

          data = response.json()
          items = data.get("items", [])
          all_videos.extend(items)

          print(f"Fetched {len(items)} videos (total: {len(all_videos)})")

          next_page_key = data.get("nextPageKey")
          if not next_page_key:
              break

      return all_videos

  # Usage
  videos = get_all_videos("YOUR_API_KEY")
  for video in videos:
      print(f"{video['createdDate']} - {video['model']} - {video['duration']} - {video['url']}")
  ```

  ```javascript JavaScript theme={null}
  async function getAllVideos(apiKey) {
    const url = 'https://api.pictory.ai/pictoryapis/v1/aistudio/videos';
    const allVideos = [];
    let nextPageKey = null;

    while (true) {
      const params = new URLSearchParams();
      if (nextPageKey) {
        params.set('nextPageKey', nextPageKey);
      }

      const requestUrl = params.toString()
        ? `${url}?${params.toString()}`
        : url;

      const response = await fetch(requestUrl, {
        method: 'GET',
        headers: {
          'Authorization': apiKey,
          'accept': 'application/json'
        }
      });

      const data = await response.json();
      const items = data.items || [];
      allVideos.push(...items);

      console.log(`Fetched ${items.length} videos (total: ${allVideos.length})`);

      nextPageKey = data.nextPageKey;
      if (!nextPageKey) break;
    }

    return allVideos;
  }

  // Usage
  const videos = await getAllVideos('YOUR_API_KEY');
  videos.forEach(video => {
    console.log(`${video.createdDate} - ${video.model} - ${video.duration} - ${video.url}`);
  });
  ```

  ```php PHP theme={null}
  <?php
  function getAllVideos($apiKey) {
      $url = "https://api.pictory.ai/pictoryapis/v1/aistudio/videos";
      $allVideos = [];
      $nextPageKey = null;

      while (true) {
          $requestUrl = $url;
          if ($nextPageKey) {
              $requestUrl .= "?nextPageKey=" . urlencode($nextPageKey);
          }

          $ch = curl_init($requestUrl);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, [
              'Authorization: ' . $apiKey,
              'accept: application/json'
          ]);

          $response = curl_exec($ch);
          curl_close($ch);

          $data = json_decode($response, true);
          $items = $data['items'] ?? [];
          $allVideos = array_merge($allVideos, $items);

          echo "Fetched " . count($items) . " videos (total: " . count($allVideos) . ")\n";

          $nextPageKey = $data['nextPageKey'] ?? null;
          if (!$nextPageKey) break;
      }

      return $allVideos;
  }

  // Usage
  $videos = getAllVideos('YOUR_API_KEY');
  foreach ($videos as $video) {
      echo "{$video['createdDate']} - {$video['model']} - {$video['duration']} - {$video['url']}\n";
  }
  ?>
  ```

  ```go Go theme={null}
  package main

  import (
      "encoding/json"
      "fmt"
      "io"
      "net/http"
      "net/url"
  )

  func getAllVideos(apiKey string) ([]map[string]interface{}, error) {
      baseURL := "https://api.pictory.ai/pictoryapis/v1/aistudio/videos"
      var allVideos []map[string]interface{}
      nextPageKey := ""

      for {
          requestURL := baseURL
          if nextPageKey != "" {
              requestURL = fmt.Sprintf("%s?nextPageKey=%s", baseURL, url.QueryEscape(nextPageKey))
          }

          req, _ := http.NewRequest("GET", requestURL, nil)
          req.Header.Set("Authorization", apiKey)
          req.Header.Set("accept", "application/json")

          client := &http.Client{}
          resp, err := client.Do(req)
          if err != nil {
              return nil, err
          }

          body, _ := io.ReadAll(resp.Body)
          resp.Body.Close()

          var data map[string]interface{}
          json.Unmarshal(body, &data)

          items, _ := data["items"].([]interface{})
          for _, item := range items {
              if video, ok := item.(map[string]interface{}); ok {
                  allVideos = append(allVideos, video)
              }
          }

          fmt.Printf("Fetched %d videos (total: %d)\n", len(items), len(allVideos))

          if key, ok := data["nextPageKey"].(string); ok && key != "" {
              nextPageKey = key
          } else {
              break
          }
      }

      return allVideos, nil
  }

  func main() {
      videos, err := getAllVideos("YOUR_API_KEY")
      if err != nil {
          fmt.Println("Error:", err)
          return
      }

      for _, video := range videos {
          fmt.Printf("%s - %s - %s - %s\n",
              video["createdDate"], video["model"], video["duration"], video["url"])
      }
  }
  ```
</CodeGroup>
