HTTP API Reference
A complete reference for Infinity's Python APIs.
SCHEMA MANAGEMENT
Create database
POST /databases/{database_name}
Creates a database by its name. If the database already exists, the action taken depends on the "create_option"
parameter.
Request
- Method: POST
- URL:
/database/{database_name}
- Headers:
accept: application/json
content-Type: application/json
- Body:
"create_option"
:enum<string>
Request example
curl --request POST \
--url http://localhost:23820/databases/{database_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {"create_option": "ignore_if_exists"} '
Request parameters
database_name
: (Path parameter)
The name of the database, which must adhere to the following requirements:- Permitted characters include:
- English letters (a-z, A-Z)
- Digits (0-9)
- "_" (underscore)
- Must begin with an English letter or underscore.
- Maximum 65,535 characters.
- Case-insensitive.
- Permitted characters include:
"create_option"
: (Body parameter),enum<string>
, Optional"error"
: (Default) Raise an error if a database with the same name exists."ignore_if_exists"
: Ignore the database creation request and keep the existing database.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code"
:integer
0
: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3016,
"error_message": "Duplicate database: {database_name}."
}
"error_code"
:integer
A non-zero value indicates a specific error condition."error_message"
:string
Whenerror_code
is non-zero,"error_message"
provides additional details about the error.
Drop database
DELETE /databases/{database_name}
Deletes a database by its name. If the database does not exist, the action taken depends on the "drop_option"
parameter.
Request
- Method: DELETE
- URL:
/database/{database_name}
- Headers:
accept: application/json
content-Type: application/json
- Body:
"drop_option"
:enum<string>
Request example
curl --request DELETE \
--url http://localhost:23820/databases/{database_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {"drop_option": "error"} '
Request parameter
database_name
: (Path parameter)
The name of the database to delete."drop_option"
: (Body parameter),enum<string>
, Optional"error"
: (Default) Raise an error if the specified database does not exist."ignore_if_not_exists"
: Ignore the operation and proceed regardless, if the specified database does not exist.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code"
:integer
0
: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3021,
"error_message": "{database_name} doesn't exist."
}
"error_code"
:integer
A non-zero value indicates a specific error condition."error_message"
:string
Whenerror_code
is non-zero,"error_message"
provides additional details about the error.
List databases
GET /databases
Retrieves a list of all available databases within the Infinity system.
Request
- Method: GET
- URL:
/databases
- Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases \
--header 'accept: application/json'
Response
Status code 200
The response includes a JSON object like the following:
{
"error_code": 0,
"databases": [
"default_db",
"my_db"
]
}
"error_code"
:integer
0
: The operation succeeds.databases
:string[]
An array of strings representing the names of the databases in the system.
Show database
GET /databases/{database_name}
Shows detailed information about a specified database.
Request
- Method: GET
- URL:
/database/{database_name}
- Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name} \
--header 'accept: application/json'
Request parameter
database_name
: (Path parameter)
The name of the database to retrieve.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0,
"database_name": "default_db"
"storage_directory": "/var/infinity/data/nIHniKeHIB_db_default"
"table_count": "4"
}
"error_code"
:integer
0
: The operation succeeds.database_name
:string
The name of the database.storage_directory
:string
The directory path where the database is stored.table_count
:integer
The number of tables present in the database.
The response includes a JSON object like the following:
{
"error_code": 3021,
"error_message": "{database_name} doesn't exist."
}
"error_code"
:integer
A non-zero value indicates a specific error condition."error_message"
:string
Whenerror_code
is non-zero,"error_message"
provides additional details about the error.
Create table
POST /databases/{database_name}/tables/{table_name}
Creates a table with a specified name and defined fields (columns) within a given database. If the table already exists, the action taken depends on the "create_option"
parameter.
Request
- Method: POST
- URL:
/databases/{database_name}/tables/{table_name}
- Headers:
accept: application/json
content-Type: application/json
- Body:
"create_option"
:enum<string>
"fields"
:object[]
Request example
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {
"create_option": "ignore_if_exists",
"fields": [
{
"name": "name",
"type": "varchar",
"comment": "name column"
},
{
"name": "score",
"type": "float",
"default": 3.0
},
{
"name": "dense_column",
"type": "vector,8,float",
"default": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
},
{
"name": "fulltext_column",
"type": "varchar",
"default": ""
},
{
"name": "sparse_column",
"type": "sparse,128,float,int",
"default": {"10":1.1, "20":2.2, "30": 3.3}
},
{
"name": "tensor_column",
"type": "tensor,4,float",
"default": [[1.0, 0.0, 0.0, 0.0], [1.1, 0.0, 0.0, 0.0]]
},
{
"name": "multivector_column",
"type": "multivector,4,float",
"default": [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]
},
{
"name": "tensorarray_column",
"type": "tensorarray,2,float",
"default": [[[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0]]]
}
]
} '
Request parameters
database_name
: (Path parameter)
The name of the database.table_name
: (Path parameter)
The name of the table to create, which must adhere to the following requirements:- Permitted characters include:
- English letters (a-z, A-Z)
- Digits (0-9)
- "_" (underscore)
- Must begin with an English letter or underscore.
- Maximum 65,535 characters.
- Case-insensitive.
- Permitted characters include:
"create_option"
: (Body parameter),enum<string>
, Optional"error"
: (Default) Raise an error if a table with the same name exists."ignore_if_exists"
: Ignore the table creation request and keep the existing table.
field
: (Body parameter),object[]
, Required"name"
:string
, Required
A non-empty string indicating the name of the column to create, which must adhere to the following requirements:- Permitted characters include:
- English letters (a-z, A-Z)
- Digits (0-9)
- "_" (underscore)
- Must begin with an English letter or underscore.
- Maximum 65,535 characters.
- Case-insensitive.
- Permitted characters include:
"type"
:string
, Required
The data type of the column.- Numeric:
"int8"
"int16"
"int"
/"int32"
/"integer"
"int64"
"float"
/"float32"
"double"
/"float64"
"float16"
"bfloat16"
- String:
"varchar"
- Dense vector: e.g.,
"vector,128,float"
vector
: The column is a dense vector column.- The second item in the string: The dimension of dense vectors.
- The third item in the string: The element type of dense vectors. Can be:
"int8"
"int16"
"int"
/"int32"
/"integer"
"int64"
"float"
/"float32"
"double"
/"float64"
"float16"
"bfloat16"
- Sparse vector: e.g.,
"sparse,128,float,int"
sparse
: The column is a sparse vector column.- The second item in the string: The dimension of sparse vectors.
- The third item in the string: The element type of sparse vectors. Can be:
"int8"
"int16"
"int"
/"int32"
/"integer"
"int64"
"float"
/"float32"
"double"
/"float64"
"float16"
"bfloat16"
- The fourth item in the string: The data type of the sparse vector indices. Can be:
int8
int16
int
/int32
/integer
int64
- Tensor vector: e.g.,
"tensor,4,float"
tensor
: The column is a tensor column.- The second item in the string: The dimension of each vector unit in a tensor.
- The third item in the string: The element type of the tensors. Can be:
"int8"
"int16"
"int"
/"int32"
/"integer"
"int64"
"float"
/"float32"
"double"
/"float64"
"float16"
"bfloat16"
- Tensor array: e.g.,
"tensorarray,6,float"
tensorarray
: The column is a tensor-array column.- The second item in the string: The dimension of each vector unit in a tensor array.
- The third item in the string: The element type of tensor arrays. Can be:
"int8"
"int16"
"int"
/"int32"
/"integer"
"int64"
"float"
/"float32"
"double"
/"float64"
"float16"
"bfloat16"
- Multivector: e.g.,
"multivector,128,float"
multivector
: The column is a multi-vector column.- The second item in the string: The dimension of each vector unit in a multi-vector.
- The third item in the string: The element type of multi-vectors. Can be:
"int8"
"int16"
"int"
/"int32"
/"integer"
"int64"
"float"
/"float32"
"double"
/"float64"
"float16"
"bfloat16"
- Numeric:
"default"
:Any
, Optional
The default value for unspecified cells in that column."comment"
:string
, Optional User provided text to describe the column.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code"
:integer
0
: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3017,
"error_message": "Duplicate table: {table_name} in {database_name}."
}
"error_code"
:integer
A non-zero value indicates a specific error condition."error_message"
:string
Whenerror_code
is non-zero,"error_message"
provides additional details about the error.
Drop table
DELETE /databases/{database_name}/tables/{table_name}
Deletes a table from a specified database. If the table does not exist, the action taken depends on the "drop_option"
parameter.
Request
- Method: DELETE
- URL:
/databases/{database_name}/tables/{table_name}
- Headers:
accept: application/json
content-Type: application/json
- Body:
"drop_option"
:enum<string>
Request example
curl --request DELETE \
--url http://localhost:23820/databases/{database_name}/tables/{table_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {"drop_option": "ignore_if_not_exists"} '
Request parameters
database_name
: (Path parameter)
The name of the database.table_name
: (Path parameter)
The name of the table to delete."drop_option"
: (Body parameter),enum<string>
, Optional"error"
: (Default) Raise an error if the specified table does not exist."ignore_if_not_exists"
: Ignore the operation and proceed regardless, if the specified database does not exist.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code"
:integer
0
: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3022,
"error_message": "Table {table_name} doesn't exist in {database_name}."
}
"error_code"
:integer
A non-zero value indicates a specific error condition."error_message"
:string
Whenerror_code
is non-zero,"error_message"
provides additional details about the error.
List tables
GET /databases/{database_name}/tables
Retrieves a list of all available tables in a specified database.
Request
- Method: GET
- URL:
/databases/{database_name}/tables
- Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name}/tables \
--header 'accept: application/json'
Request parameters
database_name
: (Path parameter)
The name of the database.
Response
Status code 200
The response includes a JSON object like the following:
{
"error_code": 0,
"tables":
[
"table_1",
"table_2",
"table_n"
]
}
"error_code"
:integer
0
: The operation succeeds.
Show table
GET /databases/{database_name}/tables/{table_name}
Shows detailed information about a specified table within a given database.
Request
- Method: GET
- URL:
/databases/{database_name}/tables/{table_name}
- Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name}/tables/{table_name} \
--header 'accept: application/json'
Request parameters
database_name
: (Path parameter)
The name of the database.table_name
: (Path parameter)
The name of the table.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0,
"database_name": "default_db",
"table_name": "my_table",
"storage_directory": "/var/infinity/data/nIHniKeHIB_db_default/h1abZcWuBs_table_my_table",
"column_count" : 3,
"segment_count" : 1,
"row_count" : 5
}
"error_code"
:integer
0
: The operation succeeds.
A 500
HTTP status code indicates an error condition. The response includes a JSON object like the following:
{
"error_code": 3022,
"error_message": "Table {table_name} doesn't exist in {database_name}."
}
"error_code"
:integer
A non-zero value indicates a specific error condition."error_message"
:string
Whenerror_code
is non-zero,"error_message"
provides additional details about the error.
Show table columns
GET /databases/{database_name}/tables/{table_name}/columns
Shows the column information about a specified table.
Request
- Method: GET
- URL:
/databases/{database_name}/tables/{table_name}/columns
- Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/columns \
--header 'accept: application/json'
Request parameters
database_name
: (Path parameter)
The name of the database.table_name
: (Path parameter)
The name of the table.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0,
"columns":
[
{
"column_name": "name",
"column_type": "Varchar",
"constraints": "",
"default": "Null"
},
{
"column_name": "score",
"column_type": "Float",
"constraints": "",
"default": "Null",
}
{
"column_name": "vector_column",
"column_type": "Embedding(float,8)",
"constraints": "",
"default": "Null"
},
]
}
"error_code"
:integer
0
: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3022,
"error_message": "Table {table_name} doesn't exist in {database_name}."
}
"error_code"
:integer
A non-zero value indicates a specific error condition."error_message"
:string
Whenerror_code
is non-zero,"error_message"
provides additional details about the error.
Create index
POST /databases/{database_name}/tables/{table_name}/indexes/{index_name}
Creates an index on a specified table. If an index with the same name exists, the action taken depends on the "create_option"
parameter.
Request
- Method: POST
- URL:
/databases/{database_name}/tables/{table_name}/indexes/{index_name}
- Headers:
accept: application/json
content-Type: application/json
- Body:
"fields"
:string[]
"index"
:object
"create_option"
:enum<string>
Request example
- Creates an HNSW index on a dense vector or a multivector column:
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"fields":
[
"dense_column"
],
"index":
{
"type": "Hnsw",
"M": "16",
"ef_construction": "50",
"metric": "l2"
},
"create_option": "ignore_if_exists"
} '
- Creates a full-text index on a full-text column:
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"fields":
[
"fulltext_column"
],
"index":
{
"type": "fulltext",
"analyzer": "chinese"
},
"create_option": "ignore_if_exists"
} '
- Creates a BMP index on a sparse column
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"fields":
[
"sparse_column"
],
"index":
{
"type": "BMP",
"block_size": "16",
"compress_type": "raw"
},
"create_option": "ignore_if_exists"
} '
- Creates a secondary index on a varchar column
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"fields":
[
"varchar_column"
],
"index":
{
"type": "Secondary"
},
"create_option": "ignore_if_exists"
} '
Request parameters
database_name
: (Path parameter)
The name of the database.table_name
: (Path parameter)
The name of the table.index_name
: (Path parameter)
The name of the index to create, which must adhere to the following requirements:- Permitted characters include:
- English letters (a-z, A-Z)
- Digits (0-9)
- "_" (underscore)
- Must begin with an English letter or underscore.
- Maximum 65,535 characters.
- Case-insensitive.
- Permitted characters include:
"fields"
: (Body parameter),string[]
, Required
A non-empty list of strings indicating the names of the columns to build index on. For now, you are only allowed to create an index on one column."index"
: (Body parameter),dict[string, string]
- Parameter settings for an HNSW index:
"type"
:"hnsw"
"M"
: Optional - Defaults to"16"
."ef_construction"
: Optional - Defaults to"50"
."metric"
Required - The distance metric to use in similarity search."ip"
: Inner product."l2"
: Euclidean distance."cosine"
: Cosine similarity.
"encode"
: Optional"plain"
: (Default) Plain encoding."lvq"
: Locally-adaptive vector quantization. Works with float vector element only.
- Parameter settings for an IVF index:
"metric"
Required - The distance metric to use in similarity search."ip"
: Inner product."l2"
: Euclidean distance."cosine"
: Cosine similarity.
"storage_type"
: Optional"plain"
: (Default) Plain storage."scalar_quantization"
: Scalar quantization."product_quantization"
: Product quantization.
"plain_storage_data_type"
: Optional for plain storage."int8"
: default value forint8
embeddings."uint8"
: default value foruint8
embeddings."float32"
: default value for floating-point embeddings."float16"
: for floating-point embeddings."bfloat16"
: for floating-point embeddings.
"scalar_quantization_bits"
: Required for scalar quantization. Must be either4
or8
."product_quantization_subspace_num"
: Required for product quantization. Must be divisor of the embedding dimension."product_quantization_subspace_bits"
: Required for product quantization. Must be in the range[4, 16]
.
- Parameter settings for a full-text index:
"type"
:"fulltext"
"ANALYZER"
: Optional"standard"
: (Default) Standard analyzer, segmented by tokens, lowercase processing, provides stemming outputs. Use-
to specify stemmer for languages,English
is the default stemmer:"standard-english"
and"standard"
have the same stemmer setting. Supported language stemmer includes:Danish
,Dutch
,English
,Finnish
,French
,German
,Hungarian
,Italian
,Norwegian
,Porter
,Portuguese
,Romanian
,Russian
,Spanish
,Swedish
,Turkish
."rag"
: Multilingual RAG analyzer imported from RAGFlow, supportingChinese
andEnglish
. Use-fine
to output the fine-grained analyzer results."chinese"
: Simplified Chinese. Use-fine
to output the fine-grained analyzer results."ik"
: Bilingual analyzer imported from ik-analyzer, supportingChinese
andEnglish
. Use-fine
to output the fine-grained analyzer results."traditional"
: Traditional Chinese."japanese"
: Japanese."korean"
: Korean."ngram"
: N-gram."keyword"
: "noop" analyzer used for columns containing keywords only.
- Parameter settings for a secondary index:
"type"
:"secondary"
- Parameter settings for a BMP index:
"type"
:"bmp"
block_size
: Optional - The size of the block in a BMP index. Range:"1"
~"256"
. Defaults to"16"
."compress_type"
: Optional"compress"
: (Default) Store the block-max index in sparse format. Works best with small block size situations."raw"
: Store the block-max index without compression.
- Parameter settings for an HNSW index:
"create_option"
: (Body parameter),enum<string>
, Optional"error"
: (Default) Raise an error if a table with the same name exists."ignore_if_exists"
: Ignore the table creation request and keep the existing table.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code"
:integer
0
: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3018,
"error_message": "Duplicate index: {index} in {table_name}."
}
"error_code"
:integer
A non-zero value indicates a specific error condition."error_message"
:string
Whenerror_code
is non-zero,"error_message"
provides additional details about the error.
Drop index
DELETE /databases/{database_name}/tables/{table_name}/indexes/{index_name}
Deletes an index by its name.
Request
- Method: DELETE
- URL:
/databases/{database_name}/tables/{table_name}/indexes/{index_name}
- Headers:
accept: application/json
content-Type: application/json
- Body:
"drop_option"
:enum<string>
Request example
curl --request DELETE \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {"drop_option": "ignore_if_not_exists"} '
Request parameters
database_name
: (Path parameter)
The name of the database.table_name
: (Path parameter)
The name of the table.index_name
: (Path parameter)
The name of the index to delete."drop_option"
: (Body parameter),enum<string>
, Optional"error"
: (Default) Raise an error if the specified index does not exist."ignore_if_not_exists"
: Ignore the operation and proceed regardless, if the specified index does not exist.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code"
:integer
0
: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3018,
"error_message": "Index {index_name} doesn't exist in {table_name}."
}
"error_code"
:integer
A non-zero value indicates a specific error condition."error_message"
:string
Whenerror_code
is non-zero,"error_message"
provides additional details about the error.
List indexes
GET /databases/{database_name}/tables/{table_name}/indexes
Retrieves a list of all indexes created on a given table.
Request
- Method: GET
- URL:
/databases/{database_name}/tables/{table_name}/indexes
- Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes \
--header 'accept: application/json'
Request parameters
database_name
: (Path parameter)
The name of the database.table_name
: (Path parameter)
The name of the table.
Response
Status code 200
The response includes a JSON object like the following:
{
"error_code": 0,
"indexes":
[
{
"columns": "vector_column_1",
"index_name": "idx1",
"index_type": "HNSW"
},
{
"columns": "vector_column_2",
"index_name": "idx2",
"index_type": "HNSW"
}
]
}
"error_code"
:integer
0
: The operation succeeds.
Show index
GET /databases/{database_name}/tables/{table_name}/indexes/{index_name}
Shows detailed information about a specified index.
Request
- Method: GET
- URL:
/databases/{database_name}/tables/{table_name}/indexes/{index_name}
- Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json'
Request parameters
database_name
: (Path parameter)
The name of the database.table_name
: (Path parameter)
The name of the table.index_name
: (Path parameter)
The name of the index.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0,
"database_name": "default_db",
"table_name": "test_vector_table",
"index_name": "idx1",
"index_column_ids": "2",
"index_column_names": "vector_column",
"index_type": "HNSW",
"other_parameters": "metric = l2, encode_type = plain, M = 16, ef_construction = 50",
"segment_index_count": "0",
"storage_directory": "/var/infinity/data/3C1tizeluV_db_default_db/O0wSJ88IrJ_table_test_vector_table/RYurmCbD5h_index_idx1"
"storage_size": "0B"
}
"error_code"
:integer
0
: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3018,
"error_message": "Index {index_name} doesn't exist in {table_name}."
}
"error_code"
:integer
A non-zero value indicates a specific error condition."error_message"
:string
Whenerror_code
is non-zero,"error_message"
provides additional details about the error.