curl --request POST \
--url https://api.harvey.ai/api/v1/vault/upload_files/{project_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form files=@/path/to/hello_world.pdf \
--form file_paths=/caselaw/usa/california/sf/hello_world.pdf \
--form duplicate_mode=skipimport requests
url = "https://api.harvey.ai/api/v1/vault/upload_files/{project_id}"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n@/path/to/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_paths\"\r\n\r\n/caselaw/usa/california/sf/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"duplicate_mode\"\r\n\r\nskip\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '@/path/to/hello_world.pdf');
form.append('file_paths', '/caselaw/usa/california/sf/hello_world.pdf');
form.append('duplicate_mode', 'skip');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.harvey.ai/api/v1/vault/upload_files/{project_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.harvey.ai/api/v1/vault/upload_files/{project_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n@/path/to/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_paths\"\r\n\r\n/caselaw/usa/california/sf/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"duplicate_mode\"\r\n\r\nskip\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.harvey.ai/api/v1/vault/upload_files/{project_id}"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n@/path/to/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_paths\"\r\n\r\n/caselaw/usa/california/sf/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"duplicate_mode\"\r\n\r\nskip\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.harvey.ai/api/v1/vault/upload_files/{project_id}")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n@/path/to/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_paths\"\r\n\r\n/caselaw/usa/california/sf/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"duplicate_mode\"\r\n\r\nskip\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.harvey.ai/api/v1/vault/upload_files/{project_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n@/path/to/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_paths\"\r\n\r\n/caselaw/usa/california/sf/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"duplicate_mode\"\r\n\r\nskip\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"project_id": "<string>",
"file_ids": [
"<string>"
]
}Upload Files to Project
The Upload Files API endpoint enables organizations to both upload new files and update existing ones within Vault projects. A maximum of 50 files can be uploaded per API request.
curl --request POST \
--url https://api.harvey.ai/api/v1/vault/upload_files/{project_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form files=@/path/to/hello_world.pdf \
--form file_paths=/caselaw/usa/california/sf/hello_world.pdf \
--form duplicate_mode=skipimport requests
url = "https://api.harvey.ai/api/v1/vault/upload_files/{project_id}"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n@/path/to/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_paths\"\r\n\r\n/caselaw/usa/california/sf/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"duplicate_mode\"\r\n\r\nskip\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '@/path/to/hello_world.pdf');
form.append('file_paths', '/caselaw/usa/california/sf/hello_world.pdf');
form.append('duplicate_mode', 'skip');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.harvey.ai/api/v1/vault/upload_files/{project_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.harvey.ai/api/v1/vault/upload_files/{project_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n@/path/to/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_paths\"\r\n\r\n/caselaw/usa/california/sf/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"duplicate_mode\"\r\n\r\nskip\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.harvey.ai/api/v1/vault/upload_files/{project_id}"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n@/path/to/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_paths\"\r\n\r\n/caselaw/usa/california/sf/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"duplicate_mode\"\r\n\r\nskip\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.harvey.ai/api/v1/vault/upload_files/{project_id}")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n@/path/to/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_paths\"\r\n\r\n/caselaw/usa/california/sf/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"duplicate_mode\"\r\n\r\nskip\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.harvey.ai/api/v1/vault/upload_files/{project_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n@/path/to/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_paths\"\r\n\r\n/caselaw/usa/california/sf/hello_world.pdf\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"duplicate_mode\"\r\n\r\nskip\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"project_id": "<string>",
"file_ids": [
"<string>"
]
}Permissions
RequiresVault API and Modify workspace projects permissions.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The project ID.
Body
Path to the files to be uploaded, e.g. @/path/to/hello_world.pdf. Each file is a separate multipart/form-data. PDF, DOCX, XLSX, PPT, TXT, RTF, CSV, EML, and other file formats supported (reference our Help Center). Max size of 500 MB for all file types. A maximum of 50 files can be uploaded per API request. Beware of HTTPS timeouts if too many large files are sent at a time.
"@/path/to/hello_world.pdf"
The desired folder structure for the file(s), e.g. /caselaw/usa/california/sf/hello_world.pdf. This will be reconciled with the names in the provided files paths.
"/caselaw/usa/california/sf/hello_world.pdf"
Determines how duplicate file names are handled. skip will not update if a file with the same name already exists. replace will create a new file record (with its own unique file_id) and set its root_file_id to the original file_id. keep will rename the new file to avoid collision (e.g. document (1).pdf).
skip, replace, keep "skip"