Skip to content
View as Markdown

Delete a file ​

DELETE /v1/leads/{lead_id}/files/{file_id}

Removes one file from a file or image custom field of the lead's pipeline card.

Scope: leads:write

Access: The key's member must also be allowed to see files.

Works exactly as deleting the file on the board: the stored file is deleted and disappears from the card's Custom Fields panel.

Only a file on the lead's main card, in a file or image custom field of its campaign, can be removed; a follow-through card shares those files, so a member who sees the lead only through one removes them the same way. Any other file_id (unknown, already removed, or another lead's file) is 404 not_found, so a retry after a timed-out request that did remove the file also answers 404: treat it as done.

If the stored file cannot be removed the request fails with 502 dependency_unavailable and the file stays on the card; retry the same request with backoff.

Path parameters ​

NameTypeRequiredDescription
lead_idUUIDYesThe lead.
file_idUUIDYesThe file_id the upload returned.

Response ​

Status: 200 OK

Identifiers only, never the file's name or content.

NameTypeDescription
file_idUUIDThe removed file.
lead_idUUIDThe lead.
fieldstringThe custom field slug it was removed from.
deletedbooleanAlways true.

Example request ​

curl

bash
curl -X DELETE "https://development.agencydevworks.ai/v1/leads/aaaaaaaa-0000-4000-8000-000000000001/files/55555555-0000-4000-8000-000000000001" \
  -H "Authorization: Bearer dei_your_key"

JavaScript

js
const response = await fetch("https://development.agencydevworks.ai/v1/leads/aaaaaaaa-0000-4000-8000-000000000001/files/55555555-0000-4000-8000-000000000001", {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer dei_your_key",
  },
});
const data = await response.json();

Example response ​

Status: 200 OK

json
{
  "file_id": "55555555-0000-4000-8000-000000000001",
  "lead_id": "aaaaaaaa-0000-4000-8000-000000000001",
  "field": "utility_bill",
  "deleted": true
}

Errors ​

HTTPCodeWhen
403insufficient_scopeThe key does not have leads:write.
403permission_deniedThe key's member may not see files. Only for a lead they can see; any other lead is 404.
404not_foundThe lead or file does not exist, was already removed, belongs to another lead, or the key cannot reach the lead.
422invalid_requestlead_id or file_id is not a UUID.
502dependency_unavailableThe stored file could not be removed. It stays on the card; retry with backoff.

Every endpoint can also answer 401 invalid_api_key, 429 rate_limited and 503 dependency_unavailable. See Errors in the overview.