curl --request PUT \
--url https://api.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "signed-contract-v2.pdf",
"is_visible_on_customer_portal": true
}
'import requests
url = "https://api.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}"
payload = {
"name": "signed-contract-v2.pdf",
"is_visible_on_customer_portal": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'signed-contract-v2.pdf', is_visible_on_customer_portal: true})
};
fetch('https://api.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}', 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.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'signed-contract-v2.pdf',
'is_visible_on_customer_portal' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}"
payload := strings.NewReader("{\n \"name\": \"signed-contract-v2.pdf\",\n \"is_visible_on_customer_portal\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"signed-contract-v2.pdf\",\n \"is_visible_on_customer_portal\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"signed-contract-v2.pdf\",\n \"is_visible_on_customer_portal\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 52131,
"tenant_id": 12,
"project_id": 9103,
"created_by": 1159,
"file_type_id": 4,
"file_description_id": 12,
"name": "signed-contract-v2.pdf",
"mime_type": "application/pdf",
"size": 184320,
"caption": null,
"description": "Signed contract for the roof replacement",
"related_to_type": "oppcon_id",
"related_to_id": 6203,
"is_sensitive": false,
"is_visible_on_customer_portal": true,
"was_uploaded_from_vendor_portal": false,
"is_visible_on_vendor_portal": false,
"is_cover_photo": false,
"url": "https://cdn.contractorscloud.com/projects/9103/files/signed-contract-v2.pdf",
"url_thumbnail": null,
"updated_at": "2025-02-12 08:40:00"
}{
"message": "Unauthenticated."
}{
"message": "The requested resource could not be found."
}{
"message": "The first name field is required.",
"errors": {
"first_name": [
"The first name field is required."
]
}
}Update project file
Updates an existing project file. Only the fields you send are changed. name is optional but can’t be set to an empty value.
Request format
- Photos — accept
caption,description, andis_cover_photo. - Files — accept
is_sensitiveandis_visible_on_customer_portal. - Both — accept
name,file_type_id,file_description_id,related_to_type, andrelated_to_id.
Side effects
Setting is_cover_photo to true automatically clears it from every other file on the project. Changes are recorded as a note on the project’s activity feed, and the project’s workflow progress may update automatically.
curl --request PUT \
--url https://api.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "signed-contract-v2.pdf",
"is_visible_on_customer_portal": true
}
'import requests
url = "https://api.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}"
payload = {
"name": "signed-contract-v2.pdf",
"is_visible_on_customer_portal": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'signed-contract-v2.pdf', is_visible_on_customer_portal: true})
};
fetch('https://api.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}', 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.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'signed-contract-v2.pdf',
'is_visible_on_customer_portal' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}"
payload := strings.NewReader("{\n \"name\": \"signed-contract-v2.pdf\",\n \"is_visible_on_customer_portal\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"signed-contract-v2.pdf\",\n \"is_visible_on_customer_portal\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contractorscloud.com/api/v1/projects/{projectId}/files/{fileId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"signed-contract-v2.pdf\",\n \"is_visible_on_customer_portal\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 52131,
"tenant_id": 12,
"project_id": 9103,
"created_by": 1159,
"file_type_id": 4,
"file_description_id": 12,
"name": "signed-contract-v2.pdf",
"mime_type": "application/pdf",
"size": 184320,
"caption": null,
"description": "Signed contract for the roof replacement",
"related_to_type": "oppcon_id",
"related_to_id": 6203,
"is_sensitive": false,
"is_visible_on_customer_portal": true,
"was_uploaded_from_vendor_portal": false,
"is_visible_on_vendor_portal": false,
"is_cover_photo": false,
"url": "https://cdn.contractorscloud.com/projects/9103/files/signed-contract-v2.pdf",
"url_thumbnail": null,
"updated_at": "2025-02-12 08:40:00"
}{
"message": "Unauthenticated."
}{
"message": "The requested resource could not be found."
}{
"message": "The first name field is required.",
"errors": {
"first_name": [
"The first name field is required."
]
}
}Authorizations
Path Parameters
Body
The type of record to link this file to. Optional. See Create project file for the meaning of each value.
oppcon_id, moid, bille_id, payment_id, per_id, woid, vsid, roofscope, eagleview Response
The updated project file.
The id of the folder this file is organized into, from the file-type reference data (see List available options). Null for photos and for files that aren't organized into any folder.
The type of record this file is linked to. See Create project file for the allowed values. Null if the file isn't linked to another record.
"oppcon_id"