Skip to main content
If hosted is set to true then fileUrl is required. Else file is required. If adding a file, maximum allowed is 25 MB
POST https://services.leadconnectorhq.com/medias/upload-file

Autorización

Authorization
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.

Body

file
string
hosted
boolean
fileUrl
string
name
string
parentId
string

Respuestas

fileId
string
default:"file.pdf"
required
ID of the uploaded file
url
string
required
Google Cloud Storage URL of the uploaded file
{
  "fileId": "file.pdf",
  "url": "https://storage.googleapis.com/bucket-name/path/to/file.pdf"
}

Ejemplo

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);