Error: No permissions to add document to Vectara. Check your corpus ID, customer ID and API key

I was following this langchain tutorial, and I have done the setup as asked.
When trying to run the following line of code -
vectara = vectorstore.from_documents(documents, embedding=None),
I am getting the error as stated in the title.

Here is entire code snippet -

import os
import getpass

OPENAI_API_KEY = "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"

VECTARA_API_KEY = "zqt_X"
VECTARA_CUSTOMER_ID = "3X9"
VECTARA_CORPUS_ID = "1"

os.environ["VECTARA_CUSTOMER_ID"] = VECTARA_CUSTOMER_ID
os.environ["VECTARA_CORPUS_ID"] = VECTARA_CORPUS_ID
os.environ["VECTARA_API_KEY"] = VECTARA_API_KEY

from langchain.chains import ConversationalRetrievalChain
from langchain_community.vectorstores import Vectara

vectorstore = Vectara(
                vectara_customer_id = VECTARA_CUSTOMER_ID,
                vectara_corpus_id = VECTARA_CORPUS_ID,
                vectara_api_key = VECTARA_API_KEY
            )

from langchain_community.document_loaders import TextLoader

loader = TextLoader("corpus_1.txt")
documents = loader.load()

vectara = vectorstore.from_documents(documents, embedding=None)

Error: No permissions to add document to Vectara.
Check your corpus ID, customer ID and API key.

Hi Rajdeep,

I want to check a few things quickly:

VECTARA_API_KEY = "zqt_X"
VECTARA_CUSTOMER_ID = "3X9"
VECTARA_CORPUS_ID = "1"

The customer and corpus ids are long values, not strings. A corpus id of 1 looks okay, but “3X9” definitely isn’t a valid customer id. The API key starts with the right prefix, “zqt_”, but I’m assuming that the “X” is a much longer string that you don’t want to include for security reasons?

Hi Rajdeep,

I see your VECTARA_API_KEY starts with “zqt_”, and assuming as Amin suggests the X is much longer (meaning it’s a fully valid kjey) - this key is seems to be a query-only API Key. Can you try to create a query+index API key (should start with “zwt_”) and see if that addresses the issue of no permissions to index?