Create Tenant
Create an isolated workspace for your data.
When to use it
Creating a new tenant is the first step before any ingestion or recall. A tenant is a fully isolated workspace – no tenant can read another tenant’s data. In most cases, you create one tenant per organization. For per-user isolation (B2C), you use sub-tenants inside a single tenant.Endpoint
- Auth: Bearer token
- Idempotency: Re-sending with the same
tenant_idreturns409 CONFLICT - Async: Yes – returns
status: accepted. Poll/tenants/infra/statusbefore use.
Example
Request parameters
Response
Metadata schema
tenant_metadata_schema defines fields that all documents in the tenant inherit. Each entry has:
data_type values:
BOOL, INT8, INT16, INT32, INT64, FLOAT, DOUBLE, VARCHAR, JSON, ARRAY, FLOAT_VECTOR, SPARSE_FLOAT_VECTOR.
For text fields that need to be semantically searchable, use VARCHAR with enable_dense_embedding: true. For keyword (BM25) searchability, add enable_sparse_embedding: true. For fields that must be filterable via metadata_filters, use enable_match: true. These flags are independent and can be combined.
Metadata schema examples
The following patterns cover the most common shapes oftenant_metadata_schema. Each example shows only the schema entries – wrap them in a full POST /tenants/create request like the Example above.
Single exact-match filter field
The minimum useful schema field for deterministic filtering with metadata_filters is a VARCHAR field with enable_match: true.
metadata.environment at ingestion time can then be filtered exactly during recall:
enable_match fields
Applications commonly define several stable fields they expect to filter on via metadata_filters. Use INT32, INT64, BOOL, FLOAT, or other typed fields when the value is not a string. Every field that must be filterable requires enable_match: true.
metadata_filters, they combine as structured exact-match constraints – a chunk must satisfy every key to remain a candidate.
Long VARCHAR field
VARCHAR defaults to a max_length of 1024 characters. For longer structured string values – compound identifiers, full label strings, or composite tags – set max_length explicitly.
enable_match vs no flag
Only fields declared with enable_match: true are usable in metadata_filters for deterministic filtering. A field without enable_match: true can still be stored in the schema, but passing it as a metadata_filters key will have no effect.
regionhasenable_match: trueand can be used inmetadata_filters.internal_noteshas noenable_match, so it cannot be used inmetadata_filters. It is stored but not filterable.- For free-form display or bookkeeping fields that do not need filtering, prefer
additional_metadataat ingestion time rather than adding them to the tenant schema.
enable_dense_embedding and enable_sparse_embedding fields
enable_dense_embedding makes a field semantically searchable (dense vector). enable_sparse_embedding makes it keyword-searchable (BM25/sparse vector). Use these when the field itself is a body of text you want included in semantic or keyword recall, for example a product_description that should be retrieved alongside the document.
- Use
enable_match: truefor fields you intend to filter on exactly viametadata_filters. - Use
enable_dense_embedding/enable_sparse_embeddingforVARCHARfields that should be searchable as text. - These flags are independent: an embedding-enabled field is not automatically usable as a
metadata_filterskey.
Behavior notes
GET /tenants/infra/status?tenant_id=... before your first ingestion call. Both values in vectorstore_status and graph_status must be true before the tenant is ready.sub_tenant_id targets this default. See Essentials → Multi-Tenant for details.Related endpoints
- Next: Check infra status – poll until provisioning completes
- Next: Upload knowledge – start ingesting data
- Related: Delete tenant – teardown
Errors
Common codes:400 INVALID_PARAMETERS, 409 TENANT_ALREADY_EXISTS, 422 VALIDATION_ERROR. See Error Responses for the full list.
Read more: Essentials → Multi-Tenant Support · Essentials → MetadataAuthorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request model for creating a tenant with optional metadata schema.
The tenant_metadata_schema allows you to define custom fields that will be indexed in Milvus with configurable search capabilities.
Example:
Unique tenant identifier
1"tenant_1234"
True to create embeddings tenant
true
Embedding dimensions for embeddings tenant. Not required for non-embeddings (is_embeddings_tenant=False) tenants
Schema definition for tenant metadata fields. Each field can be configured for: filtering (enable_match), semantic search (enable_dense_embedding), and/or keyword search (enable_sparse_embedding). Fields with embeddings enabled must be VARCHAR type.
Response
Successful Response
Response when tenant creation is accepted and runs in the background.