agentlyleads docs
Files API

GET and DELETE /api/v1/files/{id}

Both endpoints take the file ID from file.id or files[].id. Lookups are fenced by workspace, so an ID that belongs to another workspace returns the same 404 as one that does not exist.

GET /api/v1/files/{id}

Returns the file with a downloadUrl. Requires the read:files scope (or * for full access).

GET /api/v1/files/cmq3file0alk34567890 HTTP/1.1
Host: agentlyleads.com
Authorization: Bearer alk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Response: 200

{
  "file": {
    "id": "cmq3file0alk34567890",
    "entity": "CONTACT",
    "recordId": "cmq2cont0alk34567891",
    "kind": "attachment",
    "fileName": "signed-nda.pdf",
    "contentType": "application/pdf",
    "size": 184320,
    "createdAt": "2026-09-27T14:02:00.000Z",
    "downloadUrl": "https://agentlyleads-files.s3.amazonaws.com/...&X-Amz-Signature=...",
    "downloadUrlExpiresAt": "2026-09-27T14:07:00.000Z"
  }
}

downloadUrl works for 5 minutes and needs no API key. It always downloads the file rather than displaying it in a browser tab. Fetch the bytes right away, or call this endpoint again when you need them:

URL=$(curl -s https://agentlyleads.com/api/v1/files/cmq3file0alk34567890 \
  -H "Authorization: Bearer $AL_KEY" | jq -r .file.downloadUrl)
curl -s -o signed-nda.pdf "$URL"

Don't store downloadUrl. Store the file id and ask for a new link each time.

Response: 404

{ "error": "File not found." }

DELETE /api/v1/files/{id}

Removes the file from its record and deletes the stored bytes. Requires the write:files scope (or * for full access).

DELETE /api/v1/files/cmq3file0alk34567890 HTTP/1.1
Host: agentlyleads.com
Authorization: Bearer alk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Response: 200

{ "deleted": 1, "id": "cmq3file0alk34567890" }

Deleting an offering photo or document removes it from the offering's page as well.

Response: 400

A campaign's files are part of the mail it sent, so they cannot be removed once the campaign has gone out:

{ "error": "Files can't be removed from a campaign that has already sent." }

A delete is permanent. There is no undo endpoint, and the bytes are gone from storage.

On this page