API Endpoint Access URL
https://api.pixlab.io/delete
Get Your API Key & Try DELETE Now ↗Description
Remove a previously stored media file. All your processed media files are stored by default on pixlab.xyz unless you set your own AWS S3 key (refer to your dashboard ↗ on how to do that). In which case, everything shall be stored on your own S3 bucket.
HTTP Methods
GET
HTTP Parameters
Required
Fields | Type | Description |
---|---|---|
link |
URL | Target media URL or Unique media ID. |
key |
String | Your PixLab API Key ↗. You can also embed your key in the WWW-Authenticate: HTTP header and omit this parameter if you want to. |
HTTP Response
Fields | Type | Description |
---|---|---|
status |
Integer | Status code 200 indicates success, any other code indicates failure. |
id |
String | Unique media ID. |
deleted |
Boolean | Result of the delete operation. |
error |
String | Error message if status != 200. |
The API expects requests with application/json
content type and always returns a JSON response. The response includes fields indicating operation status, media ID, deletion result, and potential error details.
For API key management and monitoring, visit PixLab Console.
Code Samples
import requests
from typing import Dict, Any
def process_image() -> None:
"""Generate an oilpaint effect image and delete it using PixLab API."""
api_key = "PIXLAB_API_KEY"
base_url = "https://api.pixlab.io"
image_url = "http://cf.broadsheet.ie/wp-content/uploads/2015/03/jeremy-clarkson_3090507b.jpg"
try:
# Generate oilpaint effect
oilpaint_params = {
'img': image_url,
'radius': 3,
'key': api_key
}
response = requests.get(f"{base_url}/oilpaint", params=oilpaint_params, timeout=10)
response.raise_for_status()
oilpaint_data: Dict[str, Any] = response.json()
if oilpaint_data['status'] != 200:
raise RuntimeError(oilpaint_data.get('error', 'Unknown error occurred during oilpaint processing'))
# Delete the generated image
delete_params = {
'link': oilpaint_data['link'],
'key': api_key
}
delete_response = requests.get(f"{base_url}/delete", params=delete_params, timeout=10)
delete_response.raise_for_status()
delete_data: Dict[str, Any] = delete_response.json()
if delete_data['status'] != 200:
raise RuntimeError(delete_data.get('error', 'Unknown error occurred during deletion'))
print("Deletion succeeded")
except requests.exceptions.RequestException as e:
print(f"Request failed: {str(e)}")
except Exception as e:
print(f"An error occurred: {str(e)}")
if __name__ == "__main__":
process_image()
// Generate an oilpaint pic and delete it
fetch('https://api.pixlab.io/oilpaint?img=http://cf.broadsheet.ie/wp-content/uploads/2015/03/jeremy-clarkson_3090507b.jpg&radius=3&key=PIXLAB_API_KEY')
.then(response => response.json())
.then(reply => {
if (reply.status !== 200) {
console.log(reply.error);
return;
}
console.log("Deleting: " + reply.link + "...");
return fetch(`https://api.pixlab.io/delete?link=${reply.link}&key=PIXLAB_API_KEY`);
})
.then(response => response.json())
.then(reply => {
if (reply.status !== 200) {
console.log(reply.error);
} else {
console.log("Deletion succeed");
}
})
.catch(error => console.error('Error:', error));
<?php
$apiKey = 'PIXLAB_API_KEY';
$imageUrl = 'http://cf.broadsheet.ie/wp-content/uploads/2015/03/jeremy-clarkson_3090507b.jpg';
// Generate oilpaint image
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.pixlab.io/oilpaint?img=' . urlencode($imageUrl) . '&radius=3&key=' . urlencode($apiKey));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$reply = json_decode($response, true);
if ($reply['status'] != 200) {
die($reply['error']);
}
$imageLink = $reply['link'];
echo "Deleting: " . $imageLink . "...\n";
// Delete the generated image
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.pixlab.io/delete?link=' . urlencode($imageLink) . '&key=' . urlencode($apiKey));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$reply = json_decode($response, true);
if ($reply['status'] != 200) {
die($reply['error']);
} else {
echo "Deletion succeed\n";
}
require 'net/http'
require 'uri'
require 'json'
# Generate an oilpaint pic and delete it
uri = URI.parse('https://api.pixlab.io/oilpaint')
params = { img: 'http://cf.broadsheet.ie/wp-content/uploads/2015/03/jeremy-clarkson_3090507b.jpg', radius: 3, key: 'PIXLAB_API_KEY' }
uri.query = URI.encode_www_form(params)
response = Net::HTTP.get_response(uri)
reply = JSON.parse(response.body)
if reply['status'] != 200
puts reply['error']
exit
end
puts "Deleting: #{reply['link']}..."
uri = URI.parse('https://api.pixlab.io/delete')
params = { link: reply['link'], key: 'PIXLAB_API_KEY' }
uri.query = URI.encode_www_form(params)
response = Net::HTTP.get_response(uri)
reply = JSON.parse(response.body)
if reply['status'] != 200
puts reply['error']
else
puts "Deletion succeed"
end