Skip to main content
Version: 2.0

API key management

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.

Assigning the wrong permissions, or using a key 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:

  • Assign the right API and resource permissions for your use case
  • 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

Create a personal API key with api_key_role: personal. For scoped API keys, assign the required customer-level api_roles, corpus-specific corpus_roles, and agent-specific agent_roles. The legacy api_key_role values serving and serving_and_indexing are deprecated for creating keys.

API key configurationAllowed operationsScopeRecommended usage
Personal API keyInherits the creating user's permissionsThe resources available to that userDevelopment, testing, and administrative work performed as that user
API key with query permissionsOperations granted by its assigned query rolesResources named by its role assignmentsApplications that only need query access
API key with indexing and query permissionsOperations granted by its assigned indexing and query rolesResources named by its role assignmentsProtected backend ingestion and query workloads

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 keys or keys with indexing permissions 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.

API keys with query permissions

Assign only the query roles and resource-specific roles the application needs. A query-scoped key cannot modify resources unless one of its assigned roles also grants a write operation. Treat a key embedded in browser or mobile code as visible to the end user and restrict its permissions accordingly.

API keys with indexing and query permissions

Assign indexing and query roles only to protected backend workloads that need both capabilities. Because these keys can modify indexed data, treat them like passwords and do not expose them in browser or mobile code.

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 permissions

This table lists the endpoints, HTTP methods, their summary, and the API key permission profile required for each.

tip

A personal API key has the same permissions as its owner. Whether it can call an endpoint therefore depends on that user's assigned roles.

