Share a Lead

Lets you share a lead with a sales user for a specific duration. You can also configure the type of lead access (read, edit) you want to give the user.

  • Ensure that you have met the prerequisites listed here before using this API.
  • To share a lead, you must first post an activity where the activity owner is a chosen sales user (You may use the Post Activity to a Lead API).
  • You must then pass the activity Id (in the ContextEntityId parameter) while calling this API.
    When the call is successful, the lead will automatically be shared with the activity owner with the specified access and for the specified duration. To learn more, see How to Share a Lead for a Limited Duration.
  • You’ll get a request Id in the response if the call is successful. You can use this request Id in the Get Status of a Share/Revoke request API to see if it has been processed.

Note: All parameters except DurationInMinutes are mandatory. If you don’t pass DurationInMinutes, the default value will be 90 days. You may contact support@leadsquared.com to change the default value. However, we advise you to pass this parameter with the required duration.

 

API URL

POST
https://{host}/v2/EntityAccess.svc/Share?accessKey=AccessKey&secretKey=SecretKey
Copy URL

Request

JSON Body/Payload

Content-Type: application/json

[
  {
    "UserId": "0203f172-8642-11e7-9bed-069b743e848f",
    "Entity": 1,
    "EntityType": 3,
    "EntityId": "869196",
    "ContextEntity": 1,
    "ContextEntityId": "f2dbf1d5-bbab-418b-bddc-4c92ecdef214",
    "AccessType": 2,
    "DurationInMinutes": 30
  }
]

JSON Properties

Parameter Description
UserId

Id of the sales user with whom you want to share the lead.

You can use the Get Users API to retrieve user Ids.

Entity

Currently the only entity you can share is 1 = lead. Pass 1 here.

EntityType

This is the entity the lead is being shared with. Currently you can only share a lead with 3 = user. Pass 3 here.

EntityId

Pass the ProspectAutoId (also known as LeadAutoId) here. You can get it by calling the Get Lead by Id API.

You can also find it on the Manage Leads UI as ‘Lead Number’.

ContextEntity

The context through which the lead is being shared. Currently only 1 = Activity is allowed. Pass 1 here.

ContextEntityId

Pass the ActivityId here. You can use the Get Activities by Date Range API or other retrieve activity APIs to find it.

AccessType

Defines if you want to give the user read or write access to the lead.

  • Pass 1 for read access
  • Pass 2 for write access
DurationInMinutes

The duration (in minutes) you want to grant the user access to the lead for.

Response

200 OK

Content-Type: application/json

{
  "Status": "Success",
  "Message": {
    "Id": "98fe2984209c413c9b6b06a1b68111ff"
  }
}

HTTP Response Code

Code Description
200 OK

This is the status code for successful API call.

401 Unauthorized

The API call was made with invalid access credentials. Check your AccessKey and SecretKey.

400 Bad Request

The message body on the request is not as per API specification. Make sure that content type is set to “application/json” and the JSON body has correct attribute names and structure.

404 Not Found

The API could not be found. Please check the API signature.

429 Too Many Requests

API calls exceeded the limit of 25 in 5 second(s)

500 Internal Server Error

The API called failed. There could be many reasons for it. Check the exception message to get more details.