Skip to main content
POST
/
api
/
v1
/
vault
/
upload_files
/
{project_id}
Upload Files to Project
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=skip \
  --form files.items='@example-file'
import requests

url = "https://api.harvey.ai/api/v1/vault/upload_files/{project_id}"

files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = {
"files": "@/path/to/hello_world.pdf",
"file_paths": "/caselaw/usa/california/sf/hello_world.pdf",
"duplicate_mode": "skip"
}
headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, data=payload, files=files, 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');
form.append('files.items', '{
"fileName": "example-file"
}');

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\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\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\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\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\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\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\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"

response = http.request(request)
puts response.read_body
{
  "project_id": "<string>",
  "file_ids": [
    "<string>"
  ]
}

Permissions

Requires Vault API and Modify workspace projects permissions.

Authorizations

Authorization
string
header
required

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

Path Parameters

project_id
string
required

The project ID.

Body

multipart/form-data
files
file[]

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.

Example:

"@/path/to/hello_world.pdf"

file_paths
string[]

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.

Example:

"/caselaw/usa/california/sf/hello_world.pdf"

duplicate_mode
enum<string>

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).

Available options:
skip,
replace,
keep
Example:

"skip"

Response

Files successfully uploaded

project_id
string

The project ID.

file_ids
string[]

Array of file IDs that were added to the project.