LeadSquared Developer Centre

ON THIS PAGE

Upload a File

This downloads our complete API collection, including all endpoints—not just this specific endpoint.
Run in Postman

Uploads a file to your LeadSquared account. Returns the file name in the uploadedFile response parameter.
We recommend uploading files to leads or activities via associated Custom Field Sets.

Once the file has been uploaded successfully –

  • To attach the file to a specific lead, pass the file name returned from the uploadedFile parameter in a file-type CFS field associated with a lead.
  • To attach the file to a specific activity pass the file name returned from the uploadedFile parameter
    • In a file-type CFS field associated with an activity.
    • As an activity note.

 

API URL

Use the URL specific to your region –

Region URL
Singapore https://files.leadsquared.com/File/Upload
United States https://files-us11.leadsquared.com/File/Upload
India https://files-in21.leadsquared.com/File/Upload
Ireland https://files-ir31.leadsquared.com/File/Upload

 

Request Body

Content-Type: Multipart/form-data

Parameter Type Description
uploadFiles File The file you want to upload
FileType Number 0 = Document
1 = Image
3 = Lead Attachment
7 = Custom Field Set Document
AccessKey String Access Key of your LeadSquared account
SecretKey String Secret Key of your LeadSquared account
FileStorageType Number 0 = Permanent
1 = Temporary
EnableResize Boolean true or false

Always set to ‘false’ for Custom Field Sets

Id String Pass the Lead Id if Entity is lead.

Pass the Opportunity Event Code if Entity is opportunity.

Pass the Activity Event Code if the entity is activity.

SchemaName String Schema name of the file-type field within the custom field set.
EntitySchemaName String Schema name of the lead/activity field with which the custom field set is associated.
Entity Number 0 = Lead
1 = Activity/Opportunity. This is dependent on the Id that’s being passed. If you pass the Activity Event Code as the Id, and then pass 1 as the Entity, the corresponding activity is updated. Similarly, if you pass the Opportunity Event Code as the Id, and then pass 1 as the Entity, the corresponding opportunity is updated.
StorageVersion Number The storage version configured.

0 is the default LeadSquared configuration

If you have your own storage configured, pass the value associated with it. For more information, contact your account manager.

 

Sample Request

uploadFiles = provide the file to be uploaded
FileType = 7
AccessKey = <AccessKey>
SecretKey = <SecretKey>
FileStorageType=0
EnableResize= false
Id= 252
SchemaName=” mx_CustomObject_1”
EntitySchemaName=” mx_Custom_2”
Entity= 1
StorageVersion=4

 

Sample Response

{
"Status": "Success",
"uploadedFile": "Hierarchy for Help Doc.pdf",
"relativeFilePath": "https://f2.leadsquaredcdn.com/t/t20170817174751/content/common/documents/Hierarchy for Help Doc.pdf",
"s3FilePath": "https://landingpagecontentv2.s3.amazonaws.com/t/t20170817174751/content/common/documents/Hierarchy for Help Doc.pdf",
"description": null
}

 

Next Steps

You can now add the uploaded file to a CFS associated with a lead (for example, by calling Create a Lead, Update a Lead, etc.), or with an activity (for example, by calling Post Activity on Lead API, Update an Activity, etc.).

In the request body, pass uploadedFile (file name) in the required CFS file-type field.

 

Example – Adding the Uploaded File to a CFS Associated with an Activity

In this example, we’re calling the Post Activity on Lead API, and attaching the file to a field within an associated custom object.

URL https://{host}/v2/ProspectActivity.svc/Create?accessKey=AccessKey&secretKey=SecretKey
HTTP Method Post
Content-Type application/json

 

Sample Request

{
"RelatedProspectId": "fda46463-2f03-439b-ae4b-0649f22b9aa7",
"ActivityEvent": 158,
"ActivityNote": "Post File upload",
"ActivityDate": "/Date(1545287280000)/",
"ActivityDateTime": "2019-08-19 13:57:00",
"Score": 0,
"Fields": [
{
"SchemaName": "mx_Custom_1",
"Value": "",
"Fields": [
{
"SchemaName": "Status",
"Value": "Approved"
},
{
"SchemaName": "mx_CustomObject_1",
"Value": "13bdf0cb.jpg"}]}]}

 

Sample Response

{
"Status": "Success",
"Message": {
"Id": "1d188fe1-6bf5-4dc6-8b50-694fd68f97b4",
"RelatedId": "fda46463-2f03-439b-ae4b-0649f22b9aa7"
}
}

On this page

© 2024 by MarketXpander Services Pvt Ltd. All Rights Reserved.