Skip to main content
Version: 2.0

Create and Use API Keys

API Keys enable controlled, anonymous access to several administrative tasks, indexing your data, and running semantic searches on your corpora—handy for platform admins setting up systems or app developers integrating public-facing websites. This greatly simplifies integration from public-facing systems like websites.

Selecting the wrong key type, or using it incorrectly, can result in errors or expose your system to unnecessary risk. If a key is compromised, you can quickly revoke the key and replace it in minutes.

Note

If you create a new corpus, generate a new API key to access its data. You will not be able to access it with existing API keys. Existing keys are bound to their original corpus.

This guide helps you:

  • Select the right key type for your use case, whether admin or app-focused
  • Avoid permission errors tied to scoping or misuse
  • Secure your credentials properly

Prerequisites

  • Access to the Vectara Console
  • Have at least one corpus
  • Admin or Indexing privileges on the corpus
API Key TypeKey PrefixAllowed OperationsScopeRecommended Usage
Personal Keyzut_All user-level operationsAccount-wideAdmin tasks, Developers for testing, internal scripts
QueryService Keyzqt_Read-only searchCorpus-specificDevelopers for public-facing search, front-end apps
IndexService Keyzwt_Index and queryCorpus-specificDevelopers for ingestion and server-side testing

Best practices

  • ✅ Use unique keys per use case or microservice
  • ✅ Apply the principle of least privilege by assigning the minimal set of permissions needed to accomplish your goal
  • 🔄 Rotate API keys periodically and revoke unused ones
  • 🔒 Never embed Personal or IndexService keys in client-side code. Store them on your server instead.

Personal API key

The Personal API Key helps developers in early stages of exploration and prototyping with Vectara, or platform admins setting up initial configurations. This method provides a straightforward getting started experience for integrating accounts with external applications without the complexity of OAuth authentication. You can use the Personal API Key when putting together a quick prototype, or if you are working on an integration that does not yet support OAuth 2.0.

Supported actions: Creating, deleting, and listing corpora, managing API keys for accessible corpora, reading usage data, updating corpora filters, executing queries, and indexing.

Unsupported actions: Deleting an account, validating a registration, transferring account ownership, deleting users, or accessing billing data.

caution

A Personal API Key inherits the permissions of its associated user account. For example, a key generated by a billing admin will only possess billing admin-related permissions. Because of their broad access, treat Personal API Keys with the same caution as passwords.

QueryService API keys

We recommend QueryService API keys for read-only querying operations and for developers embedding in code that runs in potentially insecure environments like web browsers or mobile apps. Query API Keys provide the least amount of risk because they have a limited scope and do not modify account data.

IndexService API keys

IndexService API Keys offer a practical solution for Developers and ML Engineers needing read and write access during development and testing phases. Because they also provide write access, IndexService API Keys are more powerful than Query API Keys and should be treated like passwords and used with caution in production environments.

important

In terms of billing, account owners are responsible for charges incurred through anonymous access to your account with any of these API keys.

warning

🔒 Always keep your API Keys and OAuth tokens private. Do not share them through email, Slack, Discord, forums, or other public channels because it can lead to unauthorized access. Treat these keys with the same confidentiality as your personal credentials.

Vectara API endpoints and required API key types

This table lists all endpoints, HTTP methods, their summary, and which API key types are allowed for each.

tip

The Personal Key is always allowed anywhere a more restricted key is allowed (except admin-only endpoints).

