# Vectorize # Indexes ## List Vectorize Indexes `client.vectorize.indexes.list(IndexListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/vectorize/v2/indexes` Returns a list of Vectorize Indexes ### Parameters - `params: IndexListParams` - `account_id: string` Identifier ### Returns - `CreateIndex` - `config?: IndexDimensionConfiguration` - `dimensions: number` Specifies the number of dimensions for the index - `metric: "cosine" | "euclidean" | "dot-product"` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` - `created_on?: string` Specifies the timestamp the resource was created as an ISO8601 string. - `description?: string` Specifies the description of the index. - `modified_on?: string` Specifies the timestamp the resource was modified as an ISO8601 string. - `name?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const createIndex of client.vectorize.indexes.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(createIndex.config); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "config": { "dimensions": 768, "metric": "cosine" }, "created_on": "2022-11-15T18:25:44.442097Z", "description": "This is my example index.", "modified_on": "2022-11-15T18:25:44.442097Z", "name": "example-index" } ], "success": true } ``` ## Get Vectorize Index `client.vectorize.indexes.get(stringindexName, IndexGetParamsparams, RequestOptionsoptions?): CreateIndex | null` **get** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}` Returns the specified Vectorize Index. ### Parameters - `indexName: string` - `params: IndexGetParams` - `account_id: string` Identifier ### Returns - `CreateIndex | null` - `config?: IndexDimensionConfiguration` - `dimensions: number` Specifies the number of dimensions for the index - `metric: "cosine" | "euclidean" | "dot-product"` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` - `created_on?: string` Specifies the timestamp the resource was created as an ISO8601 string. - `description?: string` Specifies the description of the index. - `modified_on?: string` Specifies the timestamp the resource was modified as an ISO8601 string. - `name?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const createIndex = await client.vectorize.indexes.get('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(createIndex.config); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "config": { "dimensions": 768, "metric": "cosine" }, "created_on": "2022-11-15T18:25:44.442097Z", "description": "This is my example index.", "modified_on": "2022-11-15T18:25:44.442097Z", "name": "example-index" }, "success": true } ``` ## Create Vectorize Index `client.vectorize.indexes.create(IndexCreateParamsparams, RequestOptionsoptions?): CreateIndex | null` **post** `/accounts/{account_id}/vectorize/v2/indexes` Creates and returns a new Vectorize Index. ### Parameters - `params: IndexCreateParams` - `account_id: string` Path param: Identifier - `config: IndexDimensionConfiguration | VectorizeIndexPresetConfiguration` Body param: Specifies the type of configuration to use for the index. - `IndexDimensionConfiguration` - `dimensions: number` Specifies the number of dimensions for the index - `metric: "cosine" | "euclidean" | "dot-product"` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` - `VectorizeIndexPresetConfiguration` - `preset: "@cf/baai/bge-small-en-v1.5" | "@cf/baai/bge-base-en-v1.5" | "@cf/baai/bge-large-en-v1.5" | 2 more` Specifies the preset to use for the index. - `"@cf/baai/bge-small-en-v1.5"` - `"@cf/baai/bge-base-en-v1.5"` - `"@cf/baai/bge-large-en-v1.5"` - `"openai/text-embedding-ada-002"` - `"cohere/embed-multilingual-v2.0"` - `name: string` Body param - `description?: string` Body param: Specifies the description of the index. ### Returns - `CreateIndex | null` - `config?: IndexDimensionConfiguration` - `dimensions: number` Specifies the number of dimensions for the index - `metric: "cosine" | "euclidean" | "dot-product"` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` - `created_on?: string` Specifies the timestamp the resource was created as an ISO8601 string. - `description?: string` Specifies the description of the index. - `modified_on?: string` Specifies the timestamp the resource was modified as an ISO8601 string. - `name?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const createIndex = await client.vectorize.indexes.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', config: { dimensions: 768, metric: 'cosine' }, name: 'example-index', }); console.log(createIndex.config); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "config": { "dimensions": 768, "metric": "cosine" }, "created_on": "2022-11-15T18:25:44.442097Z", "description": "This is my example index.", "modified_on": "2022-11-15T18:25:44.442097Z", "name": "example-index" }, "success": true } ``` ## Delete Vectorize Index `client.vectorize.indexes.delete(stringindexName, IndexDeleteParamsparams, RequestOptionsoptions?): IndexDeleteResponse | null` **delete** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}` Deletes the specified Vectorize Index. ### Parameters - `indexName: string` - `params: IndexDeleteParams` - `account_id: string` Identifier ### Returns - `IndexDeleteResponse = unknown | string | null` - `unknown` - `string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const index = await client.vectorize.indexes.delete('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(index); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": {}, "success": true } ``` ## Insert Vectors `client.vectorize.indexes.insert(stringindexName, IndexInsertParamsparams, RequestOptionsoptions?): IndexInsertResponse | null` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/insert` Inserts vectors into the specified index and returns a mutation id corresponding to the vectors enqueued for insertion. ### Parameters - `indexName: string` - `params: IndexInsertParams` - `account_id: string` Path param: Identifier - `body: Uploadable` Body param: ndjson file containing vectors to insert. - `unparsableBehavior?: "error" | "discard"` Query param: Behavior for ndjson parse failures. - `"error"` - `"discard"` ### Returns - `IndexInsertResponse` - `mutationId?: string` The unique identifier for the async mutation operation containing the changeset. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.vectorize.indexes.insert('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', body: fs.createReadStream('path/to/file'), }); console.log(response.mutationId); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "mutationId": "0000aaaa-11bb-22cc-33dd-444444eeeeee" }, "success": true } ``` ## Query Vectors `client.vectorize.indexes.query(stringindexName, IndexQueryParamsparams, RequestOptionsoptions?): IndexQueryResponse | null` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/query` Finds vectors closest to a given vector in an index. ### Parameters - `indexName: string` - `params: IndexQueryParams` - `account_id: string` Path param: Identifier - `vector: Array` Body param: The search vector that will be used to find the nearest neighbors. - `filter?: unknown` Body param: A metadata filter expression used to limit nearest neighbor results. - `returnMetadata?: "none" | "indexed" | "all"` Body param: Whether to return no metadata, indexed metadata or all metadata associated with the closest vectors. - `"none"` - `"indexed"` - `"all"` - `returnValues?: boolean` Body param: Whether to return the values associated with the closest vectors. - `topK?: number` Body param: The number of nearest neighbors to find. ### Returns - `IndexQueryResponse` - `count?: number` Specifies the count of vectors returned by the search - `matches?: Array` Array of vectors matched by the search - `id?: string` Identifier for a Vector - `metadata?: unknown` - `namespace?: string | null` - `score?: number` The score of the vector according to the index's distance metric - `values?: Array | null` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.vectorize.indexes.query('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', vector: [0.5, 0.5, 0.5], }); console.log(response.count); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "count": 0, "matches": [ { "id": "some-vector-id-023e105f4ecef8ad9ca31a8372d0c353", "metadata": {}, "namespace": "namespace", "score": 0, "values": [ 0 ] } ] }, "success": true } ``` ## Upsert Vectors `client.vectorize.indexes.upsert(stringindexName, IndexUpsertParamsparams, RequestOptionsoptions?): IndexUpsertResponse | null` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/upsert` Upserts vectors into the specified index, creating them if they do not exist and returns a mutation id corresponding to the vectors enqueued for upsertion. ### Parameters - `indexName: string` - `params: IndexUpsertParams` - `account_id: string` Path param: Identifier - `body: Uploadable` Body param: ndjson file containing vectors to upsert. - `unparsableBehavior?: "error" | "discard"` Query param: Behavior for ndjson parse failures. - `"error"` - `"discard"` ### Returns - `IndexUpsertResponse` - `mutationId?: string` The unique identifier for the async mutation operation containing the changeset. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.vectorize.indexes.upsert('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', body: fs.createReadStream('path/to/file'), }); console.log(response.mutationId); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "mutationId": "0000aaaa-11bb-22cc-33dd-444444eeeeee" }, "success": true } ``` ## Delete Vectors By Identifier `client.vectorize.indexes.deleteByIds(stringindexName, IndexDeleteByIDsParamsparams, RequestOptionsoptions?): IndexDeleteByIDsResponse | null` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/delete_by_ids` Delete a set of vectors from an index by their vector identifiers. ### Parameters - `indexName: string` - `params: IndexDeleteByIDsParams` - `account_id: string` Path param: Identifier - `ids?: Array` Body param: A list of vector identifiers to delete from the index indicated by the path. ### Returns - `IndexDeleteByIDsResponse` - `mutationId?: string` The unique identifier for the async mutation operation containing the changeset. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.vectorize.indexes.deleteByIds('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.mutationId); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "mutationId": "0000aaaa-11bb-22cc-33dd-444444eeeeee" }, "success": true } ``` ## Get Vectors By Identifier `client.vectorize.indexes.getByIds(stringindexName, IndexGetByIDsParamsparams, RequestOptionsoptions?): IndexGetByIDsResponse | null` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/get_by_ids` Get a set of vectors from an index by their vector identifiers. ### Parameters - `indexName: string` - `params: IndexGetByIDsParams` - `account_id: string` Path param: Identifier - `ids?: Array` Body param: A list of vector identifiers to retrieve from the index indicated by the path. ### Returns - `IndexGetByIDsResponse = unknown` Array of vectors with matching ids. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.vectorize.indexes.getByIds('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "some-vector-id", "metadata": { "another-key": "another-value", "customer-id": 442 }, "values": [ 0.812, 0.621, 0.261 ] }, { "id": "other-vector-id", "metadata": { "another-key": "with-a-value", "customer-id": 2151 }, "namespace": "namespaced", "values": [ 0.961, 0.751, 0.661 ] } ], "success": true } ``` ## Get Vectorize Index Info `client.vectorize.indexes.info(stringindexName, IndexInfoParamsparams, RequestOptionsoptions?): IndexInfoResponse | null` **get** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/info` Get information about a vectorize index. ### Parameters - `indexName: string` - `params: IndexInfoParams` - `account_id: string` Identifier ### Returns - `IndexInfoResponse` - `dimensions?: number` Specifies the number of dimensions for the index - `processedUpToDatetime?: string | null` Specifies the timestamp the last mutation batch was processed as an ISO8601 string. - `processedUpToMutation?: string` The unique identifier for the async mutation operation containing the changeset. - `vectorCount?: number` Specifies the number of vectors present in the index ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.vectorize.indexes.info('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.dimensions); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "dimensions": 768, "processedUpToDatetime": "2024-07-22T18:25:44.442097Z", "processedUpToMutation": "0000aaaa-11bb-22cc-33dd-444444eeeeee", "vectorCount": 300000 }, "success": true } ``` ## List Vectors `client.vectorize.indexes.listVectors(stringindexName, IndexListVectorsParamsparams, RequestOptionsoptions?): IndexListVectorsResponse | null` **get** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/list` Returns a paginated list of vector identifiers from the specified index. ### Parameters - `indexName: string` - `params: IndexListVectorsParams` - `account_id: string` Path param: Identifier - `count?: number` Query param: Maximum number of vectors to return - `cursor?: string` Query param: Cursor for pagination to get the next page of results ### Returns - `IndexListVectorsResponse` - `count: number` Number of vectors returned in this response - `isTruncated: boolean` Whether there are more vectors available beyond this response - `totalCount: number` Total number of vectors in the index - `vectors: Array` Array of vector items - `id: string` Identifier for a Vector - `cursorExpirationTimestamp?: string | null` When the cursor expires as an ISO8601 string - `nextCursor?: string | null` Cursor for the next page of results ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.vectorize.indexes.listVectors('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.count); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "count": 100, "isTruncated": true, "totalCount": 500, "vectors": [ { "id": "some-vector-id-023e105f4ecef8ad9ca31a8372d0c353" } ], "cursorExpirationTimestamp": "2025-08-12T20:32:52.469144957+00:00", "nextCursor": "suUTaDY5PFUiRweVccnzyt9n75suNPbXHPshvCzue5mHjtj7Letjvzlza9eGj099" }, "success": true } ``` ## Domain Types ### Create Index - `CreateIndex` - `config?: IndexDimensionConfiguration` - `dimensions: number` Specifies the number of dimensions for the index - `metric: "cosine" | "euclidean" | "dot-product"` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` - `created_on?: string` Specifies the timestamp the resource was created as an ISO8601 string. - `description?: string` Specifies the description of the index. - `modified_on?: string` Specifies the timestamp the resource was modified as an ISO8601 string. - `name?: string` ### Index Delete Vectors By ID - `IndexDeleteVectorsByID` - `count?: number` The count of the vectors successfully deleted. - `ids?: Array` Array of vector identifiers of the vectors that were successfully processed for deletion. ### Index Dimension Configuration - `IndexDimensionConfiguration` - `dimensions: number` Specifies the number of dimensions for the index - `metric: "cosine" | "euclidean" | "dot-product"` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` ### Index Insert - `IndexInsert` - `count?: number` Specifies the count of the vectors successfully inserted. - `ids?: Array` Array of vector identifiers of the vectors successfully inserted. ### Index Query - `IndexQuery` - `count?: number` Specifies the count of vectors returned by the search - `matches?: Array` Array of vectors matched by the search - `id?: string` Identifier for a Vector - `metadata?: unknown` - `score?: number` The score of the vector according to the index's distance metric - `values?: Array | null` ### Index Upsert - `IndexUpsert` - `count?: number` Specifies the count of the vectors successfully inserted. - `ids?: Array` Array of vector identifiers of the vectors successfully inserted. ### Index Delete Response - `IndexDeleteResponse = unknown | string | null` - `unknown` - `string` ### Index Insert Response - `IndexInsertResponse` - `mutationId?: string` The unique identifier for the async mutation operation containing the changeset. ### Index Query Response - `IndexQueryResponse` - `count?: number` Specifies the count of vectors returned by the search - `matches?: Array` Array of vectors matched by the search - `id?: string` Identifier for a Vector - `metadata?: unknown` - `namespace?: string | null` - `score?: number` The score of the vector according to the index's distance metric - `values?: Array | null` ### Index Upsert Response - `IndexUpsertResponse` - `mutationId?: string` The unique identifier for the async mutation operation containing the changeset. ### Index Delete By IDs Response - `IndexDeleteByIDsResponse` - `mutationId?: string` The unique identifier for the async mutation operation containing the changeset. ### Index Get By IDs Response - `IndexGetByIDsResponse = unknown` Array of vectors with matching ids. ### Index Info Response - `IndexInfoResponse` - `dimensions?: number` Specifies the number of dimensions for the index - `processedUpToDatetime?: string | null` Specifies the timestamp the last mutation batch was processed as an ISO8601 string. - `processedUpToMutation?: string` The unique identifier for the async mutation operation containing the changeset. - `vectorCount?: number` Specifies the number of vectors present in the index ### Index List Vectors Response - `IndexListVectorsResponse` - `count: number` Number of vectors returned in this response - `isTruncated: boolean` Whether there are more vectors available beyond this response - `totalCount: number` Total number of vectors in the index - `vectors: Array` Array of vector items - `id: string` Identifier for a Vector - `cursorExpirationTimestamp?: string | null` When the cursor expires as an ISO8601 string - `nextCursor?: string | null` Cursor for the next page of results # Metadata Index ## List Metadata Indexes `client.vectorize.indexes.metadataIndex.list(stringindexName, MetadataIndexListParamsparams, RequestOptionsoptions?): MetadataIndexListResponse | null` **get** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/metadata_index/list` List Metadata Indexes for the specified Vectorize Index. ### Parameters - `indexName: string` - `params: MetadataIndexListParams` - `account_id: string` Identifier ### Returns - `MetadataIndexListResponse` - `metadataIndexes?: Array` Array of indexed metadata properties. - `indexType?: "string" | "number" | "boolean"` Specifies the type of indexed metadata property. - `"string"` - `"number"` - `"boolean"` - `propertyName?: string` Specifies the indexed metadata property. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const metadataIndices = await client.vectorize.indexes.metadataIndex.list('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(metadataIndices.metadataIndexes); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "metadataIndexes": [ { "indexType": "number", "propertyName": "some-num-prop" }, { "indexType": "string", "propertyName": "some-str-prop" }, { "indexType": "boolean", "propertyName": "some-bool-prop" } ] }, "success": true } ``` ## Create Metadata Index `client.vectorize.indexes.metadataIndex.create(stringindexName, MetadataIndexCreateParamsparams, RequestOptionsoptions?): MetadataIndexCreateResponse | null` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/metadata_index/create` Enable metadata filtering based on metadata property. Limited to 10 properties. ### Parameters - `indexName: string` - `params: MetadataIndexCreateParams` - `account_id: string` Path param: Identifier - `indexType: "string" | "number" | "boolean"` Body param: Specifies the type of metadata property to index. - `"string"` - `"number"` - `"boolean"` - `propertyName: string` Body param: Specifies the metadata property to index. ### Returns - `MetadataIndexCreateResponse` - `mutationId?: string` The unique identifier for the async mutation operation containing the changeset. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const metadataIndex = await client.vectorize.indexes.metadataIndex.create('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', indexType: 'string', propertyName: 'random_metadata_property', }); console.log(metadataIndex.mutationId); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "mutationId": "0000aaaa-11bb-22cc-33dd-444444eeeeee" }, "success": true } ``` ## Delete Metadata Index `client.vectorize.indexes.metadataIndex.delete(stringindexName, MetadataIndexDeleteParamsparams, RequestOptionsoptions?): MetadataIndexDeleteResponse | null` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/metadata_index/delete` Allow Vectorize to delete the specified metadata index. ### Parameters - `indexName: string` - `params: MetadataIndexDeleteParams` - `account_id: string` Path param: Identifier - `propertyName: string` Body param: Specifies the metadata property for which the index must be deleted. ### Returns - `MetadataIndexDeleteResponse` - `mutationId?: string` The unique identifier for the async mutation operation containing the changeset. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const metadataIndex = await client.vectorize.indexes.metadataIndex.delete('example-index', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', propertyName: 'random_metadata_property', }); console.log(metadataIndex.mutationId); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "mutationId": "0000aaaa-11bb-22cc-33dd-444444eeeeee" }, "success": true } ``` ## Domain Types ### Metadata Index List Response - `MetadataIndexListResponse` - `metadataIndexes?: Array` Array of indexed metadata properties. - `indexType?: "string" | "number" | "boolean"` Specifies the type of indexed metadata property. - `"string"` - `"number"` - `"boolean"` - `propertyName?: string` Specifies the indexed metadata property. ### Metadata Index Create Response - `MetadataIndexCreateResponse` - `mutationId?: string` The unique identifier for the async mutation operation containing the changeset. ### Metadata Index Delete Response - `MetadataIndexDeleteResponse` - `mutationId?: string` The unique identifier for the async mutation operation containing the changeset.