Provides guidance for working with files and folders in the Public API including upload, creation, updates, and OData querying
The /v2/files endpoints support all types of file resource (File, Folder, ContractDocument).
- Use
multipart/form-datato upload file content for a File or ContractDocument. - Use
application/jsonto create folders. - Use
application/merge-patch+jsonto rename or move file resources.
When consuming this guide treat all file resource types except Folder the same unless explicitly stated otherwise.
All file uploads using the LawVu API requires the use of multipart/form-data for uploading files. This allows you to send both file content and metadata in a single request.
When uploading a new file using POST /v2/files, provide what resource the file belongs to using targetResourceType and targetResourceId form fields.
The following table describes the supported values.
targetResourceType | targetResourceId | |
|---|---|---|
| Matter | {matterId} | Uploads the file to the matter with the ID {matterId} |
| Contract | {contractId} | Uploads the file to the contract with the ID {contractId} |
| ContractCreation | Uploads the file to be passed for creating a contract |
To create a new file on a matter with the ID 12345, the following request can be used:
Request:
POST /v2/files
Authorization: Bearer <your_access_token>
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="example.pdf"
Content-Type: application/pdf
<file content here>
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="targetResourceType"
Matter
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="targetResourceId"
12345
------WebKitFormBoundary7MA4YWxkTrZu0gW--To create a file on a contract with the ID 67890, use the following request:
Request:
POST /v2/files
Authorization: Bearer <your_access_token>
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="example.pdf"
Content-Type: application/pdf
<file content here>
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="targetResourceType"
Contract
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="targetResourceId"
67890
------WebKitFormBoundary7MA4YWxkTrZu0gW--To upload a file to be used during contract creation, use the following request:
Request:
POST /v2/files
Authorization: Bearer <your_access_token>
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="example.pdf"
Content-Type: application/pdf
<file content here>
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="targetResourceType"
ContractCreation
------WebKitFormBoundary7MA4YWxkTrZu0gW--To upload a new version of an existing file, use the following request: Replace {fileId} with the ID of the file you want to update.
Request:
POST /v2/files/{fileId}
Authorization: Bearer <your_access_token>
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="example.pdf"
Content-Type: application/pdf
<file content here>
------WebKitFormBoundary7MA4YWxkTrZu0gW--To upload a new file to a folder on an existing matter or contract, add folderId to the multipart form body.
Request:
POST /v2/files
Authorization: Bearer <your_access_token>
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="example.pdf"
Content-Type: application/pdf
<file content here>
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="targetResourceType"
Contract
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="targetResourceId"
67890
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="folderId"
45890
------WebKitFormBoundary7MA4YWxkTrZu0gW--Use POST /v2/files with Content-Type: application/json.
POST /v2/files
Authorization: Bearer <your_access_token>
Content-Type: application/json
{
"name": "Legal Documents",
"targetResourceType": "Matter",
"targetResourceId": 12345
}POST /v2/files
Authorization: Bearer <your_access_token>
Content-Type: application/json
{
"name": "Drafts",
"folderId": 45890,
"targetResourceType": "Matter",
"targetResourceId": 12345
}Use PATCH /v2/files/{fileId} with Content-Type: application/merge-patch+json to rename or move files/folders.
Note: Moving a file resource of type "ContractDocument" is not supported.
PATCH /v2/files/9456
Authorization: Bearer <your_access_token>
Content-Type: application/merge-patch+json
{
"name": "Q4 Legal Review"
}PATCH /v2/files/9456
Authorization: Bearer <your_access_token>
Content-Type: application/merge-patch+json
{
"folder": {
"id": 786
}
}PATCH /v2/files/9456
Authorization: Bearer <your_access_token>
Content-Type: application/merge-patch+json
{
"folder": null
}For full schema details and response examples, refer to the Files API documentation.