> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.twelvelabs.io/v1.3/api-reference/create-embeddings-v2/create-async-embedding-task/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.twelvelabs.io/_mcp/server. # Create an async embedding task POST https://api.twelvelabs.io/v1.3/embed-v2/tasks Content-Type: application/json This method creates embeddings for audio, video, images, and documents asynchronously. Use this method to embed content at scale, such as long files or the media files you want to make searchable. For a query, or for results you need in the same request, use the [`POST`](/v1.3/api-reference/create-embeddings-v2/create-embeddings) method of the `/embed-v2` endpoint instead. The content this method accepts depends on the model. Both models embed audio and video. Marengo 3.5 also embeds images and documents: PDF, plain text, and Markdown files. For the formats, resolutions, file sizes, and duration limits each model accepts, see the input requirements for [Marengo 3.5](/v1.3/docs/concepts/models/marengo/marengo-3-5#input-requirements) or [Marengo 3.0](/v1.3/docs/concepts/models/marengo/marengo-3-0#input-requirements). Creating embeddings asynchronously requires three steps: 1. Create a task using this method. The platform returns a task identifier. 2. Poll for the status of the task using the [`GET`](/v1.3/api-reference/create-embeddings-v2/retrieve-embeddings) method of the `/embed-v2/tasks/{task_id}` endpoint. Wait until the status is `ready`. 3. Retrieve the embeddings from the response when the status is `ready` using the [`GET`](/v1.3/api-reference/create-embeddings-v2/retrieve-embeddings) method of the `/embed-v2/tasks/{task_id}` endpoint. * Creating a task validates only basic metadata and, for audio and video sources, playability, not the full file. A file can pass this check but still fail later during embedding. When you retrieve the results, check the [`status`](/v1.3/api-reference/create-embeddings-v2/retrieve-embeddings#response.body.status) field. If it is `failed`, the [`error.message`](/v1.3/api-reference/create-embeddings-v2/retrieve-embeddings#response.body.error.message) field contains the reason. * This method is rate-limited. With Marengo 3.5, the platform counts input tokens for each type of content. A task can exceed a limit before you see an error. For details, see [Input token limits for embedding](/v1.3/docs/get-started/rate-limits#input-token-limits-for-embedding). * Embeddings are stored for seven days. Reference: https://docs.twelvelabs.io/api-reference/create-embeddings-v2/create-async-embedding-task ## Authentication - `x-api-key` header (required) — Your API key. You can find your API key on the API Keys page. ## Request ### Body (application/json) This endpoint expects a CreateAsyncEmbeddingRequest. - `input_type` (enum, required) — The type of content for the embeddings. **Values**: - `audio`: An audio file. - `video`: A video file. - `document`: A PDF, plain text, or Markdown file. Requires Marengo 3.5. - `image`: An image file. Requires Marengo 3.5. - Allowed values: `audio`, `video`, `document`, `image` - `model_name` (enum, required, default: marengo3.0) — The embedding model to use. **Values**: - `marengo3.5`: For details about this version, see the [Marengo 3.5](/v1.3/docs/concepts/models/marengo/marengo-3-5) page. - `marengo3.0`: For details about this version, see the [Marengo 3.0](/v1.3/docs/concepts/models/marengo/marengo-3-0) page. - Allowed values: `marengo3.0`, `marengo3.5` - `embedding_uncertainty` (boolean, optional, default: false) — Set this parameter to `true` to include a per-dimension uncertainty vector in the [`data[].embedding_uncertainty`](/v1.3/api-reference/create-embeddings-v2/retrieve-embeddings#response.body.data.embedding-uncertainty) field of the result. The vector has the same length as the `embedding` array. A higher value indicates lower confidence in that dimension. Requires Marengo 3.5. **Requirements**: - For audio or video input, set the `embedding_scope` field to exclude `asset`. For example, set the `video.embedding_scope` field to `["clip"]`. The field defaults to `["clip", "asset"]`, so the platform returns a `400` error if you keep the default. This requirement does not apply to image input. - For a PDF document, the platform returns a `400` error regardless of the `document.embedding_scope` value. - For a plain text or Markdown document, set the `document.embedding_scope` field to `["local"]`. Any other value returns a `400` error. - `embedding_dimension` (enum, optional) — The number of dimensions for each embedding that the task produces, including the [`data[].embedding_uncertainty`](/v1.3/api-reference/create-embeddings-v2/retrieve-embeddings#response.body.data.embedding-uncertainty) vector. Marengo 3.5 produces Matryoshka embeddings: a shorter embedding consists of the first values of the full-length embedding. A 256-dimension embedding, for example, is the first 256 values of a 512-dimension embedding of the same content. Shorter embeddings reduce index size and speed up similarity search; longer embeddings produce higher retrieval quality. **Requirements**: - Requires Marengo 3.5. Setting this parameter with `model_name: marengo3.0` returns a `400` error. - Applies to the entire task: you cannot set it for a single input type or embedding. - Set it once, when you create the task. To use a different value, create a new task. - Use the same value across an index. **Default**: 512 - Allowed values: `128`, `256`, `512` - `audio` (AsyncAudioInputRequest, optional) — This field is required if the `input_type` parameter is `audio`. Base64-encoded audio can be up to 36 MB decoded. For a larger file, provide a URL or an asset identifier. - `video` (AsyncVideoInputRequest, optional) — This field is required if the `input_type` parameter is `video`. Base64-encoded video can be up to 36 MB decoded. For a larger file, provide a URL or an asset identifier. - `document` (AsyncDocumentInputRequest, optional) — This field is required if the `input_type` parameter is `document`. Requires Marengo 3.5. The platform accepts PDF (`.pdf`), plain text (`.txt`), and Markdown (`.md`) files. The decoded file can be up to 512 MB. It embeds a PDF file from its rendered pages or from its extracted text, and a plain text or Markdown file from its text. A PDF file also has a page allowance: 64 pages for each MB of file size. A 0.5 MB file is allowed 64 pages, and a 4 MB file is allowed 256 pages. The `quadrants` strategy counts each page five times against this allowance. The platform checks the page count of the file against the allowance before processing the file. If the file exceeds the allowance, the platform creates the task and sets its `status` field to the `failed` value. The `error.message` field contains the page count and the allowance. Plain text and Markdown files have no page allowance. The `embedding_option` and `embedding_scope` fields combine, and the platform supports the following combinations. | File type | `embedding_option` | `embedding_scope` | Result | |-----------|--------------------|-------------------|--------| | PDF | `visual` | `local` | One embedding for each rendered page. The default for PDF files. | | PDF | `visual` | `asset` | One embedding for the entire file. | | PDF | `text` | `asset` | One embedding for the extracted text of the entire file. | | Plain text, Markdown | `text` | `asset` | One embedding for the entire file. The default for plain text and Markdown files. | | Plain text, Markdown | `text` | `local` | One embedding for each chunk of whole sentences. Requires the `segmentation.sequential` field. | You can request more than one combination at a time. For example, `embedding_scope: ["local", "asset"]` on a PDF file returns the per-page embeddings and the whole-file embedding together. The platform pairs each value in one field with each value in the other. Each pair must appear in this table; if you send a pair outside it, the platform returns a `400` error. If you omit a field, the platform uses its default value. If you embed a PDF file with `embedding_option: ["text"]`, also set `embedding_scope: ["asset"]`. For PDF files, the default `["local"]` pairs with only the `visual` option. - `image` (AsyncImageInputRequest, optional) — This field is required if the `input_type` parameter is `image`. Requires Marengo 3.5. The decoded file can be up to 32 MB. For an image, the `embedding_option`, `embedding_type`, and `embedding_scope` fields each accept a single value; the platform returns a `400` error if you send any other value. ## Response ### 202 An embedding task has successfully been created. - `_id` (string, required) — The unique identifier of the embedding task - `status` (enum, required) — The initial status of the embedding task. - Allowed values: `processing` - `data` (list of EmbeddingData, optional, nullable) — An array of embedding results when `status` is `ready`, or `null` when `status` is `processing` or `failed`. - `metadata` (EmbedV2TasksPostResponsesContentApplicationJsonSchemaMetadata, optional) — Metadata about the task you created. The platform sets the length of your embeddings when it creates the task, and the `embedding_dimension` field contains that length. Only Marengo 3.5 returns it. ## Errors ### 400 Bad Request Error Validation failure or inaccessible asset - `error` (ErrorResponseError, required) ### 429 Too Many Requests Error You have exceeded a rate limit, and the platform has not processed the request. For an asynchronous submission, no task has been created. For an input token limit, an earlier request exceeds it. That request completes normally, returning its embeddings or finishing as a task. The platform returns the error for the requests that follow. The `X-Ratelimit-Dimensions` header lists the limits the request was checked against. The `Retry-After` header contains the number of seconds to wait. - `error` (ErrorResponseError, required) ### 500 Internal Server Error Internal server error - `error` (ErrorResponseError, required) ## Types ### AsyncAudioInputRequest This field is required if the `input_type` parameter is `audio`. Base64-encoded audio can be up to 36 MB decoded. For a larger file, provide a URL or an asset identifier. - `media_source` (MediaSource, required) — An object specifying the source of the media file. You must provide exactly one of `url`, `base64_string`, or `asset_id`. - `start_sec` (double, optional) — The start time in seconds for processing the audio file. Use this parameter to process a portion of the audio file starting from a specific time. **Default**: 0 (start from the beginning). - `end_sec` (double, optional) — The end time in seconds for processing the audio file. Use this parameter to process a portion of the audio file ending at a specific time. The end time must be greater than the start time. **Default**: End of the audio file - `segmentation` (AsyncAudioInputRequestSegmentation, optional) — Specifies how the platform divides the audio into segments. The structure of this object depends on the model version: - **With Marengo 3.5**: Place your settings in the `temporal` object. Both strategies are available: `dynamic` divides the audio into variable-length segments that follow scene changes, and `fixed` divides it into equal-length segments. Default: `temporal.dynamic`, `min_duration_sec: 2`. - **With Marengo 3.0**: Provide the settings directly in this object. Only `fixed` segmentation is available. Default: `fixed`, `duration_sec: 6`. If you use a structure that does not match your model version, the platform returns a `400` error. - `embedding_option` (list of enum, optional) — The types of embeddings you wish to generate. **Values**: - `audio`: Generates embeddings based on audio content (sounds, music, effects). With Marengo 3.5, this value includes speech, music, and non-dialog audio. - `transcription`: Generates embeddings based on transcribed speech. Requires Marengo 3.0. You can specify multiple values to generate different types of embeddings for the same audio. **Default**: `["audio", "transcription"]` for Marengo 3.0; `["audio"]` for Marengo 3.5. - Allowed values: `audio`, `transcription` - `embedding_scope` (list of enum, optional) — The scope for which you wish to generate embeddings. **Values**: - `clip`: Generates one embedding for each segment. Works with both Marengo 3.0 and Marengo 3.5. - `local`: Generates one embedding for each segment. Equivalent to `clip` when using Marengo 3.5. - `asset`: Generates one embedding for the entire audio file You can specify multiple scopes to generate embeddings at different levels. **Default**: `["clip", "asset"]` - Allowed values: `clip`, `local`, `asset` - `embedding_type` (list of enum, optional) — Specifies how to structure the embedding. Include this parameter only when the `embedding_option` parameter contains at least two values. **Values**: - `separate_embedding`: Returns separate embeddings for each modality specified in the `embedding_option` parameter. - `fused_embedding`: Returns a single combined embedding that integrates all modalities into one vector. With Marengo 3.5, this value requires the `time_based_metadata` field. Specify both values to receive separate and fused embeddings in the same response. **Default**: `separate_embedding`. - Allowed values: `separate_embedding`, `fused_embedding` - `time_based_metadata` (list of TimeBasedMetadataEntry, optional) — Your own time-aligned text, such as a stats feed or scene descriptions. The platform folds each entry into the fused embedding of the segments it overlaps in time, and it affects only that embedding. Requires the `fused_embedding` value in the `embedding_type` field. This field is supported only with Marengo 3.5. ### AsyncVideoInputRequest This field is required if the `input_type` parameter is `video`. Base64-encoded video can be up to 36 MB decoded. For a larger file, provide a URL or an asset identifier. - `media_source` (MediaSource, required) — An object specifying the source of the media file. You must provide exactly one of `url`, `base64_string`, or `asset_id`. - `start_sec` (double, optional) — The start time in seconds for processing the video file. Use this parameter to process a portion of the video file starting from a specific time. **Default**: 0 (start from the beginning) - `end_sec` (double, optional) — The end time in seconds for processing the video file. Use this parameter to process a portion of the video file ending at a specific time. The end time must be greater than the start time. **Default**: End of the video file - `segmentation` (AsyncVideoInputRequestSegmentation, optional) — Specifies how the platform divides the video into segments. The structure of this object depends on the model version: - **With Marengo 3.5**: Place your settings in the `temporal` object. Both strategies are available: `dynamic` divides the video into variable-length segments that follow scene changes, and `fixed` divides it into equal-length segments. Default: `temporal.dynamic`, `min_duration_sec: 2`. - **With Marengo 3.0**: Provide the settings directly in this object. Default: `dynamic`, `min_duration_sec: 4`. If you use a structure that does not match your model version, the platform returns a `400` error. - `embedding_option` (list of enum, optional) — The types of embeddings to generate for the video. **Values**: - `visual`: Generates embeddings based on visual content (scenes, objects, actions) - `audio`: Generates embeddings based on audio content (sounds, music, effects). With Marengo 3.5, this value includes speech, music, and non-dialog audio. - `transcription`: Generates embeddings based on transcribed speech. Requires Marengo 3.0. You can specify multiple values to generate different types of embeddings for the same video. **Default**: `["visual", "audio", "transcription"]` for Marengo 3.0; `["visual", "audio"]` for Marengo 3.5. - Allowed values: `visual`, `audio`, `transcription` - `embedding_scope` (list of enum, optional) — The scope for which you wish to generate embeddings. **Values**: - `clip`: Generates one embedding for each segment. Works with both Marengo 3.0 and Marengo 3.5. - `local`: Generates one embedding for each segment. Equivalent to `clip` when using Marengo 3.5. - `asset`: Generates one embedding for the entire video file. Use this scope for videos up to 10-30 seconds to maintain optimal performance. You can specify multiple scopes to generate embeddings at different levels. **Default**: `["clip", "asset"]` - Allowed values: `clip`, `local`, `asset` - `embedding_type` (list of enum, optional) — Specifies how to structure the embedding. Include this parameter only when the `embedding_option` parameter contains at least two values. **Values**: - `separate_embedding`: Returns separate embeddings for each modality specified in the `embedding_option` parameter. - `fused_embedding`: Returns a single combined embedding that integrates all modalities into one vector. With Marengo 3.5, this value requires the `time_based_metadata` field. Specify both values to receive separate and fused embeddings in the same response. **Default**: `separate_embedding`. - Allowed values: `separate_embedding`, `fused_embedding` - `time_based_metadata` (list of TimeBasedMetadataEntry, optional) — Your own time-aligned text, such as a stats feed or scene descriptions, which you can generate by [segmenting a video with Pegasus](/v1.3/docs/guides/segment-videos). The platform folds each entry into the fused embedding of the segments it overlaps in time, and it affects only that embedding. Requires the `fused_embedding` value in the `embedding_type` field. This field is supported only with Marengo 3.5. ### AsyncDocumentInputRequest This field is required if the `input_type` parameter is `document`. Requires Marengo 3.5. The platform accepts PDF (`.pdf`), plain text (`.txt`), and Markdown (`.md`) files. The decoded file can be up to 512 MB. It embeds a PDF file from its rendered pages or from its extracted text, and a plain text or Markdown file from its text. A PDF file also has a page allowance: 64 pages for each MB of file size. A 0.5 MB file is allowed 64 pages, and a 4 MB file is allowed 256 pages. The `quadrants` strategy counts each page five times against this allowance. The platform checks the page count of the file against the allowance before processing the file. If the file exceeds the allowance, the platform creates the task and sets its `status` field to the `failed` value. The `error.message` field contains the page count and the allowance. Plain text and Markdown files have no page allowance. The `embedding_option` and `embedding_scope` fields combine, and the platform supports the following combinations. | File type | `embedding_option` | `embedding_scope` | Result | |-----------|--------------------|-------------------|--------| | PDF | `visual` | `local` | One embedding for each rendered page. The default for PDF files. | | PDF | `visual` | `asset` | One embedding for the entire file. | | PDF | `text` | `asset` | One embedding for the extracted text of the entire file. | | Plain text, Markdown | `text` | `asset` | One embedding for the entire file. The default for plain text and Markdown files. | | Plain text, Markdown | `text` | `local` | One embedding for each chunk of whole sentences. Requires the `segmentation.sequential` field. | You can request more than one combination at a time. For example, `embedding_scope: ["local", "asset"]` on a PDF file returns the per-page embeddings and the whole-file embedding together. The platform pairs each value in one field with each value in the other. Each pair must appear in this table; if you send a pair outside it, the platform returns a `400` error. If you omit a field, the platform uses its default value. If you embed a PDF file with `embedding_option: ["text"]`, also set `embedding_scope: ["asset"]`. For PDF files, the default `["local"]` pairs with only the `visual` option. - `media_source` (MediaSource, required) — An object specifying the source of the media file. You must provide exactly one of `url`, `base64_string`, or `asset_id`. - `segmentation` (DocumentSegmentation, optional) — Specifies how the platform divides your document before it generates embeddings. Requires Marengo 3.5. Use the `spatial` field to divide each rendered page of a PDF file. Use the `sequential` field to divide a plain text or Markdown file into chunks. Provide the field that matches your file. If you provide neither field, the platform returns a `400` error. - `embedding_option` (list of enum, optional) — The types of embeddings to generate for the document. **Values**: - `visual`: Generates embeddings from the rendered pages. Valid for PDF files. - `text`: Generates embeddings from the text content. Valid for PDF, plain text, and Markdown files. **Default**: `["visual"]` for PDF files; `["text"]` for plain text and Markdown files. - Allowed values: `visual`, `text` - `embedding_type` (list of enum, optional) — Specifies how to structure the embedding. **Values**: - `separate_embedding`: Returns one embedding per requested `embedding_scope`. - `fused_embedding`: The platform returns a `400` error if you set this value. Documents have a single modality. **Default**: `separate_embedding`. - Allowed values: `separate_embedding`, `fused_embedding` - `embedding_scope` (list of enum, optional) — The scope for which you wish to generate embeddings. **Values**: - `local`: Returns one embedding for each part of the file. - For a PDF file, each part is a rendered page. You can divide each page further with the `segmentation.spatial` field. - For a plain text or Markdown file, each part is a chunk of whole sentences. The `segmentation.sequential` field is required. - `asset`: Returns one embedding for the entire file. **Default**: `["local"]` for PDF files; `["asset"]` for plain text and Markdown files. - Allowed values: `local`, `asset` ### AsyncImageInputRequest This field is required if the `input_type` parameter is `image`. Requires Marengo 3.5. The decoded file can be up to 32 MB. For an image, the `embedding_option`, `embedding_type`, and `embedding_scope` fields each accept a single value; the platform returns a `400` error if you send any other value. - `media_source` (MediaSource, required) — An object specifying the source of the media file. You must provide exactly one of `url`, `base64_string`, or `asset_id`. - `embedding_option` (list of enum, optional) — The type of embedding to generate for the image. Always `visual`. - Allowed values: `visual` - `embedding_type` (list of enum, optional) — Specifies how to structure the embedding. Always `separate_embedding`. - Allowed values: `separate_embedding` - `embedding_scope` (list of enum, optional) — The scope for which to generate embeddings. Always `asset`, which produces one embedding for the entire image. - Allowed values: `asset` ### EmbeddingData An embedding with its metadata. - `embedding` (list of double, required) — The embedding vector for the content. - `embedding_uncertainty` (list of double, optional) — A per-dimension uncertainty vector with the same length as the `embedding` array. A higher value indicates lower confidence in that dimension. Present when the request sets [`embedding_uncertainty: true`](/v1.3/api-reference/create-embeddings-v2/create-embeddings#request.body.embedding-uncertainty). Only Marengo 3.5 returns this field. - `embedding_option` (enum, optional, nullable) — The type of the embedding. **Values**: - `visual`: Embedding based on visual content (a video, a page of a PDF file, or an image embedded asynchronously). - `audio`: Embedding based on audio content. - `text`: Embedding based on the text content of a PDF, plain text, or Markdown file embedded asynchronously. - `transcription`: Embedding based on transcribed speech. Returned only for content embedded with Marengo 3.0. - `fused`: Embedding based on a combination of the modalities specified in the request. The platform returns this embedding only for video and audio input, and only when the `embedding_type` parameter includes the `fused_embedding` value. - `null`: For text embeddings and images embedded synchronously. - Allowed values: `visual`, `audio`, `transcription`, `text`, `fused` - `embedding_scope` (enum, optional, nullable) — The scope for which the embedding was generated. **Values**: - `clip`: Embedding for a segment. For video and audio input, one embedding per detected segment. - `page`: Embedding for one page of a PDF file embedded asynchronously, or for one quadrant of a page when the request sets [`document.segmentation.spatial.strategy`](/v1.3/api-reference/create-embeddings-v2/create-async-embedding-task#request.body.document.segmentation.spatial.strategy) to `quadrants`. With that strategy, five entries share the same scope and page numbers, so read the `quadrant` field to tell them apart: the whole-page entry has no `quadrant` value. - `chunk`: Embedding for one chunk of whole sentences from a plain text or Markdown file embedded asynchronously. Read the `chunk_index` field for the position of the chunk in the file. - `asset`: Embedding for the entire file. For video and audio input, use this scope for content up to 10-30 seconds to maintain optimal performance. - `null`: For text embeddings and images embedded synchronously. When you request the `local` scope, the platform returns `clip` for audio and video, `page` for PDF files, and `chunk` for plain text and Markdown files. For audio, video, and document input, the `metadata.embedding_scopes` field contains the scopes you requested. - Allowed values: `clip`, `page`, `chunk`, `asset` - `start_sec` (double, optional, nullable) — The start time in seconds for this segment. This field is `null` for text and image embeddings. - `end_sec` (double, optional, nullable) — The end time in seconds for this segment. This field is `null` for text and image embeddings. - `start_page_number` (integer, optional, nullable) — The first page this embedding covers, counting from 1. The platform returns this field only for page-level embeddings of a PDF file, and `null` in every other case. - `end_page_number` (integer, optional, nullable) — The last page this embedding covers, counting from 1 and including that page. This field matches the `start_page_number` field when the embedding covers a single page. The platform returns this field only for page-level embeddings of a PDF file, and `null` in every other case. - `quadrant` (enum, optional, nullable) — The quarter of the page this embedding covers. The platform returns this field only when the request sets [`document.segmentation.spatial.strategy`](/v1.3/api-reference/create-embeddings-v2/create-async-embedding-task#request.body.document.segmentation.spatial.strategy) to `quadrants`, and only on the four quadrant embeddings of a page. This field is `null` on the whole-page embedding and in every other case. - Allowed values: `top_left`, `top_right`, `bottom_left`, `bottom_right` - `chunk_index` (integer, optional, nullable) — The position of this chunk in the file, counting from 0. The platform returns this field only on `chunk`-scope embeddings of a plain text or Markdown file, and `null` in every other case. Read this field rather than the position of the entry in the `data` array, which provides no ordering guarantee. ### EmbedV2TasksPostResponsesContentApplicationJsonSchemaMetadata Metadata about the task you created. The platform sets the length of your embeddings when it creates the task, and the `embedding_dimension` field contains that length. Only Marengo 3.5 returns it. - `embedding_dimension` (integer, optional) — The number of dimensions for each embedding in this response. Only Marengo 3.5 returns this field. ### ErrorResponseError - `code` (string, required) — A string representing the code associated with the error. See the [Error codes](/v1.3/api-reference/error-codes) page for details. - `message` (string, required) — A human-readable string describing the error, intended to be suitable for display in a user interface. - `details` (map from string to any, optional) — Additional error details (optional) ### MediaSource An object specifying the source of the media file. You must provide exactly one of `url`, `base64_string`, or `asset_id`. - `base64_string` (string, optional) — The base64-encoded media data. Encoding grows the payload by about a third, so the string you send is larger than the original file. The maximum size depends on the input type and the model. The description of the field that contains this media source states the limit where it differs; for the formats and sizes each model accepts, see the input requirements for [Marengo 3.5](/v1.3/docs/concepts/models/marengo/marengo-3-5#input-requirements) or [Marengo 3.0](/v1.3/docs/concepts/models/marengo/marengo-3-0#input-requirements). - `url` (string, optional) — The publicly accessible URL of the media file. Use direct links to raw media files. Video hosting platforms and cloud storage sharing links are not supported. - `asset_id` (string, optional) — The unique identifier of an asset from a [direct](/v1.3/api-reference/upload-content/direct-uploads) or [multipart](/v1.3/api-reference/upload-content/multipart-uploads) upload. The asset status must be `ready`. Use the [Retrieve an asset](/v1.3/api-reference/upload-content/direct-uploads/retrieve) method to check the status. ### AsyncAudioInputRequestSegmentation Specifies how the platform divides the audio into segments. The structure of this object depends on the model version: - **With Marengo 3.5**: Place your settings in the `temporal` object. Both strategies are available: `dynamic` divides the audio into variable-length segments that follow scene changes, and `fixed` divides it into equal-length segments. Default: `temporal.dynamic`, `min_duration_sec: 2`. - **With Marengo 3.0**: Provide the settings directly in this object. Only `fixed` segmentation is available. Default: `fixed`, `duration_sec: 6`. If you use a structure that does not match your model version, the platform returns a `400` error. ### TimeBasedMetadataEntry One time-aligned metadata entry. The platform folds the text of the entry into the fused embedding of every segment that overlaps the time range of the entry. - `start` (double, required) — The start time of the entry in seconds, measured from the beginning of the asset. Set the same value in the `end` field for an event that happens at a single point in time, such as one entry in a stats feed. - `end` (double, required) — The end time of the entry in seconds, measured from the beginning of the asset. - `text` (string, required) — The text to fold into the fused embedding of the overlapping segments. ### AsyncVideoInputRequestSegmentation Specifies how the platform divides the video into segments. The structure of this object depends on the model version: - **With Marengo 3.5**: Place your settings in the `temporal` object. Both strategies are available: `dynamic` divides the video into variable-length segments that follow scene changes, and `fixed` divides it into equal-length segments. Default: `temporal.dynamic`, `min_duration_sec: 2`. - **With Marengo 3.0**: Provide the settings directly in this object. Default: `dynamic`, `min_duration_sec: 4`. If you use a structure that does not match your model version, the platform returns a `400` error. ### DocumentSegmentation Specifies how the platform divides your document before it generates embeddings. Requires Marengo 3.5. Use the `spatial` field to divide each rendered page of a PDF file. Use the `sequential` field to divide a plain text or Markdown file into chunks. Provide the field that matches your file. If you provide neither field, the platform returns a `400` error. - `spatial` (DocumentSpatialSegmentation, optional) — Specifies how the platform divides each rendered page of a PDF file. Plain text and Markdown files have no rendered pages, so the platform returns a `400` error if you include this object. This object requires the `visual` value in the `embedding_option` field and the `local` value in the `embedding_scope` field. - `sequential` (DocumentSequentialSegmentation, optional) — Specifies how the platform divides a plain text or Markdown file into chunks. For a PDF file, the platform divides by page instead and returns a `400` error if you include this object. This object requires the `text` value in the `embedding_option` field and the `local` value in the `embedding_scope` field. ### AudioSegmentation Specifies how the platform divides the audio into segments. - `strategy` ("fixed", required) - `fixed` (AudioSegmentationFixed, required) — Configuration for fixed segmentation. This object is required when the `strategy` field is `fixed`. ### AsyncTemporalSegmentation Wraps your settings in a `temporal` object. Use with Marengo 3.5. - `temporal` (TemporalSegmentation, required) — Specifies how the platform divides the file into segments. The `strategy` field selects one variant: - `dynamic`: Creates variable-length segments that align with scene or content boundaries. Use this for content-aware segmentation. - `fixed`: Creates equal-length segments. Use this for consistent timing. ### DocumentSpatialSegmentation Specifies how the platform divides each rendered page of a PDF file. Plain text and Markdown files have no rendered pages, so the platform returns a `400` error if you include this object. This object requires the `visual` value in the `embedding_option` field and the `local` value in the `embedding_scope` field. - `strategy` (enum, optional, default: standard) — The strategy for dividing each page. **Values**: - `standard`: Returns one embedding for each page. - `quadrants`: Divides each page into a 2×2 grid. Returns five embeddings: one for the whole page, and one for each quarter. The [`data[].quadrant`](/v1.3/api-reference/create-embeddings-v2/retrieve-embeddings#response.body.data.quadrant) field identifies which quarter each embedding represents. This field is `null` on the whole-page embedding. This strategy uses five times as many tokens as the `standard` strategy. It also counts each page five times against the page allowance of the file. **Default**: `standard` - Allowed values: `standard`, `quadrants` ### DocumentSequentialSegmentation Specifies how the platform divides a plain text or Markdown file into chunks. For a PDF file, the platform divides by page instead and returns a `400` error if you include this object. This object requires the `text` value in the `embedding_option` field and the `local` value in the `embedding_scope` field. - `strategy` (enum, required) — The strategy for dividing the text into chunks. Always `sentence`, which groups whole sentences into each chunk, up to the number of sentences in the `max_sentences` field. - Allowed values: `sentence` - `max_sentences` (integer, required) — The maximum number of sentences in each chunk. This field has no default. Choose a value small enough that every chunk fits in the context window of the model. If a chunk exceeds that window, the task fails, and the platform does not truncate it. How many sentences fit depends on the length of the sentences in your file. - `overlap_sentences` (integer, optional, default: 0) — The number of sentences at the end of one chunk that the platform repeats at the start of the next. The overlap preserves the context of the previous chunk. This value must be less than the `max_sentences` value. **Default**: 0 ### AudioSegmentationFixed Configuration for fixed segmentation. This object is required when the `strategy` field is `fixed`. - `duration_sec` (integer, required) — The duration in seconds for each segment. The platform divides the audio into segments of this exact length. The final segment may be shorter if the audio duration is not evenly divisible. **Min**: `2`. **Max**: `10`. **Example**: With `duration_sec: 5`, a 12-second audio file produces segments: [0-5s], [5-10s], [10-12s]. ### TemporalSegmentation Specifies how the platform divides the file into segments. The `strategy` field selects one variant: - `dynamic`: Creates variable-length segments that align with scene or content boundaries. Use this for content-aware segmentation. - `fixed`: Creates equal-length segments. Use this for consistent timing. - `strategy`: `dynamic` (dynamic) - `dynamic` (TemporalSegmentationDiscriminatorMappingDynamicDynamic, required) — Configuration for dynamic segmentation. This object is required when `strategy` is `dynamic`. - `strategy`: `fixed` (fixed) - `fixed` (TemporalSegmentationDiscriminatorMappingFixedFixed, required) — Configuration for fixed segmentation. This object is required when `strategy` is `fixed`. ### TemporalSegmentationDiscriminatorMappingDynamicDynamic Configuration for dynamic segmentation. This object is required when `strategy` is `dynamic`. - `min_duration_sec` (integer, required) — The minimum duration in seconds for each segment. The platform divides the file into segments that are at least this long. Segments adapt to scene changes and content boundaries and may be longer than the minimum. **Min**: `2`. **Max**: `5`. ### TemporalSegmentationDiscriminatorMappingFixedFixed Configuration for fixed segmentation. This object is required when `strategy` is `fixed`. - `duration_sec` (integer, required) — The duration in seconds for each segment. The platform divides the file into segments of this exact length. The final segment may be shorter if the duration is not evenly divisible. **Min**: `2`. **Max**: `10`. ## Examples ### embed_v2_tasks_create_example **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python embed_v2_tasks_create_example import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" headers = {"x-api-key": ""} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript embed_v2_tasks_create_example const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = {method: 'POST', headers: {'x-api-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go embed_v2_tasks_create_example package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby embed_v2_tasks_create_example require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body ``` ```java embed_v2_tasks_create_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .asString(); ``` ```php embed_v2_tasks_create_example request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'headers' => [ 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp embed_v2_tasks_create_example using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); IRestResponse response = client.Execute(request); ``` ```swift embed_v2_tasks_create_example import Foundation let headers = ["x-api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: audio with fixed segmentation **Request** ```json { "input_type": "audio", "model_name": "marengo3.5", "audio": { "media_source": { "url": "https://user-bucket.com/audio/long-audio.wav" }, "start_sec": 0, "end_sec": 3600, "segmentation": { "temporal": { "strategy": "fixed", "fixed": { "duration_sec": 6 } } }, "embedding_option": [ "audio" ], "embedding_scope": [ "clip", "asset" ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.5: audio with fixed segmentation import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "audio", "model_name": "marengo3.5", "audio": { "media_source": { "url": "https://user-bucket.com/audio/long-audio.wav" }, "start_sec": 0, "end_sec": 3600, "segmentation": { "temporal": { "strategy": "fixed", "fixed": { "duration_sec": 6 } } }, "embedding_option": ["audio"], "embedding_scope": ["clip", "asset"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: audio with fixed segmentation const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"audio","model_name":"marengo3.5","audio":{"media_source":{"url":"https://user-bucket.com/audio/long-audio.wav"},"start_sec":0,"end_sec":3600,"segmentation":{"temporal":{"strategy":"fixed","fixed":{"duration_sec":6}}},"embedding_option":["audio"],"embedding_scope":["clip","asset"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: audio with fixed segmentation package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.5\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/long-audio.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 3600,\n \"segmentation\": {\n \"temporal\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n }\n },\n \"embedding_option\": [\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: audio with fixed segmentation require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.5\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/long-audio.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 3600,\n \"segmentation\": {\n \"temporal\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n }\n },\n \"embedding_option\": [\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: audio with fixed segmentation import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.5\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/long-audio.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 3600,\n \"segmentation\": {\n \"temporal\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n }\n },\n \"embedding_option\": [\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: audio with fixed segmentation request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "audio", "model_name": "marengo3.5", "audio": { "media_source": { "url": "https://user-bucket.com/audio/long-audio.wav" }, "start_sec": 0, "end_sec": 3600, "segmentation": { "temporal": { "strategy": "fixed", "fixed": { "duration_sec": 6 } } }, "embedding_option": [ "audio" ], "embedding_scope": [ "clip", "asset" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: audio with fixed segmentation using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.5\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/long-audio.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 3600,\n \"segmentation\": {\n \"temporal\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n }\n },\n \"embedding_option\": [\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: audio with fixed segmentation import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "audio", "model_name": "marengo3.5", "audio": [ "media_source": ["url": "https://user-bucket.com/audio/long-audio.wav"], "start_sec": 0, "end_sec": 3600, "segmentation": ["temporal": [ "strategy": "fixed", "fixed": ["duration_sec": 6] ]], "embedding_option": ["audio"], "embedding_scope": ["clip", "asset"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: video with dynamic segmentation **Request** ```json { "input_type": "video", "model_name": "marengo3.5", "video": { "media_source": { "url": "https://user-bucket.com/video/long-video.mp4" }, "start_sec": 0, "end_sec": 7200, "segmentation": { "temporal": { "strategy": "dynamic", "dynamic": { "min_duration_sec": 4 } } }, "embedding_option": [ "visual", "audio" ], "embedding_scope": [ "clip", "asset" ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.5: video with dynamic segmentation import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "video", "model_name": "marengo3.5", "video": { "media_source": { "url": "https://user-bucket.com/video/long-video.mp4" }, "start_sec": 0, "end_sec": 7200, "segmentation": { "temporal": { "strategy": "dynamic", "dynamic": { "min_duration_sec": 4 } } }, "embedding_option": ["visual", "audio"], "embedding_scope": ["clip", "asset"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: video with dynamic segmentation const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"video","model_name":"marengo3.5","video":{"media_source":{"url":"https://user-bucket.com/video/long-video.mp4"},"start_sec":0,"end_sec":7200,"segmentation":{"temporal":{"strategy":"dynamic","dynamic":{"min_duration_sec":4}}},"embedding_option":["visual","audio"],"embedding_scope":["clip","asset"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: video with dynamic segmentation package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 7200,\n \"segmentation\": {\n \"temporal\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: video with dynamic segmentation require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 7200,\n \"segmentation\": {\n \"temporal\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: video with dynamic segmentation import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 7200,\n \"segmentation\": {\n \"temporal\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: video with dynamic segmentation request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "video", "model_name": "marengo3.5", "video": { "media_source": { "url": "https://user-bucket.com/video/long-video.mp4" }, "start_sec": 0, "end_sec": 7200, "segmentation": { "temporal": { "strategy": "dynamic", "dynamic": { "min_duration_sec": 4 } } }, "embedding_option": [ "visual", "audio" ], "embedding_scope": [ "clip", "asset" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: video with dynamic segmentation using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 7200,\n \"segmentation\": {\n \"temporal\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: video with dynamic segmentation import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "video", "model_name": "marengo3.5", "video": [ "media_source": ["url": "https://user-bucket.com/video/long-video.mp4"], "start_sec": 0, "end_sec": 7200, "segmentation": ["temporal": [ "strategy": "dynamic", "dynamic": ["min_duration_sec": 4] ]], "embedding_option": ["visual", "audio"], "embedding_scope": ["clip", "asset"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: video with fused embedding **Request** ```json { "input_type": "video", "model_name": "marengo3.5", "video": { "media_source": { "url": "https://user-bucket.com/video/long-video.mp4" }, "embedding_option": [ "visual", "audio" ], "embedding_scope": [ "clip", "asset" ], "embedding_type": [ "separate_embedding", "fused_embedding" ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.5: video with fused embedding import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "video", "model_name": "marengo3.5", "video": { "media_source": { "url": "https://user-bucket.com/video/long-video.mp4" }, "embedding_option": ["visual", "audio"], "embedding_scope": ["clip", "asset"], "embedding_type": ["separate_embedding", "fused_embedding"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: video with fused embedding const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"video","model_name":"marengo3.5","video":{"media_source":{"url":"https://user-bucket.com/video/long-video.mp4"},"embedding_option":["visual","audio"],"embedding_scope":["clip","asset"],"embedding_type":["separate_embedding","fused_embedding"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: video with fused embedding package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: video with fused embedding require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: video with fused embedding import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: video with fused embedding request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "video", "model_name": "marengo3.5", "video": { "media_source": { "url": "https://user-bucket.com/video/long-video.mp4" }, "embedding_option": [ "visual", "audio" ], "embedding_scope": [ "clip", "asset" ], "embedding_type": [ "separate_embedding", "fused_embedding" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: video with fused embedding using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: video with fused embedding import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "video", "model_name": "marengo3.5", "video": [ "media_source": ["url": "https://user-bucket.com/video/long-video.mp4"], "embedding_option": ["visual", "audio"], "embedding_scope": ["clip", "asset"], "embedding_type": ["separate_embedding", "fused_embedding"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: video fused with time-based metadata from a stats feed **Request** ```json { "input_type": "video", "model_name": "marengo3.5", "embedding_uncertainty": true, "video": { "media_source": { "asset_id": "vid_nba_lakers_celtics_2026_03_14" }, "embedding_option": [ "visual", "audio" ], "embedding_scope": [ "clip" ], "embedding_type": [ "separate_embedding", "fused_embedding" ], "time_based_metadata": [ { "start": 42.3, "end": 42.3, "text": "Shot made. LeBron James dunk. Assist: D'Angelo Russell. +2 LAL. 88-84." } ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.5: video fused with time-based metadata from a stats feed import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "video", "model_name": "marengo3.5", "embedding_uncertainty": True, "video": { "media_source": { "asset_id": "vid_nba_lakers_celtics_2026_03_14" }, "embedding_option": ["visual", "audio"], "embedding_scope": ["clip"], "embedding_type": ["separate_embedding", "fused_embedding"], "time_based_metadata": [ { "start": 42.3, "end": 42.3, "text": "Shot made. LeBron James dunk. Assist: D'Angelo Russell. +2 LAL. 88-84." } ] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: video fused with time-based metadata from a stats feed const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"video","model_name":"marengo3.5","embedding_uncertainty":true,"video":{"media_source":{"asset_id":"vid_nba_lakers_celtics_2026_03_14"},"embedding_option":["visual","audio"],"embedding_scope":["clip"],"embedding_type":["separate_embedding","fused_embedding"],"time_based_metadata":[{"start":42.3,"end":42.3,"text":"Shot made. LeBron James dunk. Assist: D\'Angelo Russell. +2 LAL. 88-84."}]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: video fused with time-based metadata from a stats feed package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"video\": {\n \"media_source\": {\n \"asset_id\": \"vid_nba_lakers_celtics_2026_03_14\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ],\n \"time_based_metadata\": [\n {\n \"start\": 42.3,\n \"end\": 42.3,\n \"text\": \"Shot made. LeBron James dunk. Assist: D'Angelo Russell. +2 LAL. 88-84.\"\n }\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: video fused with time-based metadata from a stats feed require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"video\": {\n \"media_source\": {\n \"asset_id\": \"vid_nba_lakers_celtics_2026_03_14\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ],\n \"time_based_metadata\": [\n {\n \"start\": 42.3,\n \"end\": 42.3,\n \"text\": \"Shot made. LeBron James dunk. Assist: D'Angelo Russell. +2 LAL. 88-84.\"\n }\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: video fused with time-based metadata from a stats feed import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"video\": {\n \"media_source\": {\n \"asset_id\": \"vid_nba_lakers_celtics_2026_03_14\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ],\n \"time_based_metadata\": [\n {\n \"start\": 42.3,\n \"end\": 42.3,\n \"text\": \"Shot made. LeBron James dunk. Assist: D'Angelo Russell. +2 LAL. 88-84.\"\n }\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: video fused with time-based metadata from a stats feed request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "video", "model_name": "marengo3.5", "embedding_uncertainty": true, "video": { "media_source": { "asset_id": "vid_nba_lakers_celtics_2026_03_14" }, "embedding_option": [ "visual", "audio" ], "embedding_scope": [ "clip" ], "embedding_type": [ "separate_embedding", "fused_embedding" ], "time_based_metadata": [ { "start": 42.3, "end": 42.3, "text": "Shot made. LeBron James dunk. Assist: D\'Angelo Russell. +2 LAL. 88-84." } ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: video fused with time-based metadata from a stats feed using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"video\": {\n \"media_source\": {\n \"asset_id\": \"vid_nba_lakers_celtics_2026_03_14\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ],\n \"time_based_metadata\": [\n {\n \"start\": 42.3,\n \"end\": 42.3,\n \"text\": \"Shot made. LeBron James dunk. Assist: D'Angelo Russell. +2 LAL. 88-84.\"\n }\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: video fused with time-based metadata from a stats feed import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "video", "model_name": "marengo3.5", "embedding_uncertainty": true, "video": [ "media_source": ["asset_id": "vid_nba_lakers_celtics_2026_03_14"], "embedding_option": ["visual", "audio"], "embedding_scope": ["clip"], "embedding_type": ["separate_embedding", "fused_embedding"], "time_based_metadata": [ [ "start": 42.3, "end": 42.3, "text": "Shot made. LeBron James dunk. Assist: D'Angelo Russell. +2 LAL. 88-84." ] ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: PDF file, one embedding per page **Request** ```json { "input_type": "document", "model_name": "marengo3.5", "embedding_uncertainty": true, "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "embedding_option": [ "visual" ], "embedding_type": [ "separate_embedding" ], "embedding_scope": [ "local" ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.5: PDF file, one embedding per page import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "document", "model_name": "marengo3.5", "embedding_uncertainty": True, "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "embedding_option": ["visual"], "embedding_type": ["separate_embedding"], "embedding_scope": ["local"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: PDF file, one embedding per page const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"document","model_name":"marengo3.5","embedding_uncertainty":true,"document":{"media_source":{"asset_id":"doc_annual_report_2025"},"embedding_option":["visual"],"embedding_type":["separate_embedding"],"embedding_scope":["local"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: PDF file, one embedding per page package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_type\": [\n \"separate_embedding\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: PDF file, one embedding per page require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_type\": [\n \"separate_embedding\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: PDF file, one embedding per page import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_type\": [\n \"separate_embedding\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: PDF file, one embedding per page request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "document", "model_name": "marengo3.5", "embedding_uncertainty": true, "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "embedding_option": [ "visual" ], "embedding_type": [ "separate_embedding" ], "embedding_scope": [ "local" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: PDF file, one embedding per page using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_type\": [\n \"separate_embedding\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: PDF file, one embedding per page import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "document", "model_name": "marengo3.5", "embedding_uncertainty": true, "document": [ "media_source": ["asset_id": "doc_annual_report_2025"], "embedding_option": ["visual"], "embedding_type": ["separate_embedding"], "embedding_scope": ["local"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: PDF file, whole-page and quadrant embeddings **Request** ```json { "input_type": "document", "model_name": "marengo3.5", "embedding_dimension": 256, "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "segmentation": { "spatial": { "strategy": "quadrants" } }, "embedding_option": [ "visual" ], "embedding_scope": [ "local" ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.5: PDF file, whole-page and quadrant embeddings import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "document", "model_name": "marengo3.5", "embedding_dimension": 256, "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "segmentation": { "spatial": { "strategy": "quadrants" } }, "embedding_option": ["visual"], "embedding_scope": ["local"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: PDF file, whole-page and quadrant embeddings const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"document","model_name":"marengo3.5","embedding_dimension":256,"document":{"media_source":{"asset_id":"doc_annual_report_2025"},"segmentation":{"spatial":{"strategy":"quadrants"}},"embedding_option":["visual"],"embedding_scope":["local"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: PDF file, whole-page and quadrant embeddings package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"embedding_dimension\": 256,\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"segmentation\": {\n \"spatial\": {\n \"strategy\": \"quadrants\"\n }\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: PDF file, whole-page and quadrant embeddings require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"embedding_dimension\": 256,\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"segmentation\": {\n \"spatial\": {\n \"strategy\": \"quadrants\"\n }\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: PDF file, whole-page and quadrant embeddings import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"embedding_dimension\": 256,\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"segmentation\": {\n \"spatial\": {\n \"strategy\": \"quadrants\"\n }\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: PDF file, whole-page and quadrant embeddings request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "document", "model_name": "marengo3.5", "embedding_dimension": 256, "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "segmentation": { "spatial": { "strategy": "quadrants" } }, "embedding_option": [ "visual" ], "embedding_scope": [ "local" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: PDF file, whole-page and quadrant embeddings using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"embedding_dimension\": 256,\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"segmentation\": {\n \"spatial\": {\n \"strategy\": \"quadrants\"\n }\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: PDF file, whole-page and quadrant embeddings import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "document", "model_name": "marengo3.5", "embedding_dimension": 256, "document": [ "media_source": ["asset_id": "doc_annual_report_2025"], "segmentation": ["spatial": ["strategy": "quadrants"]], "embedding_option": ["visual"], "embedding_scope": ["local"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: PDF file, one embedding for the entire file **Request** ```json { "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "embedding_option": [ "visual" ], "embedding_scope": [ "asset" ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.5: PDF file, one embedding for the entire file import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "embedding_option": ["visual"], "embedding_scope": ["asset"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: PDF file, one embedding for the entire file const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"document","model_name":"marengo3.5","document":{"media_source":{"asset_id":"doc_annual_report_2025"},"embedding_option":["visual"],"embedding_scope":["asset"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: PDF file, one embedding for the entire file package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: PDF file, one embedding for the entire file require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: PDF file, one embedding for the entire file import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: PDF file, one embedding for the entire file request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "embedding_option": [ "visual" ], "embedding_scope": [ "asset" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: PDF file, one embedding for the entire file using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: PDF file, one embedding for the entire file import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "document", "model_name": "marengo3.5", "document": [ "media_source": ["asset_id": "doc_annual_report_2025"], "embedding_option": ["visual"], "embedding_scope": ["asset"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: PDF file, one visual and one text embedding for the entire file **Request** ```json { "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "embedding_option": [ "visual", "text" ], "embedding_scope": [ "asset" ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.5: PDF file, one visual and one text embedding for the entire file import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "embedding_option": ["visual", "text"], "embedding_scope": ["asset"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: PDF file, one visual and one text embedding for the entire file const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"document","model_name":"marengo3.5","document":{"media_source":{"asset_id":"doc_annual_report_2025"},"embedding_option":["visual","text"],"embedding_scope":["asset"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: PDF file, one visual and one text embedding for the entire file package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\",\n \"text\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: PDF file, one visual and one text embedding for the entire file require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\",\n \"text\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: PDF file, one visual and one text embedding for the entire file import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\",\n \"text\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: PDF file, one visual and one text embedding for the entire file request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "asset_id": "doc_annual_report_2025" }, "embedding_option": [ "visual", "text" ], "embedding_scope": [ "asset" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: PDF file, one visual and one text embedding for the entire file using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"asset_id\": \"doc_annual_report_2025\"\n },\n \"embedding_option\": [\n \"visual\",\n \"text\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: PDF file, one visual and one text embedding for the entire file import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "document", "model_name": "marengo3.5", "document": [ "media_source": ["asset_id": "doc_annual_report_2025"], "embedding_option": ["visual", "text"], "embedding_scope": ["asset"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: plain text file, one embedding for the entire file **Request** ```json { "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "url": "https://user-bucket.com/folder/release-notes.txt" }, "embedding_option": [ "text" ], "embedding_scope": [ "asset" ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.5: plain text file, one embedding for the entire file import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "url": "https://user-bucket.com/folder/release-notes.txt" }, "embedding_option": ["text"], "embedding_scope": ["asset"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: plain text file, one embedding for the entire file const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"document","model_name":"marengo3.5","document":{"media_source":{"url":"https://user-bucket.com/folder/release-notes.txt"},"embedding_option":["text"],"embedding_scope":["asset"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: plain text file, one embedding for the entire file package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/release-notes.txt\"\n },\n \"embedding_option\": [\n \"text\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: plain text file, one embedding for the entire file require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/release-notes.txt\"\n },\n \"embedding_option\": [\n \"text\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: plain text file, one embedding for the entire file import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/release-notes.txt\"\n },\n \"embedding_option\": [\n \"text\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: plain text file, one embedding for the entire file request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "url": "https://user-bucket.com/folder/release-notes.txt" }, "embedding_option": [ "text" ], "embedding_scope": [ "asset" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: plain text file, one embedding for the entire file using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/release-notes.txt\"\n },\n \"embedding_option\": [\n \"text\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: plain text file, one embedding for the entire file import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "document", "model_name": "marengo3.5", "document": [ "media_source": ["url": "https://user-bucket.com/folder/release-notes.txt"], "embedding_option": ["text"], "embedding_scope": ["asset"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: plain text file, one embedding for each chunk of whole sentences **Request** ```json { "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "url": "https://user-bucket.com/folder/release-notes.txt" }, "segmentation": { "sequential": { "strategy": "sentence", "max_sentences": 5, "overlap_sentences": 1 } }, "embedding_option": [ "text" ], "embedding_scope": [ "local" ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.5: plain text file, one embedding for each chunk of whole sentences import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "url": "https://user-bucket.com/folder/release-notes.txt" }, "segmentation": { "sequential": { "strategy": "sentence", "max_sentences": 5, "overlap_sentences": 1 } }, "embedding_option": ["text"], "embedding_scope": ["local"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: plain text file, one embedding for each chunk of whole sentences const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"document","model_name":"marengo3.5","document":{"media_source":{"url":"https://user-bucket.com/folder/release-notes.txt"},"segmentation":{"sequential":{"strategy":"sentence","max_sentences":5,"overlap_sentences":1}},"embedding_option":["text"],"embedding_scope":["local"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: plain text file, one embedding for each chunk of whole sentences package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/release-notes.txt\"\n },\n \"segmentation\": {\n \"sequential\": {\n \"strategy\": \"sentence\",\n \"max_sentences\": 5,\n \"overlap_sentences\": 1\n }\n },\n \"embedding_option\": [\n \"text\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: plain text file, one embedding for each chunk of whole sentences require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/release-notes.txt\"\n },\n \"segmentation\": {\n \"sequential\": {\n \"strategy\": \"sentence\",\n \"max_sentences\": 5,\n \"overlap_sentences\": 1\n }\n },\n \"embedding_option\": [\n \"text\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: plain text file, one embedding for each chunk of whole sentences import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/release-notes.txt\"\n },\n \"segmentation\": {\n \"sequential\": {\n \"strategy\": \"sentence\",\n \"max_sentences\": 5,\n \"overlap_sentences\": 1\n }\n },\n \"embedding_option\": [\n \"text\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: plain text file, one embedding for each chunk of whole sentences request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "document", "model_name": "marengo3.5", "document": { "media_source": { "url": "https://user-bucket.com/folder/release-notes.txt" }, "segmentation": { "sequential": { "strategy": "sentence", "max_sentences": 5, "overlap_sentences": 1 } }, "embedding_option": [ "text" ], "embedding_scope": [ "local" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: plain text file, one embedding for each chunk of whole sentences using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"document\",\n \"model_name\": \"marengo3.5\",\n \"document\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/release-notes.txt\"\n },\n \"segmentation\": {\n \"sequential\": {\n \"strategy\": \"sentence\",\n \"max_sentences\": 5,\n \"overlap_sentences\": 1\n }\n },\n \"embedding_option\": [\n \"text\"\n ],\n \"embedding_scope\": [\n \"local\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: plain text file, one embedding for each chunk of whole sentences import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "document", "model_name": "marengo3.5", "document": [ "media_source": ["url": "https://user-bucket.com/folder/release-notes.txt"], "segmentation": ["sequential": [ "strategy": "sentence", "max_sentences": 5, "overlap_sentences": 1 ]], "embedding_option": ["text"], "embedding_scope": ["local"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: image, single asset-scope visual embedding **Request** ```json { "input_type": "image", "model_name": "marengo3.5", "embedding_uncertainty": true, "image": { "media_source": { "asset_id": "img_brand_logo_primary" } } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.5: image, single asset-scope visual embedding import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "image", "model_name": "marengo3.5", "embedding_uncertainty": True, "image": { "media_source": { "asset_id": "img_brand_logo_primary" } } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: image, single asset-scope visual embedding const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"image","model_name":"marengo3.5","embedding_uncertainty":true,"image":{"media_source":{"asset_id":"img_brand_logo_primary"}}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: image, single asset-scope visual embedding package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"image\": {\n \"media_source\": {\n \"asset_id\": \"img_brand_logo_primary\"\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: image, single asset-scope visual embedding require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"image\": {\n \"media_source\": {\n \"asset_id\": \"img_brand_logo_primary\"\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: image, single asset-scope visual embedding import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"image\": {\n \"media_source\": {\n \"asset_id\": \"img_brand_logo_primary\"\n }\n }\n}") .asString(); ``` ```php Marengo 3.5: image, single asset-scope visual embedding request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "image", "model_name": "marengo3.5", "embedding_uncertainty": true, "image": { "media_source": { "asset_id": "img_brand_logo_primary" } } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: image, single asset-scope visual embedding using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.5\",\n \"embedding_uncertainty\": true,\n \"image\": {\n \"media_source\": {\n \"asset_id\": \"img_brand_logo_primary\"\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: image, single asset-scope visual embedding import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "image", "model_name": "marengo3.5", "embedding_uncertainty": true, "image": ["media_source": ["asset_id": "img_brand_logo_primary"]] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.0: audio with fixed segmentation **Request** ```json { "input_type": "audio", "model_name": "marengo3.0", "audio": { "media_source": { "url": "https://user-bucket.com/audio/long-audio.wav" }, "start_sec": 0, "end_sec": 3600, "segmentation": { "strategy": "fixed", "fixed": { "duration_sec": 6 } }, "embedding_option": [ "audio", "transcription" ], "embedding_scope": [ "clip", "asset" ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.0: audio with fixed segmentation import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "audio", "model_name": "marengo3.0", "audio": { "media_source": { "url": "https://user-bucket.com/audio/long-audio.wav" }, "start_sec": 0, "end_sec": 3600, "segmentation": { "strategy": "fixed", "fixed": { "duration_sec": 6 } }, "embedding_option": ["audio", "transcription"], "embedding_scope": ["clip", "asset"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.0: audio with fixed segmentation const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"audio","model_name":"marengo3.0","audio":{"media_source":{"url":"https://user-bucket.com/audio/long-audio.wav"},"start_sec":0,"end_sec":3600,"segmentation":{"strategy":"fixed","fixed":{"duration_sec":6}},"embedding_option":["audio","transcription"],"embedding_scope":["clip","asset"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.0: audio with fixed segmentation package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/long-audio.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 3600,\n \"segmentation\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n },\n \"embedding_option\": [\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.0: audio with fixed segmentation require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/long-audio.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 3600,\n \"segmentation\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n },\n \"embedding_option\": [\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.0: audio with fixed segmentation import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/long-audio.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 3600,\n \"segmentation\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n },\n \"embedding_option\": [\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.0: audio with fixed segmentation request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "audio", "model_name": "marengo3.0", "audio": { "media_source": { "url": "https://user-bucket.com/audio/long-audio.wav" }, "start_sec": 0, "end_sec": 3600, "segmentation": { "strategy": "fixed", "fixed": { "duration_sec": 6 } }, "embedding_option": [ "audio", "transcription" ], "embedding_scope": [ "clip", "asset" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.0: audio with fixed segmentation using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/long-audio.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 3600,\n \"segmentation\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n },\n \"embedding_option\": [\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.0: audio with fixed segmentation import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "audio", "model_name": "marengo3.0", "audio": [ "media_source": ["url": "https://user-bucket.com/audio/long-audio.wav"], "start_sec": 0, "end_sec": 3600, "segmentation": [ "strategy": "fixed", "fixed": ["duration_sec": 6] ], "embedding_option": ["audio", "transcription"], "embedding_scope": ["clip", "asset"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.0: video with dynamic segmentation **Request** ```json { "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/long-video.mp4" }, "start_sec": 0, "end_sec": 7200, "segmentation": { "strategy": "dynamic", "dynamic": { "min_duration_sec": 4 } }, "embedding_option": [ "visual", "audio", "transcription" ], "embedding_scope": [ "clip", "asset" ] } } ``` **Response** ```json { "_id": "64f8d2c7e4a1b37f8a9c5d12", "status": "processing", "data": null, "metadata": { "embedding_dimension": 512 } } ``` **SDK Code** ```python Marengo 3.0: video with dynamic segmentation import requests url = "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload = { "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/long-video.mp4" }, "start_sec": 0, "end_sec": 7200, "segmentation": { "strategy": "dynamic", "dynamic": { "min_duration_sec": 4 } }, "embedding_option": ["visual", "audio", "transcription"], "embedding_scope": ["clip", "asset"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.0: video with dynamic segmentation const url = 'https://api.twelvelabs.io/v1.3/embed-v2/tasks'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"video","model_name":"marengo3.0","video":{"media_source":{"url":"https://user-bucket.com/video/long-video.mp4"},"start_sec":0,"end_sec":7200,"segmentation":{"strategy":"dynamic","dynamic":{"min_duration_sec":4}},"embedding_option":["visual","audio","transcription"],"embedding_scope":["clip","asset"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.0: video with dynamic segmentation package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2/tasks" payload := strings.NewReader("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 7200,\n \"segmentation\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.0: video with dynamic segmentation require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2/tasks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 7200,\n \"segmentation\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.0: video with dynamic segmentation import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2/tasks") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 7200,\n \"segmentation\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.0: video with dynamic segmentation request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2/tasks', [ 'body' => '{ "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/long-video.mp4" }, "start_sec": 0, "end_sec": 7200, "segmentation": { "strategy": "dynamic", "dynamic": { "min_duration_sec": 4 } }, "embedding_option": [ "visual", "audio", "transcription" ], "embedding_scope": [ "clip", "asset" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.0: video with dynamic segmentation using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2/tasks"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/long-video.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 7200,\n \"segmentation\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.0: video with dynamic segmentation import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "video", "model_name": "marengo3.0", "video": [ "media_source": ["url": "https://user-bucket.com/video/long-video.mp4"], "start_sec": 0, "end_sec": 7200, "segmentation": [ "strategy": "dynamic", "dynamic": ["min_duration_sec": 4] ], "embedding_option": ["visual", "audio", "transcription"], "embedding_scope": ["clip", "asset"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2/tasks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```