Skip to main content
Although images themselves aren’t stored directly in the Wesog Search service—instead only external URLs and AI-generated data representations are retained—users are provided with the ability to remove this information using the DELETE /imgs endpoint. Deletion can be performed on a single image or on an entire batch (the recommended approach for removing large numbers of images). To support this, two different endpoints have been implemented, as explained below:

Delete a single image (DELETE /imgs/{item_id})

This endpoint allows for the deletion of data for a specific image using its unique identifier (item_id).

Parameters

In this case, the only parameter directly associated with the image to be sent is the item_id, which, as indicated in the endpoint name, is included as a URL parameter. The other parameters that can be sent as Query Parameters are:
ParameterTypeRequiredDescription
waitBooleanNoEnables ‘Synchronous’ mode. When true, waits until operation completes (default: false)
urgentBooleanNoEnqueue the operation associated at head of operation’s queue
strictBooleanNoEnables ‘Strict’ mode. When true, fails if image ID doesn’t exist. When false, ignores missing IDs (default: false)

Request Example

curl --request DELETE \
  --url https://api.wesog.com/imgs/image123 \
  --header 'API-Key: <api-key>'

Responses

Deleting an image internally triggers an operation whose status can be queried. Accordingly, the endpoint returns all information associated with that operation, enabling the client to identify the generated operation ID and check its status thereafter.

Image was deleted successfully (Response Code: 200)

If the image has been deleted successfully, all information related to the operation created to manage the image deletion will be returned, for example:
{
  "method": "del",
  "resource": "video",
  "num_total": 1,
  "num_good": 1,
  "num_bad": 0,
  "is_started": true,
  "all_good": true,
  "do_wait": false,
  "do_urgent": false,
  "do_strict": false,
  "idle_ms": 0,
  "exec_ms": 800,
  "created_at": "2024-10-19T12:00:00Z",
  "started_at": "2024-10-19T12:00:01Z",
  "finished_at": "2024-10-19T12:00:02Z",
  "errors": []
}

Image deletion accepted but pending (Response Code: 202)

If the request has simply been accepted but is pending asynchronous execution, an object with the ID of the operation created to manage the image deletion will be returned, for example:
{
  "operation_id": 123,
  "n_total": 1,
  "msg": "Image deletion accepted, processing in progress."
}

Error in data validation (Response Code: 422)

If some error has occurred during the data validation stage, this will be shown with an error message indicating the reason for the failure, for example:
{
  "detail": [
    {
      "loc": ["<field_name>"],
      "msg": "<error_message>",
      "type": "<error_type>"
    }
  ]
}

Delete multiple images (DELETE /imgs)

This endpoint allows you to delete data for multiple images at once. It’s useful for efficiently removing large quantities of images.

Parameters

This endpoint maintains the same Query Parameters as the previous endpoint, but also allows for a request body containing the identifiers of the images to be deleted.
ParameterTypeRequiredDescription
waitBooleanNoEnables ‘Synchronous’ mode. When true, waits until operation completes (default: false)
strictBooleanNoEnables ‘Strict’ mode. When true, fails if image ID doesn’t exist. When false, ignores missing IDs (default: false)
urgentBooleanNoEnables ‘Faster’ mode. When true, operation is prioritized in queue (default: false)
Since this endpoint is specifically designed to allow for the deletion of multiple images at once, the request body must include a list of JSON objects, each containing an id field with the identifier of the image to be deleted. For example:
[
  {
    "id": "image123"
  },
  {
    "id": "image456"
  },
  {
    "id": "image789"
  }
]
Thus, the structure of the JSON objects that should comprise the list is:
FieldTypeRequiredDescription
idString/NumberYesUnique identifier of the image to delete

Request Example

Here is an example of how to use the Wesog Search API for deleting multiple images:
curl --request DELETE \
  --url https://api.wesog.com/imgs \
  --header 'API-Key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '[
  {
    "id": "image123"
  },
  {
    "id": "image456"
  },
  {
    "id": "image789"
  }
]'

Responses

Images were deleted successfully (Response Code: 200)

Similar to the scenario where only a single image is requested to be deleted from the Wesog service, in the case of deleting multiple images, if they were processed and removed from the system (or were processed and discarded due to some type of internal error), a response will be provided with a message including all relevant information related to the image deletion process.

Images deletion accepted but pending (Response Code: 202)

The process of deleting a set of images usually requires more time than deleting a single image, depending on the amount of data sent to the service. For this reason, the type of response that will be shown predominantly in a short period of time after making the deletion request will be this one. As seen previously when dealing with the process of deleting a single image, the operation ID, total number of images being processed, and a secondary message providing more information about the operation’s progress are sent, if necessary.
{
  "operation_id": 123,
  "n_total": 3,
  "msg": "Images deletion accepted, processing in progress."
}

Error in validation data (Response Code: 422)

This error occurs just like in the case of the individual image, when the format of the sent message does not match the expected format, described in the request section. This happens mainly when necessary fields such as id are not included.
{
  "detail": [
    {
      "loc": ["<field_name>"],
      "msg": "<error_message>",
      "type": "<error_type>"
    }
  ]
}