Skip to navigation

Attach a file to a lead

View as Markdown

Attach a file directly to a lead. First upload the file with the Files API, then pass its download url here with a filename. You can also pass the download_url of a file already in Close. Files can be at most 25 MB.

If the lead already has a file with the same name and contents, that file is updated instead of creating a copy, and its original date_created is kept. The response is 201 either way.

Returns 403 if you can’t see the lead, and 404 if it doesn’t exist.

Authentication

AuthorizationBasic
Use your API key as the username and leave the password empty.
OR
AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

idstringRequired

ID of the lead, e.g. lead_70jZ5hiVt5X31MZ3vJ0R0GJMqJEihkoF7TtSVFbN2ty.

Request

This endpoint expects an object.
filenamestringRequired1-1024 characters

Name to give the file on the lead, e.g. contract.pdf.

urlstringRequired>=1 character

URL of the file to attach: the download URL from the Files API upload, or the download_url of a file already in Close. Must be a file you have access to, of at most 25 MB.

content_typestring or nullOptional1-255 charactersDeprecated

Deprecated: ignored. The content type is read from the uploaded file.

Response

Successful response
checksumstring

Checksum of the file’s contents, usually its MD5 hash. A lead has at most one file with a given name and checksum.

content_typestring

MIME type of the file, e.g. application/pdf.

date_createddatetime
When the file was first attached to the lead.
date_updateddatetime
When the file was last updated.
download_urlstring
URL to download the file.
idstring

Unique ID of the file, prefixed with file_.

is_pinnedboolean
Whether the file is pinned on the lead.
last_activity_atdatetime
When the file was most recently attached to an object.
last_object_idstring
ID of the object the file was most recently attached to, e.g. an email ID. For files attached directly to the lead, the lead ID.
last_object_typeenum

Type of the object in last_object_id.

lead_idstring
ID of the lead the file is on.
namestring

File name, e.g. contract.pdf.

organization_idstring
ID of the organization the file belongs to.
sizeinteger
Size of the file in bytes.
thumbnail_urlstring or null
URL to download a thumbnail of the file. Only GIF, JPEG and PNG images have one, otherwise null.
updated_bystring or null
ID of the user who last updated the file, or null.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error