Skip to main content
POST
Create Tenant

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_id returns 409 CONFLICT
  • Async: Yes – returns status: accepted. Poll /tenants/infra/status before use.

Example

Request parameters

Response

Metadata schema

tenant_metadata_schema defines fields that all documents in the tenant inherit. Each entry has: Valid 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.
Schema field names are immutable after tenant creation. You can add new additional_metadata fields per document at ingestion time, but tenant-level fields cannot be renamed or removed. Plan the schema carefully before creating the tenant.

Metadata schema examples

The following patterns cover the most common shapes of tenant_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.
Values written under metadata.environment at ingestion time can then be filtered exactly during recall:
Multiple 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.
When multiple keys are passed in 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.
  • region has enable_match: true and can be used in metadata_filters.
  • internal_notes has no enable_match, so it cannot be used in metadata_filters. It is stored but not filterable.
  • For free-form display or bookkeeping fields that do not need filtering, prefer additional_metadata at 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: true for fields you intend to filter on exactly via metadata_filters.
  • Use enable_dense_embedding / enable_sparse_embedding for VARCHAR fields that should be searchable as text.
  • These flags are independent: an embedding-enabled field is not automatically usable as a metadata_filters key.

Behavior notes

Tenant creation is asynchronous. Always poll 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.
Default sub-tenant. A default sub-tenant is auto-created with your tenant. Any API call that omits sub_tenant_id targets this default. See Essentials → Multi-Tenant for details.

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 → Metadata

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

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:

tenant_id
string
required

Unique tenant identifier

Minimum string length: 1
Example:

"tenant_1234"

is_embeddings_tenant
boolean
default:false

True to create embeddings tenant

Example:

true

embeddings_dimension
integer | null
default:1536

Embedding dimensions for embeddings tenant. Not required for non-embeddings (is_embeddings_tenant=False) tenants

tenant_metadata_schema
CustomPropertyDefinition · object[] | null

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.

Example:

Response

Successful Response

Response when tenant creation is accepted and runs in the background.

tenant_id
string
required

Tenant identifier that is being created

Example:

"tenant_1234"

status
string
default:accepted

Status of the request

message
string
default:Tenant creation started in the background. Use GET /tenants/infra/status?tenant_id=... to check progress.

Response message