Migration guide
This guide shows how to migrate your applications to the 1.3 version of the API, which introduces significant improvements to the video understanding capabilities of the platform, simplified modalities, and a streamlined endpoint structure.
Note
All changes described in this guide apply to the 1.3 version of the API. Features marked as deprecated, renamed, or removed are unavailable in v1.3 but remain functional in v1.2 until further notice. The only exception is the Classify API, which will be deprecated in v1.2 on Feb 28, 2025.
What's new in v1.3?
- Marengo 2.7: A new version of the Marengo video understanding model has been released. The 1.3 version of the API version only supports Marengo 2.7. This new version improves accuracy and performance in the following areas:
- Multimodal processing that combines visual, audio, and text elements.
- Fine-grained image-to-video search: detect brand logos, text, and small objects (as small as 10% of the video frame).
- Improvement in motion search capability.
- Counting capabilities.
- More nuanced audio comprehension: music, lyrics, sound, and silence.
- Simplified modalities:
visual
: includes objects, actions, text OCR, logos.audio
: includes speech, music, and ambient sounds.conversation
has been deprecated.text_in_video
andlogo
are now part ofvisual
.
- Streamlined endpoint structure: Several endpoints and parameters have been deprecated, removed, or renamed.
Note
This guide presents the changes to the API. Since the SDKs reflect the structure of the API, review the Migration examples section below and the relevant SDK reference sections to understand how these changes have been implemented:
Breaking changes
This section presents the changes that require updates to your code and includes the following subsections:
- Global changes that affect multiple endpoints
- Changes organized by endpoint and functionality (example: upload videos, manage indexes, etc.)
In the sections below, see the Required Action column for each change, then use the corresponding example in the Migration examples section to update your code.
Global changes
Description | Required action |
---|---|
Marengo 2.7 generates embeddings that are not backward compatible. | Reindex all your videos and regenerate all your embeddings with Marengo 2.7. |
The 1.3 version of the API version only supports Marengo 2.7. | Update the version strings in your code. For indexes, use "marengo2.7" instead of "marengo2.6". For embeddings, use "marengo-retrieval-2.7" instead of "marengo-retrieval-2.6". For examples of using Marengo 2.7, see the Create indexes and Create emeddings sections below. |
The following parameters and fields in the responses have been renamed: - engines → models - engine_name → model_name - engine_options → model_options | Update parameter names and response parsing in your code. For an example of using these parameters , see the Create indexes section below. |
The previous modalities of [visual , conversation , text_in_video , logo ] have been simplified to [visual , audio ]. | Update parameter names and response parsing in your code: - conversation -> audio - Remove logo and text_in_video .Note that, while logo and text_in_video have been deprecated, no functionality has been removed. To achieve the same outcome, see the Detect logos and Search for text shown in videos sections below.NOTE: For indexes created with Marengo v2.6, the /indexes endpoints continue to return the legacy modality values (text_in_video , logo , and conversation ). You cannot perform any downstream tasks on these indexes.For examples of using the new values, see the Create indexes and Perform a search requests sections below. |
The /search-v2 endpoint becomes the new /search endpoint. | If you're using an HTTP client to interact with the API, update all search requests to use the new /search endpoint, which now supports both text and image queries.No action is required if you're using one of the official SDKs. |
Deprecated endpoints
Endpoint | Required action |
---|---|
/classify | You can no longer use this endpoint. Twelve Labs recommends classifying videos using the text generation capabilities of the platform. For details, see the Use Pegasus to classify videos section. |
- /engines - /engines/{engine-id} | Update your code, removing any calls to these endpoints. |
- /indexes/{index-id}/videos/{video-id}/text-in-video - /indexes/{index-id}/videos/{video-id}/logo - /indexes/{index_id}/videos/{video_id}/thumbnail - /indexes/{index-id}/videos/{video-id}/transcription | You can no longer use these endpoints. Twelve Labs recommends updating your code by replacing any calls to the specified endpoints with the alternative options provided below: - Text in video: Search using text queries. For details, see the Search for text shown in videos section. - Logos: Search using text or image queries to detect logos. For details see the Detect logos section. - Thumbnails: The /search endpoint returns thumbnails for each results. You can use them in your application.- Transcriptions: Search using text queries. For details, see the Search for text shown in videos section. |
/search/combined | You can no longer use this endpoint. Twelve Labs recommends updating your code to use the new /search endpoint instead of /search/combined . |
Upload videos
Method | Description | Required action |
---|---|---|
POST /tasks | The disable_video_stream parameter has been renamed to enable_video_stream . The default value is true . | - Find and replace all occurences of disable_video_stream with enable_video_stream - Review your logic - no need to set the enable_video_stream parameter if you want to enable streaming. |
GET /tasks | The following parameters have been deprecated: - id - estimated_time | Update your code - you no longer can filter tasks based on these parameters. |
Manage indexes
Method | Description | Required action |
---|---|---|
GET /indexes/{index-id} | The _id parameter has been deprecated. | Update your code - you no longer can filter videos based on this parameter. |
Manage videos
Method | Description | Required action |
---|---|---|
GET /indexes/{index-id}/videos | The metadata parameter has been renamed to user_metadata | Update your code to use user_metadata instead of metadata . |
GET /indexes/{index-id}/videos | The metadata field in the response has been renamed to system_metadata | Update your code to use system_metadata instead of metadata . |
GET /indexes/{index-id}/videos/{video-id} | The metadata field in the response has been renamed to system_metadata | Update your code to use system_metadata instead of metadata . |
Search
Method | Description | Required action |
---|---|---|
POST /search | The conversation_option parameter has been deprecated. | Remove conversation_option  from your search requests . |
- POST /search - GET /search/{page-token} | The page_info.page_expired_at field in the response has been renamed to page_info.page_expires_at . | Update your code to use page_expires_at instead of page_expired_at . |
- POST /search - GET /search/{page-token} | The metadata and modules fields in the response have been deprecated. | Update your code - the platform no longer returns these fields. |
Generate text from video
Method | Description | Required action |
---|---|---|
POST /generate | The stream parameter now defaults to true . | Review your logic. Set the stream parameter to false to turn off streaming responses. Otherwise, the platform will stream responses. |
Non-breaking changes
These changes add new functionality while maintaining backward compatibility.
Upload videos
Migration steps
Migrating to v1.3 involves two main steps:
- Update your integration
- Use the migration examples to update your code.
1. Update your integration
Choose the appropriate method based on how you interact with the Twelve Labs API:
- Official SDKs: Install the latest version that supports v1.3.
- HTTP client: Update your base URL.
pip3 install twelvelabs --upgrade
npm install twelvelabs-js@latest
API_URL="https://api.twelvelabs.io/v1.3"
2. Migration examples
Below are examples showing how to update your code for key breaking changes. Choose the examples matching your integration type.
Create indexes
Creating an index in version 1.3 includes the following key changes:
- Renamed parameters: The parameters that previously began with
engine*
have now been renamed tomodel*
. - Simplified modalities: The previous modalities of [
visual
,conversation
,text_in_video
,logo
] have been simplified to [visual
,audio
]. - Marengo version update: Use "marengo2.7" instead of "marengo2.6".
models = [
{
"name": "marengo2.7",
"options": ["visual", "audio"]
},
{
"name": "pegasus1.1",
"options": ["visual", "audio"]
}
]
index = client.index.create(
name="<YOUR_INDEX_NAME>",
models=models,
addons=["thumbnail"] # Optional
)
const models = [
{
name: 'marengo2.7',
options: ['visual', 'audio'],
},
{
name: 'pegasus1.1',
options: ['visual', 'audio'],
},
];
let index = await client.index.create({
name: '<YOUR_INDEX_NAME>',
models: models,
addons: ['thumbnail'], // Optional
});
curl --request POST \
--url https://api.twelvelabs.xyz/v1.3/indexes \
--header 'Content-Type: application/json' \
--header 'x-api-key: <YOUR_API_KEY>' \
--data '{
"models": [
{
"model_name": "marengo2.7",
"model_options": ["visual", "audio"]
},
{
"model_name": "pegasus1.1",
"model_options": ["visual", "audio"]
}
],
"addons": ["thumbnail"],
"index_name":"<YOUR_INDEX_NAME>"
}'
Perform a search request
Performing a search request includes the following key changes:
- Simplified modalities: The previous modalities of [
visual
,conversation
,text_in_video
,logo
] have been simplified to [visual
,audio
]. - Deprecated parameter: The
conversation_option
parameter has been deprecated. - Streamlined response: The
metadata
andmodules
fields in the response have been deprecated.
search_results = client.search.query(
index_id="<YOUR_INDEX_ID>",
query_text="<YOUR_QUERY>",
options=["visual", "audio"]
)
let searchResults = await client.search.query({
indexId: '<YOUR_INDEX_ID>'
queryText: '<YOUR_QUERY>',
options: ['visual'],
});
curl --request POST \
--url https://api.twelvelabs.xyz/v1.3/search \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <YOUR_API_KEY>' \
--form index_id=<YOUR_INDEX_ID> \
--form search_options=visual \
--form search_options=conversation \
--form 'query_text=<YOUR_QUERY>'
Create embeddings
Creating embeddings includes the following key changes:
- Marengo version update: Use "Marengo-retrieval-2.7" instead of "Marengo-retrieval-2.6".
- Renamed parameter: The parameters that previously began with
engine*
have now been renamed tomodel*
.
The following example creates a text embedding, but the principles demonstrated are similar for image, audio, and video embeddings:
res = client.embed.create(
model_name="Marengo-retrieval-2.7",
text="<YOUR_TEXT>",
)
let res = await client.embed.create({
modelName: "Marengo-retrieval-2.7",
text: "<YOUR_TEXT>",
});
curl --request POST \
--url https://api-dev.twelvelabs.xyz/v1.3/embed \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <YOUR_API_KEY' \
--form model_name=Marengo-retrieval-2.7 \
--form 'text=<YOUR_TEXT>t'
Use Pegasus to classify videos
The Pegasus video understanding model offers flexible video classification through its text generation capabilities. You can use established category systems like YouTube video categories or IAB Tech Lab Content Taxonomy . You can also define custom categories for your specific needs.
The example below classifies a video based on YouTube's video categories:
res = client.generate.text(
video_id="<YOUR_VIDEO_ID>",
prompt="Classify this video using up to five labels from YouTube standard content categories. Provide the results in the JSON format."
)
const text = await client.generate.text(
'<YOUR_VIDEO_ID>',
'Classify this video using up to five labels from YouTube standard content categories. Provide the results in the JSON format.',
);
curl --request POST \
--url https://api.twelvelabs.xyz/v1.2/generate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <YOUR_API_KEY>' \
--data '{
"video_id": "<YOUR_VIDEO_ID>",
"prompt": "Classify this video using up to five labels from YouTube standard content categories. Provide the results in the JSON format."
}'
Detect logos
You can search for logos using text or image queries:
- Text queries: For logos that include text (example: Nike)
- Image queries: For logos without text (example: Apple's apple symbol).
The following example searches for the Nike logo using a text query:
search_results = client.search.query(
index_id="<YOUR_INDEX_ID>",
query_text="Nike",
options=["visual"]
)
let searchResults = await client.search.query({
indexId: '<YOUR_INDEX_ID>'
queryText: 'Nike',
options: ['visual'],
});
curl --request POST \
--url https://api.twelvelabs.xyz/v1.3/search \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <YOUR_API_KEY>' \
--form index_id=<YOUR_INDEX_ID> \
--form search_options=visual \
--form search_options=conversation \
--form 'query_text=Nike'
The following example searches for the Apple logo using an image query:
search_results = client.search.query(
index_id="<YOUR_INDEX_ID>",
query_media_type="image",
query_media_url="https://logodownload.org/wp-content/uploads/2013/12/apple-logo-16.png,
options=["visual"]
)
let searchResults = await client.search.query({
indexId: '<YOUR_INDEX_ID>',
queryMediaType: 'image',
queryMediaUrl: 'https://logodownload.org/wp-content/uploads/2013/12/apple-logo-16.png',
options: ['visual']
});
curl --request POST \
--url https://api.twelvelabs.io/v1.3/search \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <YOUR_API_KEY>' \
--form index_id=<YOUR_INDEX_ID> \
--form search_options=visual \
--form query_media_type=image \
--form query_media_url=https://logodownload.org/wp-content/uploads/2013/12/apple-logo-16.png
Search for text shown in videos
To search for text in videos, use text queries that target either on-screen text or spoken words in transcriptions rather than objects or concepts. The platform searches across both:
- Text shown on screen (such as titles, captions, or signs)
- Spoken words from audio transcriptions
Note that the platform may return both textual and visual matches. For example, searching for the word "smartphone" might return:
- Segments where "smartphone" appears as on-screen text.
- Segments where "smartphone" is spoken.
- Segments where smartphones are visible as objects.
The example below finds all the segments where the word "innovation" appears as on-screen text or as a spoken word in transcriptions:
search_results = client.search.query(
index_id="<YOUR_INDEX_ID>",
query_text="Innovation",
options=["visual"]
)
let searchResults = await client.search.query({
indexId: '<YOUR_INDEX_ID>'
queryText: 'Innovation',
options: ['visual'],
});
curl --request POST \
--url https://api.twelvelabs.xyz/v1.2/generate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <YOUR_API_KEY>' \
--data '{
"video_id": "<YOUR_VIDEO_ID>",
"prompt": "Innovation"
}'
Additional resources
Updated 2 days ago