If hosted is set to true then fileUrl is required. Else file is required. If adding a file, maximum allowed is 25 MB
http
POST https://services.leadconnectorhq.com/medias/upload-fileAuthorization
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer token generated from the Leadway portal. See Authentication. | |
Version | string | Yes | 2021-07-28 | API version. |
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
file | string | No | ||
hosted | boolean | No | ||
fileUrl | string | No | ||
name | string | No | ||
parentId | string | No |
Responses
200 - Successful response
fileId(string, required): ID of the uploaded file Example:file.pdfurl(string, required): Google Cloud Storage URL of the uploaded file Example:https://storage.googleapis.com/bucket-name/path/to/file.pdf
json
{
"fileId": "file.pdf",
"url": "https://storage.googleapis.com/bucket-name/path/to/file.pdf"
}Example
curl -X POST 'https://services.leadconnectorhq.com/medias/upload-file' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"file": "string",
"hosted": true,
"fileUrl": "string",
"name": "string",
"parentId": "string"
}'const response = await fetch('https://services.leadconnectorhq.com/medias/upload-file', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"file": "string", "hosted": true, "fileUrl": "string", "name": "string", "parentId": "string"}),
});
const data = await response.json();import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/medias/upload-file',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"file": "string", "hosted": true, "fileUrl": "string", "name": "string", "parentId": "string"},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/medias/upload-file');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'file': 'string', 'hosted': true, 'fileUrl': 'string', 'name': 'string', 'parentId': 'string'}),
]);
$data = json_decode(curl_exec($ch), true);