MethodPathSummaryRequired permission profile
POST/v2/corporaCreate a corpusPersonal API key
GET/v2/corporaList corporaAPI key with query permissions, Personal API key
GET/v2/corpora/{corpus_key}Retrieve metadata about a corpusAPI key with query permissions, Personal API key
DELETE/v2/corpora/{corpus_key}Delete a corpus and all its dataPersonal API key
PATCH/v2/corpora/{corpus_key}Update a corpusPersonal API key
POST/v2/corpora/{corpus_key}/resetRemove all documents and data in a corpusPersonal API key
POST/v2/corpora/{corpus_key}/replace_filter_attributesReplace the filter attributes of a corpusPersonal API key
POST/v2/corpora/{corpus_key}/compute_sizeCompute the current size of a corpusPersonal API key
POST/v2/corpora/{corpus_key}/upload_fileUpload a file to the corpusPersonal API key
POST/v2/corpora/{corpus_key}/documentsAdd a document to a corpusPersonal API key
GET/v2/corpora/{corpus_key}/documentsList the documents in the corpusAPI key with query permissions, Personal API key
DELETE/v2/corpora/{corpus_key}/documents/{document_id}Delete a documentPersonal API key
GET/v2/corpora/{corpus_key}/documents/{document_id}Retrieve a documentAPI key with query permissions, Personal API key
PATCH/v2/corpora/{corpus_key}/documents/{document_id}Update document, merging the metadata.Personal API key
PUT/v2/corpora/{corpus_key}/documents/{document_id}/metadataReplace the document metadata.API key with indexing and query permissions, Personal API key
POST/v2/corpora/{corpus_key}/documents/{document_id}/summarizeSummarize a documentPersonal API key
GET/v2/corpora/{corpus_key}/querySimple Single Corpus QueryAPI key with query permissions, Personal API key
POST/v2/corpora/{corpus_key}/queryAdvanced Single Corpus QueryAPI key with query permissions, Personal API key
POST/v2/queryMultiple Corpora QueryAPI key with query permissions, Personal API key
GET/v2/queries/{query_id}Get a query historyAPI key with query permissions, Personal API key
GET/v2/queriesList the history of previous queriesAPI key with query permissions, Personal API key
POST/v2/chatsStart a chatAPI key with indexing and query permissions, Personal API key
GET/v2/chatsList chatsAPI key with query permissions, Personal API key
GET/v2/chats/{chat_id}Get a chatAPI key with query permissions, Personal API key
DELETE/v2/chats/{chat_id}Delete a chatPersonal API key
POST/v2/chats/{chat_id}/turnsCreate a new turn in the chatAPI key with indexing and query permissions, Personal API key
GET/v2/chats/{chat_id}/turnsList turns in a chatAPI key with query permissions, Personal API key
GET/v2/chats/{chat_id}/turns/{turn_id}Get a turnAPI key with query permissions, Personal API key
DELETE/v2/chats/{chat_id}/turns/{turn_id}Delete a turnPersonal API key
PATCH/v2/chats/{chat_id}/turns/{turn_id}Update a turnAPI key with indexing and query permissions, Personal API key
POST/v2/llmsCreate an LLMAPI key with indexing and query permissions, Personal API key
GET/v2/llmsList LLMsAPI key with query permissions, Personal API key
GET/v2/llms/{llm_id}Get an LLMAPI key with query permissions, Personal API key
DELETE/v2/llms/{llm_id}Delete an LLMPersonal API key
POST/v2/llms/chat/completionsCreates a model response for the given chat conversationAPI key with indexing and query permissions, Personal API key
GET/v2/generation_presetsList generation presetsAPI key with query permissions, Personal API key
POST/v2/evaluate_factual_consistencyEvaluate factual consistencyPersonal API key
POST/v2/encodersCreate an encoderAPI key with indexing and query permissions, Personal API key
GET/v2/encodersList encodersAPI key with query permissions, Personal API key
GET/v2/rerankersList rerankersAPI key with query permissions, Personal API key
GET/v2/table_extractorsList supported table extractorsAPI key with query permissions, Personal API key
GET/v2/hallucination_correctorsList hallucination correctorsAPI key with query permissions, Personal API key
POST/v2/hallucination_correctors/correct_hallucinationsCorrects hallucinations in generated text based on source documentsPersonal API key
GET/v2/jobsList jobsAPI key with query permissions, Personal API key
GET/v2/jobs/{job_id}Get a job by IDAPI key with query permissions, Personal API key
POST/v2/usersCreate a user in the current customer accountPersonal API key
GET/v2/usersList users in the accountPersonal API key
GET/v2/users/{username}Get a userPersonal API key
PATCH/v2/users/{username}Update a userPersonal API key
DELETE/v2/users/{username}Delete a userPersonal API key
POST/v2/users/{username}/reset_passwordReset the password for a userPersonal API key
POST/v2/api_keysCreate an API keyPersonal API key
GET/v2/api_keysList API keysPersonal API key
GET/v2/api_keys/{api_key_id}Get an API keyPersonal API key
PATCH/v2/api_keys/{api_key_id}Update an API keyPersonal API key
DELETE/v2/api_keys/{api_key_id}Delete an API keyPersonal API key
POST/v2/app_clientsCreate an App ClientAPI key with indexing and query permissions, Personal API key
GET/v2/app_clientsList App ClientsAPI key with query permissions, Personal API key
GET/v2/app_clients/{app_client_id}Get an App ClientAPI key with query permissions, Personal API key
PATCH/v2/app_clients/{app_client_id}Update an App ClientAPI key with indexing and query permissions, Personal API key
DELETE/v2/app_clients/{app_client_id}Delete an App ClientPersonal API key
POST/oauth/tokenRequest an access tokenPersonal API key
POST/v2/agentsCreate new agentsAPI key with indexing and query permissions, Personal API key
GET/v2/agentsList agents with filtering and paginationAPI key with query permissions, Personal API key
GET/v2/agents/{agent_key}Retrieve specific agent configurationAPI key with query permissions, Personal API key
PATCH/v2/agents/{agent_key}Update agent configurationAPI key with indexing and query permissions, Personal API key
DELETE/v2/agents/{agent_key}Remove agentsPersonal API key
POST/v2/agents/{agent_key}/sessionsCreate agent sessionsAPI key with indexing and query permissions, Personal API key
GET/v2/agents/{agent_key}/sessionsList agent sessionsAPI key with query permissions, Personal API key
GET/v2/agents/{agent_key}/sessions/{session_key}Retrieve session detailsAPI key with query permissions, Personal API key
PATCH/v2/agents/{agent_key}/sessions/{session_key}Update session metadataAPI key with indexing and query permissions, Personal API key
DELETE/v2/agents/{agent_key}/sessions/{session_key}Remove sessionsPersonal API key
POST/v2/agents/{agent_key}/sessions/{session_key}/eventsCreate conversation events (input only)API key with indexing and query permissions, Personal API key
GET/v2/agents/{agent_key}/sessions/{session_key}/eventsList session eventsAPI key with query permissions, Personal API key
GET/v2/agents/{agent_key}/sessions/{session_key}/events/{event_id}Retrieve specific eventsAPI key with query permissions, Personal API key
POST/v2/tool_serversRegister MCP serversAPI key with indexing and query permissions, Personal API key
GET/v2/tool_serversList registered serversAPI key with query permissions, Personal API key
GET/v2/tool_servers/{tool_server_id}Retrieve server detailsAPI key with query permissions, Personal API key
PATCH/v2/tool_servers/{tool_server_id}Update server configurationAPI key with indexing and query permissions, Personal API key
DELETE/v2/tool_servers/{tool_server_id}Remove serversPersonal API key
POST/v2/tool_servers/{tool_server_id}/syncSynchronize server toolsAPI key with indexing and query permissions, Personal API key
GET/v2/toolsList available toolsAPI key with query permissions, Personal API key
GET/v2/tools/{tool_id}Retrieve tool specificationsAPI key with query permissions, Personal API key
PATCH/v2/tools/{tool_id}Update tool configurationAPI key with indexing and query permissions, Personal API key
DELETE/v2/tools/{tool_id}Remove toolsPersonal API key
POST/v2/instructionsCreate behavioral instructionsAPI key with indexing and query permissions, Personal API key
GET/v2/instructionsList instructions with filteringAPI key with query permissions, Personal API key
GET/v2/instructions/{instruction_id}Retrieve instruction detailsAPI key with query permissions, Personal API key
PATCH/v2/instructions/{instruction_id}Update instruction templatesAPI key with indexing and query permissions, Personal API key
DELETE/v2/instructions/{instruction_id}Remove instructionsPersonal API key
POST/v2/instructions/{instruction_id}/testTest instruction compilationAPI key with indexing and query permissions, Personal API key
DELETE/v2/instructions/{instruction_id}/versions/{version}Remove specific instruction versionsPersonal API key

Create an API key

You can create a Personal API key or a scoped API key, then pass the secret in the x-api-key header when issuing requests.

Use an API key

To use an API key, pass its secret in the x-api-key request header.

CODE EXAMPLE

Code example with js syntax.
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 a query-scoped keyThe key lacks an indexing roleAssign the required indexing role to a backend key
Personal key used in browserThe key inherits the user's permissions and is exposed to the clientUse a minimally scoped key and assume client-side credentials are visible

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 a scoped API key

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

Disable a scoped 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 you delete a scoped API key, you cannot undelete it. All external systems that use the key will be blocked.

Next Steps