Ask for an invitation
Menu

Endpoint

Delete a draft invoice

DELETE/v1/invoices/{id}

Deletes an invoice that is still a draft. An invoice that was finalized cannot be deleted: the call answers invoice_not_draft.

Scope a restricted key needs
invoices:write
Publishable key
Not allowed: secret or restricted key only
Idempotency-Key
Not used. A DELETE is already safe to repeat.

Parameters

Parameters of Delete a draft invoice
ParameterType and placeMeaning
idrequiredstringpathThe id of the invoice.
Orrerie-VersionstringheaderAPI version date. Default: the version the key was created with. Example 2026-10-11.

Example request

curl

curl -X DELETE https://api.orrerie.com/v1/invoices/inv_sxr44t9zk7krg104gmhsqx2p \
  -H "Authorization: Bearer $ORRERIE_SECRET_KEY"

JavaScript

const response = await fetch("https://api.orrerie.com/v1/invoices/inv_sxr44t9zk7krg104gmhsqx2p", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.ORRERIE_SECRET_KEY}`,
  },
});
const result = await response.json();
if (!response.ok) throw new Error(`${result.error.code}: ${result.error.message}`);
console.log(result);

Python

import os
import requests

response = requests.delete(
    "https://api.orrerie.com/v1/invoices/inv_sxr44t9zk7krg104gmhsqx2p",
    headers={"Authorization": f"Bearer {os.environ['ORRERIE_SECRET_KEY']}"},
    timeout=30,
)
result = response.json()
if not response.ok:
    raise RuntimeError(f"{result['error']['code']}: {result['error']['message']}")
print(result)

PHP

<?php
$request = curl_init('https://api.orrerie.com/v1/invoices/inv_sxr44t9zk7krg104gmhsqx2p');
curl_setopt_array($request, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('ORRERIE_SECRET_KEY'),
    ],
]);
$body = curl_exec($request);
if ($body === false) {
    throw new RuntimeException(curl_error($request));
}
$result = json_decode($body, true);
if (curl_getinfo($request, CURLINFO_HTTP_CODE) >= 400) {
    throw new RuntimeException($result['error']['code'] . ': ' . $result['error']['message']);
}
print_r($result);

Responses

200 OK

The answer is the invoice object. Headers: Orrerie-Request-Id.

Example response, 200

{
  "id": "inv_sxr44t9zk7krg104gmhsqx2p",
  "object": "invoice",
  "deleted": true
}

Any other status: an error

A status of 400 or above answers with the error object. Branch on its code, never on its message.

Errors

Beside the errors every call can answer with (a bad key, a missing scope, the rate limit), this call answers with:

Errors of Delete a draft invoice
CodeHTTPMeaning
invoice_not_draft409Only a draft invoice can be finalized or deleted.