You haven't specified an Api-Key

I’m trying to populate existing index with new records (embedded chunks) using


but I’m getting this error:

## PineconeConfigurationError("You haven't specified an Api-Key.") pinecone.exceptions.PineconeConfigurationError: You haven't specified an Api-Key

Even when I’m setting pinecone_api_key correctly in the constructor PineconeVectorStore

Do you have any idea how to fix it?

Hello @antonio.jdlsc, thank you for posting, and welcome to the forums.

For LangChain the Pinecone API-Key has to be set as an environment variable.


Please note that the case does matter.

Here is a full code snippet:

    import os
    from langchain_pinecone import PineconeVectorStore
    from langchain_openai import OpenAIEmbeddings
    from langchain_community.document_loaders import TextLoader
    from langchain_text_splitters import CharacterTextSplitter

    os.environ['OPENAI_API_KEY'] = '<YOUR_OPENAI_API_KEY>'

    index_name = "<YOUR_PINECONE_INDEX_NAME>"
    embeddings = OpenAIEmbeddings()

    # path to an example text file
    loader = TextLoader("../../modules/state_of_the_union.txt")
    documents = loader.load()
    text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
    docs = text_splitter.split_documents(documents)

    vectorstore_from_docs = PineconeVectorStore.from_documents(

For more information, please see our LangChain guide.