Remove Background API - cURL Example
Endpoint
POST http://XXXXXXXX/api/files/remove-background
cURL Request
curl --location 'http://xxxxxxxxxx.xom/api/files/remove-background'
--header 'Accept: application/json'
--header 'Content-Type: multipart/form-data'
--header 'Authorization: Bearer [your_token_here>]
--form 'images=@"path to file.jpg"'
--form 'images=@"path to file.png"'
Request Details
- Method: POST
- Content-Type: multipart/form-data
- Headers:
Accept: application/json
Authorization: Bearer <your_token_here>
- Body: Image file (e.g. .jpg, .png)
Example Successful Response
{
"message": "Upload and processing successful",
"original_url": "/static/uploads/original_filename.png",
"processed_url": "/static/uploads/processed_filename.png",
"file_name": "processed_filename.png"
}
Possible Errors
- 400: No image provided or invalid file
- 401: Unauthorized (missing or invalid token)
- 415: Unsupported Media Type
- 500: Internal Server Error
Using PHP
$apiUrl = 'http://xxxxxxxxxxxxx/api/files/remove-background';
$imagePath = 'path to file.jpg'; // Path to the image file
$token = ; // Replace with actual token
//Prepare cURL file for upload
$cfile = new CURLFile($imagePath, mime_content_type($imagePath), basename($imagePath));
//Set up POST fields
$postFields = [
'image' => $cfile
];
//Initialize cURL session
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'Authorization: Bearer ' . $token
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute request and capture response
$response = curl_exec($ch);
// Error handling
if (curl_errno($ch)) {
echo 'cURL error: ' . curl_error($ch);
} else {
// Convert JSON response to PHP array
$result = json_decode($response, true);
echo "Response:\n";
print_r($result);
}
// Close session
curl_close($ch);
Get Shipping Rates
Get Rates
POST http://XXXXXXXXX/api/shipping/rates
cURL Request
curl --location 'http://XXXXXXXXXXXXXXXXX/api/shipping/rates'
--header 'Accept: application/json'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer [your_token_here]'
--data '{
"carriers": [
"fedex",
"ups"
],
"shipment_data": {
"shipper": {
"address": {
"streetLines": [
"123 Shipper St"
],
"city": "Austin",
"stateOrProvinceCode": "TX",
"postalCode": "73301",
"countryCode": "US"
}
},
"recipient": {
"address": {
"streetLines": [
"456 Recipient Ave"
],
"city": "New York",
"stateOrProvinceCode": "NY",
"postalCode": "10001",
"countryCode": "US",
"residential": false
}
},
"package": {
"weight": {
"value": 5,
"units": "LB"
},
"dimensions": {
"length": 10,
"width": 6,
"height": 4,
"units": "IN"
}
}
}
}'
Generate QR
Generate QR Codes
POST http://XXXXXXXXX/api/info/qr
cURL Request
curl --location 'http://XXXXXXXXXXX/api/info/qr'
--header 'Accept: application/json'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer '
--data '[
{
"text": "dw.tv",
"color": "white",
"back_color": "black"
},
{
"text": "bbi.com",
"color": "green",
"back_color": "orange"
}
]'
Invoices
POST http://XXXXXXXXX/api/invoice/create
cURL Request
curl --location 'http://xxxxxxxxxxx/api/invoice/create'
--header 'Accept: application/json'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer [token]'
--data-raw '{
"customer_name": "Jane Doe",
"customer_address": "123 Maple Street, Springfield, IL",
"customer_email": "jane@example.com",
"customer_phone": "555-1234",
"org_name": "My Company LLC",
"org_address": "456 Elm Street, Chicago, IL",
"org_email": "contact@mycompany.com",
"org_phone": "555-5678",
"doc_type": "Invoice",
"invoice_number": "INV-1001",
"invoice_date": "2025-05-20",
"due_date": "2025-06-01",
"terms": "Net 30",
"notes": "Thank you for your business!",
"tax_rate": 7.5,
"items": [
{
"description": "Consulting services",
"amount": 150.00,
"qty": 2
},
{
"description": "Website hosting (3 months)",
"amount": 25.00,
"qty": 3
}
]
}'
Bar Codes
POST http://XXXXXXXXX/api/codes/bar
cURL Request
curl --location 'http://127.0.0.1:5000/api/info/bar'
--header 'Accept: application/json'
--header 'Content-Type: application/json'
--header 'Authorization: ••••••'
--data '[
{
"serial_number": "ABC123",
"barcode_format": "code128",
"name": "Product A"
},
{
"serial_number": "XYZ789",
"barcode_format": "ean13",
"name": "Product B"
}
]'
POST http://XXXXXXXXX/api/
cURL Request
POST http://XXXXXXXXX/api/
cURL Request