LeadSquared API returns synchronous responses by default. We also offer Asynchronous (Async) API for even better reliability and performance. In addition, by using asynchronous responses, your implementation can do other tasks while LeadSquared is retrieving your data.
Whether the LeadSquared core platform is up or down, Async APIs will always guarantee zero leakage. Requests will be accepted, processed, and also retried up to 10 times.
Peak Usage Protection
Async APIs can manage any load, even when called with large volumes, the API requests will still be accepted.
How It Works
Async API requests are first queued and later picked for processing. Requests that fail for non-application reasons are retried. Note that retries are only performed for non-application errors (system errors like ‘Unable to Connect to DB). Application errors (like validation errors and other exceptions starting with ‘MX’) are not retried.
Retry is performed a maximum of 10 times at the following intervals –
- 1st Retry – 30s
- 2nd Retry – 2m
- 3rd Retry – 7m
- 4th Retry – 15m
- 5th Retry – 30m
- 6th Retry – 45m
- 7th Retry – 60m
- 8th Retry – 1.5h
- 9th Retry – 2h
- 10th Retry – 3h
When you make a call using Async API, instead of the actual response data, a
RequestId is returned in the response.
- Pass the
RequestIdin the query string of the Status API*.
- The response will return the status of the request –
- If successful, the actual response data will be returned
- If unsuccessful, the response returns details on the status, reason, and steps.
* There are different Status APIs available for different Async APIs. For example. the Capture Leads API
v2/LeadManagement.svc/Lead.Capture? has the following Status API endpoint
API Host and Key
The API host is dependent on your account region.
Note: You must use the correct API host to make successful calls. If you use an incorrect host you’ll get a
401 Unauthorized error. The correct API host will be mentioned in the error message.
To find your API host and
- Log in to your LeadSquared account and navigate to My Profile>Settings>API and Webhooks>Async API.
- Alongside Enable Async API, click Yes.
- Your API host and Key will both be visible on the page.
Authentication for Async APIs requires you to pass the following –
SecretKeymust be passed in the query string
x-api-keymust be passed in the header
- The Status API doesn’t require
- For all other requests, you must pass valid access and secret keys associated with your LeadSquared.
Async APIs are free from rate limits. The rate limits specified for other v2 APIs do not apply to Async APIs.
However, requests are internally processed as per our capabilities. In case of sudden spikes, a slight backlog can be expected.