Skip to main content
POST
/
api
/
v2
/
completion
Completion with Vault RAG
curl --request POST \
  --url https://api.harvey.ai/api/v2/completion \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'prompt=Summarize these documents.' \
  --form stream=false \
  --form mode=draft \
  --form 'knowledge_sources=[{"type":"vault","folder_id":"12345678-1234-5678-1234-567812345678","file_ids":["87654321-8765-4321-8765-432187654321"]}]'
{
  "response": "Contract Analysis Summary:\\n\\nThe Non-Disclosure Agreement (NDA) between TechCorp Inc. and DataSolutions LLC establishes a comprehensive framework for protecting confidential information exchanged during their potential business collaboration. The agreement defines confidential information broadly to include technical specifications, business plans, customer data, and proprietary methodologies. Key provisions include a 24-month confidentiality period, restrictions on disclosure to third parties, and mandatory return or destruction of confidential materials upon termination. The agreement also includes standard provisions for injunctive relief, governing law (Delaware), and dispute resolution through binding arbitration.",
  "response_with_citations": "Contract Analysis Summary:\\n\\nThe Non-Disclosure Agreement (NDA) between TechCorp Inc. and DataSolutions LLC establishes a comprehensive framework for protecting confidential information exchanged during their potential business collaboration.[3] The agreement defines confidential information broadly to include technical specifications, business plans, customer data, and proprietary methodologies.[1] Key provisions include a 24-month confidentiality period, restrictions on disclosure to third parties, and mandatory return or destruction of confidential materials upon termination.[2] The agreement also includes standard provisions for injunctive relief, governing law (Delaware), and dispute resolution through binding arbitration.[4]",
  "sources": [
    {
      "citation_num": 1,
      "document_name": "NDA_TechCorp_DataSolutions_2024.pdf",
      "page": 2,
      "text": "<mark>\"Confidential Information\" means any information disclosed by one party (the \"Disclosing Party\") to the other party (the \"Receiving Party\") that is designated as confidential or that reasonably should be understood to be confidential given the nature of the information and the circumstances of disclosure. Confidential Information includes, but is not limited to, technical specifications, business plans, customer lists, pricing information, proprietary methodologies, and any other information that is not generally known to the public.</mark>"
    },
    {
      "citation_num": 2,
      "document_name": "NDA_TechCorp_DataSolutions_2024.pdf",
      "page": 4,
      "text": "<mark>The Receiving Party shall maintain the confidentiality of the Confidential Information for a period of twenty-four (24) months from the date of disclosure. Upon termination of this Agreement or upon written request of the Disclosing Party, the Receiving Party shall promptly return to the Disclosing Party all copies of Confidential Information in tangible form or destroy such copies and certify in writing to the Disclosing Party that such Confidential Information has been destroyed.</mark>"
    },
    {
      "citation_num": 3,
      "document_name": "NDA_TechCorp_DataSolutions_2024.pdf",
      "page": 1,
      "text": "<mark>NON-DISCLOSURE AGREEMENT\\n\\nThis Non-Disclosure Agreement (\"Agreement\") is entered into as of January 15, 2024, by and between TechCorp Inc., a Delaware corporation (\"TechCorp\"), and DataSolutions LLC, a California limited liability company (\"DataSolutions\"), collectively referred to as the \"Parties.\"\\n\\nWHEREAS, the Parties desire to explore a potential business relationship and may disclose to each other certain confidential and proprietary information;</mark>"
    },
    {
      "citation_num": 4,
      "document_name": "NDA_TechCorp_DataSolutions_2024.pdf",
      "page": 6,
      "text": "<mark>This Agreement shall be governed by and construed in accordance with the laws of the State of Delaware, without regard to its conflict of laws principles. Any dispute arising out of or relating to this Agreement shall be resolved through binding arbitration in accordance with the Commercial Arbitration Rules of the American Arbitration Association.</mark>"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
prompt
string
required

A string question that you want to ask Harvey.

Maximum length: 4000
Example:

"Summarize these documents."

knowledge_sources
string
required

JSON-encoded array of knowledge sources.

Must contain exactly one object with required keys type and folder_id. Optionally, you can specify file_ids. If file_ids is omitted, all files within the specified folder will be queried.

Example with file_ids: [{"type":"vault","folder_id":"12345678-1234-5678-1234-567812345678","file_ids":["87654321-8765-4321-8765-432187654321"]}]

Example without file_ids (queries entire folder): [{"type":"vault","folder_id":"12345678-1234-5678-1234-567812345678"}]

Example:

"[{\"type\":\"vault\",\"folder_id\":\"12345678-1234-5678-1234-567812345678\",\"file_ids\":[\"87654321-8765-4321-8765-432187654321\"]}]"

stream
boolean
default:false

Stream or receive the entire output at once.

file
file[]

Optional files to provide additional context.

mode
enum<string>

Optional mode for completion.

Available options:
draft,
assist

Response

The response object includes the response field which is the completion of the input prompt sent to the model.

response
string

The answer to the question based on the provided file(s).

Example:

"Contract Analysis Summary:\\n\\nThe Non-Disclosure Agreement (NDA) between TechCorp Inc. and DataSolutions LLC establishes a comprehensive framework for protecting confidential information exchanged during their potential business collaboration. The agreement defines confidential information broadly to include technical specifications, business plans, customer data, and proprietary methodologies. Key provisions include a 24-month confidentiality period, restrictions on disclosure to third parties, and mandatory return or destruction of confidential materials upon termination. The agreement also includes standard provisions for injunctive relief, governing law (Delaware), and dispute resolution through binding arbitration."

response_with_citations
string

The answer above with inline citations, e.g. [1][2], which correspond to the sources below.

Example:

"Contract Analysis Summary:\\n\\nThe Non-Disclosure Agreement (NDA) between TechCorp Inc. and DataSolutions LLC establishes a comprehensive framework for protecting confidential information exchanged during their potential business collaboration.[3] The agreement defines confidential information broadly to include technical specifications, business plans, customer data, and proprietary methodologies.[1] Key provisions include a 24-month confidentiality period, restrictions on disclosure to third parties, and mandatory return or destruction of confidential materials upon termination.[2] The agreement also includes standard provisions for injunctive relief, governing law (Delaware), and dispute resolution through binding arbitration.[4]"

sources
any[]

Contains the list of cited source snippets to support the answer. Each source object contains citation_num, text, document_name, and page (1-indexed) fields. In streaming mode, only the final response chunk contains the sources.

Example:
[
{
"citation_num": 1,
"document_name": "NDA_TechCorp_DataSolutions_2024.pdf",
"page": 2,
"text": "<mark>\"Confidential Information\" means any information disclosed by one party (the \"Disclosing Party\") to the other party (the \"Receiving Party\") that is designated as confidential or that reasonably should be understood to be confidential given the nature of the information and the circumstances of disclosure. Confidential Information includes, but is not limited to, technical specifications, business plans, customer lists, pricing information, proprietary methodologies, and any other information that is not generally known to the public.</mark>"
},
{
"citation_num": 2,
"document_name": "NDA_TechCorp_DataSolutions_2024.pdf",
"page": 4,
"text": "<mark>The Receiving Party shall maintain the confidentiality of the Confidential Information for a period of twenty-four (24) months from the date of disclosure. Upon termination of this Agreement or upon written request of the Disclosing Party, the Receiving Party shall promptly return to the Disclosing Party all copies of Confidential Information in tangible form or destroy such copies and certify in writing to the Disclosing Party that such Confidential Information has been destroyed.</mark>"
},
{
"citation_num": 3,
"document_name": "NDA_TechCorp_DataSolutions_2024.pdf",
"page": 1,
"text": "<mark>NON-DISCLOSURE AGREEMENT\\n\\nThis Non-Disclosure Agreement (\"Agreement\") is entered into as of January 15, 2024, by and between TechCorp Inc., a Delaware corporation (\"TechCorp\"), and DataSolutions LLC, a California limited liability company (\"DataSolutions\"), collectively referred to as the \"Parties.\"\\n\\nWHEREAS, the Parties desire to explore a potential business relationship and may disclose to each other certain confidential and proprietary information;</mark>"
},
{
"citation_num": 4,
"document_name": "NDA_TechCorp_DataSolutions_2024.pdf",
"page": 6,
"text": "<mark>This Agreement shall be governed by and construed in accordance with the laws of the State of Delaware, without regard to its conflict of laws principles. Any dispute arising out of or relating to this Agreement shall be resolved through binding arbitration in accordance with the Commercial Arbitration Rules of the American Arbitration Association.</mark>"
}
]
I