Skip to content
Squid

Empty Squid

Remove the tasks of a squid, keeping its settings and the results of its earlier runs

The v1 API, for batchesSquids, tasks and runs: many calls on a schedule, delivered where you work. For one call that answers in seconds, use the API v2.
POSThttps://api.lobstr.io/v1/squids/{squid_hash}/empty

This 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

Authorizationstringheaderrequired

Your API authentication token. Value: Token YOUR_API_KEY

Content-Typestringheaderrequired

Must be application/json. Value: application/json

Path Parameters

squid_hashstringpathrequired

The unique identifier (hash) of the squid to empty. Example: 388d6d5e98134294ac612ec9f99dc5b1

Request Body

typestring

Kind 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

idstring

Squid identifier. Example: "388d6d5e98134294ac612ec9f99dc5b1"

objectstring

Always "squid". Example: "squid"

emptiedboolean

Boolean indicating success. Example: true

deleted_countinteger

Number 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

200
{
  "id": "388d6d5e98134294ac612ec9f99dc5b1",
  "object": "squid",
  "emptied": true,
  "deleted_count": 1
}