> 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/indexes/create/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.twelvelabs.io/_mcp/server. # Create an index POST https://api.twelvelabs.io/v1.3/indexes Content-Type: application/json This method creates an index. Reference: https://docs.twelvelabs.io/api-reference/indexes/create ## 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 an object. - `index_name` (string, required) — The name of the index. Make sure you use a succinct and descriptive name. - `models` (list of IndexesPostRequestBodyContentApplicationJsonSchemaModelsItems, required) — An array that specifies the [video understanding models](/v1.3/docs/concepts/models) and the [model options](/v1.3/docs/concepts/modalities#model-options) to be enabled for this index. Models determine what tasks you can perform with your videos. Model options determine which modalities the platform analyzes. - `addons` (list of string, optional) — An array specifying which add-ons should be enabled. Each entry in the array is an addon, and the following values are supported: * `thumbnail`: Enables thumbnail generation. If you don't provide this parameter, no add-ons will be enabled. * You can only enable addons when using the Marengo video understanding model. * You cannot disable an add-on once the index has been created. ## Response ### 201 An index has successfully been created - `_id` (string, optional) — Represents the unique identifier of the `index` object. ## Errors ### 400 Bad Request Error The request has failed. - `code` (string, optional) — A string representing the code associated with the error. See the [Error codes](/v1.3/api-reference/error-codes) page for details. - `message` (string, optional) — A human-readable string describing the error, intended to be suitable for display in a user interface. ## Types ### IndexesPostRequestBodyContentApplicationJsonSchemaModelsItems - `model_name` (enum, required) — The video understanding model to enable for this index. * `marengo3.0`: Enhanced model with sports intelligence and extended content support. You cannot change the model configuration once the index has been created. - Allowed values: `marengo3.0` - `model_options` (list of string, required) — An array that specifies which modalities the platform analyzes. For the Marengo model, you can specify one or both of the following model options: `visual` and `audio`. For more details, see the [Model options](/v1.3/docs/concepts/modalities#model-options) section. ## Examples **Request** ```json { "index_name": "myIndex", "models": [ { "model_name": "marengo3.0", "model_options": [ "visual", "audio" ] } ], "addons": [ "thumbnail" ] } ``` **Response** ```json { "_id": "62d85fe7340fa665f1fda5dd" } ``` **SDK Code** ```python import requests url = "https://api.twelvelabs.io/v1.3/indexes" payload = { "index_name": "myIndex", "models": [ { "model_name": "marengo3.0", "model_options": ["visual", "audio"] } ], "addons": ["thumbnail"] } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.twelvelabs.io/v1.3/indexes'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"index_name":"myIndex","models":[{"model_name":"marengo3.0","model_options":["visual","audio"]}],"addons":["thumbnail"]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/indexes" payload := strings.NewReader("{\n \"index_name\": \"myIndex\",\n \"models\": [\n {\n \"model_name\": \"marengo3.0\",\n \"model_options\": [\n \"visual\",\n \"audio\"\n ]\n }\n ],\n \"addons\": [\n \"thumbnail\"\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 require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/indexes") 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 \"index_name\": \"myIndex\",\n \"models\": [\n {\n \"model_name\": \"marengo3.0\",\n \"model_options\": [\n \"visual\",\n \"audio\"\n ]\n }\n ],\n \"addons\": [\n \"thumbnail\"\n ]\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/indexes") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"index_name\": \"myIndex\",\n \"models\": [\n {\n \"model_name\": \"marengo3.0\",\n \"model_options\": [\n \"visual\",\n \"audio\"\n ]\n }\n ],\n \"addons\": [\n \"thumbnail\"\n ]\n}") .asString(); ``` ```php request('POST', 'https://api.twelvelabs.io/v1.3/indexes', [ 'body' => '{ "index_name": "myIndex", "models": [ { "model_name": "marengo3.0", "model_options": [ "visual", "audio" ] } ], "addons": [ "thumbnail" ] }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/indexes"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"index_name\": \"myIndex\",\n \"models\": [\n {\n \"model_name\": \"marengo3.0\",\n \"model_options\": [\n \"visual\",\n \"audio\"\n ]\n }\n ],\n \"addons\": [\n \"thumbnail\"\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "index_name": "myIndex", "models": [ [ "model_name": "marengo3.0", "model_options": ["visual", "audio"] ] ], "addons": ["thumbnail"] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/indexes")! 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() ```