This guide shows how you can upload videos from external providers. Currently, only YouTube is supported, but we will add support for additional providers in the future.

For a description of each field in the request and response, see the [API Reference > Upload from external providers](🔗) page.

# Prerequisites

  • You’re familiar with the concepts that are described on the [Platform overview](🔗) page.

  • You’ve created an index, and the unique identifier of your index is stored in a variable named `INDEX_ID`. For details, see the [Create indexes](🔗) page.

  • The video that you want to upload must be embeddable.

  • The URL of the video that you want to upload is stored in a variable named `VIDEO_URL`.

  • Your video must meet the following requirements:

    • **Video resolution**: Must be greater or equal than 360p and less or equal than 4K. For consistent search results, Twelve Labs recommends you upload 360p videos.

    • **Duration**: For Marengo, it must be between 4 seconds and 2 hours (7,200s). For Pegasus, it must be between 5 seconds and 30 minutes (1800s).

    • **File size**: Must not exceed 2 GB. If you require different options, email us at [[email protected]](🔗).

    • **Audio track**: If the `conversation` [engine option](🔗) is selected, the video you're uploading must contain an audio track.

# Procedure

  1. Declare the [`/tasks/external-provider`](🔗) endpoint:

    
  2. Declare a dictionary named `data` and use it to store the unique identifier of the index to which you want to upload the video and the URL of the video:

    
  3. To upload the video, call the [`POST`](🔗) method of the `/tasks/external-provider` endpoint and store the result in a variable named `response`:

    
  4. Store the unique identifier of your video indexing task in a variable named `TASK_ID` and print the status code and response:

    

    The output should look similar to the following one:

    
  5. _(Optional)_ You can use the [`GET`](🔗) method of the `/tasks/{_id}` endpoint to monitor the indexing process. Construct the URL for retrieving the status of your video indexing task based on the `TASK_ID` variable you’ve declared in the previous step, and wait until the status shows as `ready`:

    

    Notes

    • For details about the possible statuses, see the [Tasks](🔗) page.

    • You can also use webhooks to monitor the status of the indexing process. For details, see the [Webhooks](🔗) section.

  6. _(Optional)_ Store the unique identifier of your video in a variable named `VIDEO_ID`:

    
  7. _(Optional)_ Print the unique identifier of your video, the status code, and the response:

    

    The output should look similar to the following one: