HubSpot API Files endpoint: Upload file: Provide example

For POST/files/v3/files

Upload file
Upload a single file with content specified in request body.

Request

>>> No code samples are available <<<

Please provide/share a bash/cUrl example for this request.

Thank you

Hello @jeff00seattle
Upload a file to the HubSpot Files API using bash or cURL

# Create a new file to upload
echo "This is my file content" > my_file.txt

# Get your HubSpot API key
# You can find your API key in the HubSpot Admin Portal under Settings > API Keys
HAPIKEY="YOUR_API_KEY"

# Create the URL for the API endpoint
URL="https://api.hubspot.com/filemanager/api/v3/files/upload?hapikey=$HAPIKEY"

# Upload the file
curl -X POST -F file=@my_file.txt $URL

This will upload the file my_file.txt to HubSpot. You can then access the file by its ID, which will be returned in the response from the API.

{
 "id": "1234567890",
 "name": "my_file.txt",
 "size": 12345,
 "content_type": "text/plain",
 "folder_id": 1234567890,
 "created_at": "2023-05-25T12:00:00Z",
 "updated_at": "2023-05-25T12:00:00Z"
}

Thank you, checking your solution, appreciate it.

I thought use of API keys are deprecated and now you need to use apps with the bearer key in the authorisation header?