---
title: "Update a corpus"
method: PATCH
path: "/v2/corpora/{corpus_key}"
tags: ["Corpora"]
---

# Update a corpus

`PATCH /v2/corpora/{corpus_key}`

Enables, disables, or updates the name and description of a corpus. Use this endpoint to manage the availability of data, such as taking a corpus offline without deleting it.

You can also use automated scripts to control the availability of corpora based on certain conditions. For example, quickly disable a corpus for maintenance updates or in response to security incidents.

## Path parameters

- `corpus_key` string, required — A user-provided key for a corpus.

## Headers

- `Request-Timeout` integer
- `Request-Timeout-Millis` integer

## Request body

- UpdateCorpusRequest — Corpus properties that are modifiable after creation.
  - `enabled` boolean — Whether the corpus is enabled. If unset, the corpus remains in its current state.
  - `name` string — The name for the corpus. If unset or null, the name remains unchanged.
  - `description` string — Description of the corpus. If unset or null, the description remains unchanged.
  - `save_history` boolean — Indicates whether to save corpus queries to query history by default.

## Response `200`

Successfully updated the corpus.

- Corpus — A corpus is a collection of documents and associated configuration for indexing, searching, and generating responses through RAG.
  - `id` string, required — Vectara ID of the corpus.
  - `key` string, required — A user-provided key for a corpus.
  - `name` string, required — Name for the corpus. This value defaults to the key.
  - `description` string — Corpus description.
  - `enabled` boolean — Specifies whether the corpus is enabled or not.
  - `chat_history_corpus` boolean — Indicates that this corpus does not store documents and stores chats instead.
  - `queries_are_answers` boolean — Queries made to this corpus are considered answers, and not questions. This swaps the semantics of the encoder used at query time.
  - `documents_are_questions` boolean — Documents inside this corpus are considered questions, and not answers. This swaps the semantics of the encoder used at indexing.
  - `encoder_id` string — The encoder used by the corpus. *Deprecated*: Use `encoder_name` instead
  - `encoder_name` string — The encoder used by the corpus, `boomerang-2023-q3`.
  - `save_history` boolean — Indicates whether to save corpus queries to query history by default.
  - `filter_attributes` FilterAttribute[] — The filter attributes of the corpus.
    - `name` string, required — The JSON path of the filter attribute in a document or document part metadata.
    - `level` 'document' | 'part', required — Indicates whether this is a document or document part metadata filter.
    - `description` string — A description of the filter. This property can be omitted.
    - `indexed` boolean — Whether to create an index for the filter. An index improves query latency for queries that use the filter.
    - `type` 'integer' | 'real_number' | 'text' | 'boolean' | 'list[integer]' | 'list[real_number]' | 'list[text]', required — The value type of the filter.
  - `custom_dimensions` CorpusCustomDimension[] — The custom dimensions of all document parts inside the corpus.
    - `name` string, required — The name of the custom dimension.
    - `description` string — Description of the custom dimension.
    - `indexing_default` number, double — The default value of a custom dimension on a document part. This value applies when the custom dimension value is not specified at indexing time. A value of 0 means that the custom dimension is not considered.
    - `querying_default` number, double — The default value of a custom dimension for a query. This value applies when the custom dimension value is not specified in the query. A value of 0 means that the custom dimension is not considered.
  - `limits` object
    - `used_docs` integer — The number of documents contained in the corpus.
    - `used_parts` integer — The number of document parts contained in the corpus.
    - `used_bytes` integer — NOTE: This field is currently not populated by the platform. The number of bytes contained in the corpus. This includes the document metadata, document part metadata, and document contents.
    - `used_characters` integer — The number of characters contained in the corpus. This includes the document metadata, document part metadata, and document contents.
    - `max_bytes` integer — NOTE: This field is currently not populated by the platform. The maximum number of bytes the corpus can be.
    - `max_metadata_bytes` integer — The maximum size that metadata can be on documents.
    - `index_rate` integer — NOTE: This field is currently not populated by the platform. The maximum per-second addition of new documents to corpus.
  - `created_at` string, date-time — Indicates when the corpus was created.

## Other responses

- `403` — Permissions do not allow updating the corpus.
- `404` — Corpus not found.

---

[API](https://skmtc.dev/vectara/apis/vectara-rest-api-v2.md) · [All operations](https://skmtc.dev/vectara/apis/vectara-rest-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/vectara/vectara-rest-api-v2/revisions/05ae305c8d84/schema)
