API - How to Recover or Delete Archived Leads

Recovering archived leads is an important function to maintain flexibility in managing the contact base. Sometimes an archived lead may become engaged again or present new opportunities, and it is essential that the unarchiving process be quick and straightforward. The SprintHub API allows you to easily query and manage your archived leads, using the correct endpoint.
Endpoint to Query Archived Leads
To retrieve the leads that are archived in a SprintHub instance, you must use the following endpoint:
https://sprinthub-api-master.sprinthub.app/lead/archive?i=YOUR_INSTANCE&apitoken=YOUR_INSTANCE_TOKEN
In this endpoint, you need to pass two essential parameters:
i=YOUR_INSTANCE: Identifies which instance is being queried.
apitoken=YOUR_INSTANCE_TOKEN: Authentication token, ensuring that the request is being made by an authorized user.
Requirements for the Request Body
To perform the query and ensure that the archived lead is correctly identified, the request body must contain the following data in JSON format:
Explanation:
archived: This field must be set to
trueto confirm that you are looking for archived leads.id: The specific ID of the lead you want to query or manage. In this case, the ID is 2331, but it must be replaced with the ID of the lead you are trying to retrieve.
Step-by-Step to Retrieve Archived Leads
Request Setup: Use an API tool such as the Postman or an HTTP client to make the POST request to the endpoint mentioned.
Sending the Parameters: Make sure the URL parameters and authentication token are correct, ensuring access to the right instance and proper authorization.
Define the Request Body: In the request body, as shown above, define the fields
"archived": falseand specify theidarchived lead ID.Send the Request: Click on "Send" to send the request. If the request is correct, you will receive a response with status 200 OK, indicating that the lead was found.
Practical Example of a Request in Postman
The image shown illustrates a real example in Postman, where the request was successful, returning a status 200 OK.
Method: POST
URL:
https://sprinthub-api-master.sprinthub.app/lead/archive?i=YOUR_INSTANCE&apitoken=YOUR_INSTANCE_TOKENBody:

When making this request, the lead with ID 2331 was retrieved as archived.

Now to Delete:
Remember that, when you delete this lead, it is lost forever and cannot be recovered
Method: DELETE
URL:
https://sprinthub-api-master.sprinthub.app/leads/LEAD_ID?i=YOUR_INSTANCE&apitoken=YOUR_INSTANCE_TOKEN

When making this request, the lead with ID 2346 was Deleted, even though it was archived.

If you want to perform a bulk archiving, unarchiving, or deletion of archived leads, it will be necessary to pass an array with all the lead IDs.
Conclusion
The process of retrieving archived leads via the SprintHub API is simple and effective. Make sure to always use the correct ID and set the field "archived": true in the request body to ensure that you are accessing the information of archived leads. This feature is essential to maintain flexibility and ensure that leads can be restored whenever necessary, without loss of important data.
Last updated
Was this helpful?