cURL
# Set LIGHT_IDEMPOTENCY_KEY to a key saved for this operation; reuse it on retries.
curl -X DELETE "https://api.light.inc/v1/contracts/3c90c3cc-0d44-4b50-8888-8dd25736052a/lines/3c90c3cc-0d44-4b50-8888-8dd25736052a" \
-H "Authorization: Basic YOUR_API_KEY" \
-H "X-Idempotency-Key: ${LIGHT_IDEMPOTENCY_KEY:?Set a saved key for this operation}"
JavaScript
// Set LIGHT_IDEMPOTENCY_KEY to a key saved for this operation; reuse it on retries.
const idempotencyKey = process.env.LIGHT_IDEMPOTENCY_KEY;
if (!idempotencyKey?.trim()) throw new Error("Set a saved key for this operation");
const res = await fetch("https://api.light.inc/v1/contracts/3c90c3cc-0d44-4b50-8888-8dd25736052a/lines/3c90c3cc-0d44-4b50-8888-8dd25736052a", {
method: "DELETE",
headers: {
Authorization: `Basic ${process.env.LIGHT_API_KEY}`,
"X-Idempotency-Key": idempotencyKey,
},
});
const data = await res.json();
Python
import os, requests
# Set LIGHT_IDEMPOTENCY_KEY to a key saved for this operation; reuse it on retries.
idempotency_key = os.environ["LIGHT_IDEMPOTENCY_KEY"]
if not idempotency_key.strip():
raise ValueError("Set a saved key for this operation")
res = requests.delete(
"https://api.light.inc/v1/contracts/3c90c3cc-0d44-4b50-8888-8dd25736052a/lines/3c90c3cc-0d44-4b50-8888-8dd25736052a",
headers={
"Authorization": f"Basic {os.environ['LIGHT_API_KEY']}",
"X-Idempotency-Key": idempotency_key,
},
)
data = res.json()