MethodPathSummaryAllowed Key Types
POST/v2/corporaCreate a corpusPersonal Key
GET/v2/corporaList corporaQueryService Key, Personal Key
GET/v2/corpora/{corpus_key}Retrieve metadata about a corpusQueryService Key, Personal Key
DELETE/v2/corpora/{corpus_key}Delete a corpus and all its dataPersonal Key
PATCH/v2/corpora/{corpus_key}Update a corpusPersonal Key
POST/v2/corpora/{corpus_key}/resetRemove all documents and data in a corpusPersonal Key
POST/v2/corpora/{corpus_key}/replace_filter_attributesReplace the filter attributes of a corpusPersonal Key
POST/v2/corpora/{corpus_key}/compute_sizeCompute the current size of a corpusPersonal Key
POST/v2/corpora/{corpus_key}/upload_fileUpload a file to the corpusPersonal Key
POST/v2/corpora/{corpus_key}/documentsAdd a document to a corpusPersonal Key
GET/v2/corpora/{corpus_key}/documentsList the documents in the corpusQueryService Key, Personal Key
DELETE/v2/corpora/{corpus_key}/documents/{document_id}Delete a documentPersonal Key
GET/v2/corpora/{corpus_key}/documents/{document_id}Retrieve a documentQueryService Key, Personal Key
PATCH/v2/corpora/{corpus_key}/documents/{document_id}Update document, merging the metadata.Personal Key
PUT/v2/corpora/{corpus_key}/documents/{document_id}/metadataReplace the document metadata.IndexService Key, Personal Key
POST/v2/corpora/{corpus_key}/documents/{document_id}/summarizeSummarize a documentPersonal Key
GET/v2/corpora/{corpus_key}/querySimple Single Corpus QueryQueryService Key, Personal Key
POST/v2/corpora/{corpus_key}/queryAdvanced Single Corpus QueryQueryService Key, Personal Key
POST/v2/queryMultiple Corpora QueryQueryService Key, Personal Key
GET/v2/queries/{query_id}Get a query historyQueryService Key, Personal Key
GET/v2/queriesList the history of previous queriesQueryService Key, Personal Key
POST/v2/chatsStart a chatIndexService Key, Personal Key
GET/v2/chatsList chatsQueryService Key, Personal Key
GET/v2/chats/{chat_id}Get a chatQueryService Key, Personal Key
DELETE/v2/chats/{chat_id}Delete a chatPersonal Key
POST/v2/chats/{chat_id}/turnsCreate a new turn in the chatIndexService Key, Personal Key
GET/v2/chats/{chat_id}/turnsList turns in a chatQueryService Key, Personal Key
GET/v2/chats/{chat_id}/turns/{turn_id}Get a turnQueryService Key, Personal Key
DELETE/v2/chats/{chat_id}/turns/{turn_id}Delete a turnPersonal Key
PATCH/v2/chats/{chat_id}/turns/{turn_id}Update a turnIndexService Key, Personal Key
POST/v2/llmsCreate an LLMIndexService Key, Personal Key
GET/v2/llmsList LLMsQueryService Key, Personal Key
GET/v2/llms/{llm_id}Get an LLMQueryService Key, Personal Key
DELETE/v2/llms/{llm_id}Delete an LLMPersonal Key
POST/v2/llms/chat/completionsCreates a model response for the given chat conversationIndexService Key, Personal Key
GET/v2/generation_presetsList generation presetsQueryService Key, Personal Key
POST/v2/evaluate_factual_consistencyEvaluate factual consistencyPersonal Key
POST/v2/encodersCreate an encoderIndexService Key, Personal Key
GET/v2/encodersList encodersQueryService Key, Personal Key
GET/v2/rerankersList rerankersQueryService Key, Personal Key
GET/v2/table_extractorsList supported table extractorsQueryService Key, Personal Key
GET/v2/hallucination_correctorsList hallucination correctorsQueryService Key, Personal Key
POST/v2/hallucination_correctors/correct_hallucinationsCorrects hallucinations in generated text based on source documentsPersonal Key
GET/v2/jobsList jobsQueryService Key, Personal Key
GET/v2/jobs/{job_id}Get a job by IDQueryService Key, Personal Key
POST/v2/usersCreate a user in the current customer accountPersonal Key
GET/v2/usersList users in the accountPersonal Key
GET/v2/users/{username}Get a userPersonal Key
PATCH/v2/users/{username}Update a userPersonal Key
DELETE/v2/users/{username}Delete a userPersonal Key
POST/v2/users/{username}/reset_passwordReset the password for a userPersonal Key
POST/v2/api_keysCreate an API keyPersonal Key
GET/v2/api_keysList API keysPersonal Key
GET/v2/api_keys/{api_key_id}Get an API keyPersonal Key
PATCH/v2/api_keys/{api_key_id}Update an API keyPersonal Key
DELETE/v2/api_keys/{api_key_id}Delete an API keyPersonal Key
POST/v2/app_clientsCreate an App ClientIndexService Key, Personal Key
GET/v2/app_clientsList App ClientsQueryService Key, Personal Key
GET/v2/app_clients/{app_client_id}Get an App ClientQueryService Key, Personal Key
PATCH/v2/app_clients/{app_client_id}Update an App ClientIndexService Key, Personal Key
DELETE/v2/app_clients/{app_client_id}Delete an App ClientPersonal Key
POST/oauth/tokenRequest an access tokenPersonal Key

Create an API key

You can easily create a Personal API key or an IndexService or QueryService API Key, and then simply embed the API key and directly pass it to Vectara when issuing requests.

Use an API key

To use a Personal, IndexService, or QueryService API key, pass it using the x-api-key header request.

CODE EXAMPLE
1

Common issues and how to resolve them

IssueCauseFix
403: Permission DeniedKey not scoped to corpusRecreate key with correct corpus_key
401: UnauthorizedInvalid or missing key in headerEnsure x-api-key is correctly included
Indexing fails with Query keyUsed wrong key typeUse IndexService (zwt_) or Personal (zut_) key
Personal key used in browserSecurity vulnerabilityUse QueryService key for public search apps

Disable, enable, and delete API keys

To temporarily disable access to an API key, navigate to the API keys tab.

Disable a personal API key

Click the Actions drop-down and select Disable. You can also regenerate the Personal API key from this menu.

Disable Personal API Key

Disable an IndexService or QueryService key

Click the drop-down menu and select Disable. This menu also lets you copy, delete, and reenable the API key.

Disable IndexService or QueryService API Key

It will take around a minute for query requests using this key to be blocked.

Important
  • Once you disable an API key, you can enable it again through same action menus. It can take a couple minutes before it can serve query traffic again.
  • Once delete an index or query API key, you cannot undelete it. All external systems that issue queries using the key will be blocked.

Next Steps