Bulk Delete
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({invoice_ids: ['<string>'], facility_id: '<string>', type: '<string>'})
};
fetch('https://api.dcycle.io/v1/invoices/bulk-delete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/invoices/bulk-delete"
payload = {
"invoice_ids": ["<string>"],
"facility_id": "<string>",
"type": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/invoices/bulk-delete \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"invoice_ids": [
"<string>"
],
"facility_id": "<string>",
"type": "<string>"
}
'{
"success_count": 123,
"success_ids": [
"<string>"
],
"failed_count": 123,
"failed_ids": [
"<string>"
],
"message": "<string>"
}Bulk Delete
Delete multiple invoices by ID
POST
/
v1
/
invoices
/
bulk-delete
Bulk Delete
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({invoice_ids: ['<string>'], facility_id: '<string>', type: '<string>'})
};
fetch('https://api.dcycle.io/v1/invoices/bulk-delete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/invoices/bulk-delete"
payload = {
"invoice_ids": ["<string>"],
"facility_id": "<string>",
"type": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/invoices/bulk-delete \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"invoice_ids": [
"<string>"
],
"facility_id": "<string>",
"type": "<string>"
}
'{
"success_count": 123,
"success_ids": [
"<string>"
],
"failed_count": 123,
"failed_ids": [
"<string>"
],
"message": "<string>"
}← Invoices API
Delete multiple invoices by their IDs. Invoices must belong to the specified facility and match the given type. Related emission records and distributed siblings are automatically cleaned up.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faBody Parameters
string[]
required
Array of invoice UUIDs to delete (1–100,000)
string
required
UUID of the facility the invoices belong toRetrieve available options from
GET /v1/facilitiesstring
required
Invoice type:
electricity, heat, water, rechargeResponse
integer
Number of invoices successfully deleted
string[]
UUIDs of successfully deleted invoices
integer
Number of invoices that failed to delete
string[]
UUIDs of invoices that failed to delete
string
Human-readable summary message
Example
curl -X POST "https://api.dcycle.io/v1/invoices/bulk-delete" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"invoice_ids": ["uuid-1", "uuid-2"],
"facility_id": "'${FACILITY_ID}'",
"type": "electricity"
}'
import requests
import os
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
"Content-Type": "application/json",
}
response = requests.post(
"https://api.dcycle.io/v1/invoices/bulk-delete",
headers=headers,
json={
"invoice_ids": ["uuid-1", "uuid-2"],
"facility_id": os.getenv("FACILITY_ID"),
"type": "electricity",
},
)
result = response.json()
print(f"Deleted: {result['success_count']} | Failed: {result['failed_count']}")
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
'Content-Type': 'application/json',
};
axios.post('https://api.dcycle.io/v1/invoices/bulk-delete', {
invoice_ids: ['uuid-1', 'uuid-2'],
facility_id: process.env.FACILITY_ID,
type: 'electricity',
}, { headers })
.then(response => {
const { success_count, failed_count } = response.data;
console.log(`Deleted: ${success_count} | Failed: ${failed_count}`);
});
Successful Response
{
"success_count": 2,
"success_ids": ["uuid-1", "uuid-2"],
"failed_count": 0,
"failed_ids": [],
"message": "Successfully deleted 2 invoices"
}
Common Errors
401 Unauthorized
Cause: Missing or invalid API key{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
403 Forbidden
Cause: The authenticated user is not a member of the organization{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
422 Unprocessable Entity
Cause: Missing required fields or invalid invoice type{
"detail": [
{
"loc": ["body", "invoice_ids"],
"msg": "field required",
"type": "value_error.missing"
}
]
}
A companion endpoint,
POST /v1/invoices/bulk-delete-preview, returns what a bulk delete would
remove before you confirm it. It is not documented yet.Related Endpoints
Bulk Delete by Filters
Delete invoices matching filter criteria
Was this page helpful?