Upload files to custom fields via the API
complete
S
Scott Heliker
Looking to upload files via the API to custom fields that have a field type of file. Would be great addition to the API. We've had many people ask about it.
Log In
R
Roscar Cunanan
for those wondering how to add files to file-type custom fields under a contact, the following curl dump should help:
curl --location 'https://services.leadconnectorhq.com/forms/upload-custom-files?contactId={{contactId_here}}&locationId={{locationId_here}}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{access_token_here}}' \
--header 'Version: 2021-07-28' \
--form '{{customFieldId_here}}=@"/C:/path/to/file.csv"'
just edit it from notepad++ with your own values and then import it to your postman for testing
B
Bill Avon
Would be used daily!!
Core Platform
complete
j
jason burns
Core Platform: Any documentation on how to upload file to a custom field via the API?
A
Austin Andrade
jason burns: Also looking for the same thing
R
Roscar Cunanan
jason burns documentation is incomplete. nothing in here that shows anything related to the file being uploaded:
A
Andrija Naglic
For anyone interested, I got it working in my PHP script (I hope the formatting will be more or less ok):
function upload_file( $location_id, $contact_id, $file_path, $access_token ){
$endpoint = '/forms/upload-custom-files?contactId=' . $contact_id . '&locationId=' . $location_id;
$headers = [
'Accept: application/json',
'Version: 2021-07-28',
'Authorization: Bearer ' . $access_token,
];
$body = [
// Edit your custom field, unfold Additional preferences and check the Unique Key
// I used the part without the prefix contact. which was lowercase Name of the field
'fieldname' => new \CURLFile( $file_path ),
];
$curl = curl_init();
curl_setopt_array( $curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_URL => 'https://services.leadconnectorhq.com' . $endpoint,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $body,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
]);
$response = curl_exec( $curl );
curl_close( $curl );
return $response;
}
R
Ryan Hartigan
Yeah looking for this too!
B
Brian Morrison
This would be great. Currently, I can provide a url to a document and it will attach it to the custom field via the API. But I need it to create a copy of the file from the url onto the HighLevel server, as the original url expires after a few minutes.
S
Steven Rohman
Yes!
H
Harish Pandey
Needed
M
Mario Aldayuz
This would be amazing!
Core Platform
under review
C
Carter Douglas
Let's get this rolling! The opportunities would be endless with this option. Would allow us to integrate with a number of other tools and sync data.
Load More
→