To upload a file using the API send a POST HTTP request, include the file you wish to send and the record you wish to assign the file to.

// Snapforce API token
$api_token = 'your api token';

// Snapforce username
$api_username = 'your username';

// Module name
$module = "Files";

// The file and deal ID of the deal to whom you want to assign the file
$data = array(
    'file' => curl_file_create('./testfile.pdf'),
    'deal_id' => 12345
);

// URL for adding a file
$url = "https://app.snapforce.com/prodigy/api/v1/request.php?module=$module&api_username=$api_username&api_token=$api_token";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

echo 'Sending request...' . PHP_EOL;

$output = curl_exec($ch);
curl_close($ch);

print_r($output)