Main Content

Delete Image

Delete image from channel with HTTP DELETE

Request

HTTP Method

DELETE

URL

https://data.thingspeak.com/channels/<channel_id>/images?timestamp=<timestamp_src>&start=<start_time>&end=<end_time>

URL Parameters

NameDescription

<channel_id>

(Required) Channel ID for the channel to remove images from.

timestamp=<timestamp_src>

Source of timestamp when image was posted. Either ingest or client.

start=<start_time>

Beginning of timestamp range for images to delete, in the format

YYYY-MM-DDTHH:MM:SS.SSSS+HH:MM

end=<end_time>

End of timestamp range for images to delete, in the format

YYYY-MM-DDTHH:MM:SS.SSSS+HH:MM

Example: https://data.thingspeak.com/channels/95b0766f76/images?timestamp=ingest&amp;start=2022-02-22T22:22:22.2222+05:00&amp;end=2022-06-22T22:22:22.2222+05:00

Body Parameters

None.

Headers

The following headers are required for an image DELETE request.

Key NameValue
thingspeak-image-channel-api-key

(Required) The API Key for this specific image channel. The Write API Key is found on the API Keys column of the image channels view.

Response

Success

HTTP Status Code

202 Accepted

Body

The immediate response is a JSON object with the request ID, code, and status. For example:

{
    "requestID": "cl2th2wxyuvtsr7m9e3l5blje",
    "code": 0,
    "status": "PENDING"
}

Error

For the full list, see Error Codes.

Examples

expand all

The following code operates in a Linux® shell. Change the channel ID and other parameters as appropriate.

curl --location --request DELETE 'https://data.thingspeak.com/channels/95b0766f76/images?timestamp=ingest&start=2022-02-22T22:22:22.2222+05:00&end=2022-06-22T22:22:22.2222+05:00' \
--header 'thingspeak-image-channel-api-key: M3I17NS05QKZ6Q5D'

The raw response is:

{"requestID":"cl2t7ybd40ppo07k7fo2lbi83","code":0,"status":"PENDING"}

You can use Postman to send HTTP DELETE requests using the RESTful API for ThingSpeak. This example shows how to delete a set of images within a range of timestamps.

  1. In Postman, select DELETE from the drop-down list of HTTP verbs.

  2. In the address bar, enter https://data.thingspeak.com/channels/<chanID>/images, replacing <chanID> with the ID of the channel with the images to be deleted.

  3. Under the Params tab, enter the following parameter keys with appropriate values.

    • timestamp

    • start

    • end

  4. Under the Headers tab, enter the parameter key thingspeak-image-channel-api-key with the value from your image channel API Key, which is found in the Channels > My Image Channels listing.

  5. Under the Body tab, choose none.

This image shows the parameters to delete images over a four month range

Postman query parameters for image delete

The response is a JSON object, and a 202 Accepted from the server.