Soft-deletes or trashes multiple files and folders in a single request
http
PUT https://services.leadconnectorhq.com/medias/delete-filesAuthorization
| 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
filesToBeDeleted(object[], required): Array of file objects to be deleted or trashed_id(string, required): Unique identifier of the file or folder to be deleted Example:686f630df0d3166d68fbcec2
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
altType | string | Yes | account | Type of entity that owns the files Possible values: 'account' |
altId | string | Yes | sx6wyHhbFdRXh302LLNR | Account identifier |
status | string | Yes | deleted | Status to set for the files (deleted or trashed) Possible values: 'deleted', 'trashed' |
Responses
200 - Successful response
json
[
{
"deleted": true,
"id": "686f630df0d3166d68fbcec2"
}
]Example
curl -X PUT 'https://services.leadconnectorhq.com/medias/delete-files' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"filesToBeDeleted": [
{
"_id": "686f630df0d3166d68fbcec2"
}
],
"altType": "account",
"altId": "sx6wyHhbFdRXh302LLNR",
"status": "deleted"
}'const response = await fetch('https://services.leadconnectorhq.com/medias/delete-files', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"filesToBeDeleted": [{"_id": "686f630df0d3166d68fbcec2"}], "altType": "account", "altId": "sx6wyHhbFdRXh302LLNR", "status": "deleted"}),
});
const data = await response.json();import os, requests
response = requests.request(
'PUT',
'https://services.leadconnectorhq.com/medias/delete-files',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"filesToBeDeleted": [{"_id": "686f630df0d3166d68fbcec2"}], "altType": "account", "altId": "sx6wyHhbFdRXh302LLNR", "status": "deleted"},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/medias/delete-files');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'filesToBeDeleted': [{'_id': '686f630df0d3166d68fbcec2'}], 'altType': 'account', 'altId': 'sx6wyHhbFdRXh302LLNR', 'status': 'deleted'}),
]);
$data = json_decode(curl_exec($ch), true);