Empty Squid
Remove the tasks of a squid, keeping its settings and the results of its earlier runs
https://api.lobstr.io/v1/squids/{squid_hash}/emptyThis endpoint removes the tasks of a squid, all of them or one kind, and returns how many it removed. The squid keeps its settings, and the results of its earlier runs stay downloadable, by run and by squid.
What Gets Removed
Only tasks, depending on the type parameter:
- no
type: every task - url: the URL tasks
- params: the parameter tasks (city, keyword...)
The squid itself remains with all its settings (name, parameters, integrations, schedule). This is useful when you want to:
- Remove the done tasks before adding new ones, so the next run only processes the new ones (a run processes every task of the squid)
- Reset a squid without losing its configuration or its results
- Remove tasks that are no longer needed
Headers
AuthorizationstringheaderrequiredYour API authentication token. Value: Token YOUR_API_KEY
Content-TypestringheaderrequiredMust be application/json. Value: application/json
Path Parameters
squid_hashstringpathrequiredThe unique identifier (hash) of the squid to empty. Example: 388d6d5e98134294ac612ec9f99dc5b1
Request Body
typestringKind of tasks to remove: url for URL tasks or params for parameter tasks. Leave it out to remove every task. Also accepted in the query string (?type=url). Example: "url"
Response Field Explanations
idstringSquid identifier. Example: "388d6d5e98134294ac612ec9f99dc5b1"
objectstringAlways "squid". Example: "squid"
emptiedbooleanBoolean indicating success. Example: true
deleted_countintegerNumber of tasks removed. Example: 150
Removed tasks cannot be restored. The results of earlier runs are kept.
Use this before re-importing tasks to avoid duplicates. Empty the squid, then add fresh tasks.
The squid's settings (parameters, integrations, schedule) and the results of its earlier runs are kept. Only tasks are removed.
Check the 'deleted_count' in the response to verify how many tasks were removed.
Emptying is refused while a run of the squid is in progress (RunInProgress): wait for it to end, or abort it first.
Code Examples
curl -X POST "https://api.lobstr.io/v1/squids/388d6d5e98134294ac612ec9f99dc5b1/empty" \ -H "Authorization: Token YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "url" }'
Response
{ "id": "388d6d5e98134294ac612ec9f99dc5b1", "object": "squid", "emptied": true, "deleted_count": 1 }