Plans
Recurring invoices or pay links on a schedule.
List plans
GET /v1/plans
Key scope plans:read
Newest first, 20 at a time. See pagination.
Query: status, customer, limit, starting_after
curl "https://api.invoicing.respiresoft.com/v1/plans?limit=10" \
-H "Authorization: Bearer $RESPIRESOFT_KEY"const res = await fetch("https://api.invoicing.respiresoft.com/v1/plans?limit=10", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
},
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/plans?limit=10");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
],
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("GET", "https://api.invoicing.respiresoft.com/v1/plans?limit=10",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
},
)
data = res.json()Retrieve plan
GET /v1/plans/{id}
Key scope plans:read
curl "https://api.invoicing.respiresoft.com/v1/plans/ID" \
-H "Authorization: Bearer $RESPIRESOFT_KEY"const res = await fetch("https://api.invoicing.respiresoft.com/v1/plans/ID", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
},
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/plans/ID");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
],
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("GET", "https://api.invoicing.respiresoft.com/v1/plans/ID",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
},
)
data = res.json()Create plan
POST /v1/plans
Key scope plans:write. Send an Idempotency-Key header
| Field | Type | Meaning |
|---|---|---|
customer required | string | |
name required | string | |
currency required | string | ISO 4217 code, for example EUR. |
interval required | string | day, week, month or year. |
interval_count | integer | |
anchor_date | string | YYYY-MM-DD of the first run. |
send_as | string | invoice or pay_link. |
auto_send | boolean | |
days_until_due | integer | |
lines required | array | Rows like those of an invoice. |
curl -X POST "https://api.invoicing.respiresoft.com/v1/plans" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"customer":"cus_…","name":"Hosting","currency":"EUR","interval":"month","lines":[{"description":"Managed hosting","quantity":"1","unit_amount":4900}]}'const res = await fetch("https://api.invoicing.respiresoft.com/v1/plans", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"customer": "cus_…",
"name": "Hosting",
"currency": "EUR",
"interval": "month",
"lines": [
{
"description": "Managed hosting",
"quantity": "1",
"unit_amount": 4900
}
]
}),
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/plans");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Idempotency-Key: " . bin2hex(random_bytes(16)),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"customer" => "cus_…",
"name" => "Hosting",
"currency" => "EUR",
"interval" => "month",
"lines" => [
[
"description" => "Managed hosting",
"quantity" => "1",
"unit_amount" => 4900,
],
],
]),
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/plans",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"customer": "cus_…",
"name": "Hosting",
"currency": "EUR",
"interval": "month",
"lines": [
{
"description": "Managed hosting",
"quantity": "1",
"unit_amount": 4900
}
]
},
)
data = res.json()Update plan
PATCH /v1/plans/{id}
Key scope plans:write
Send only what changes. POST to the same address works too.
| Field | Type | Meaning |
|---|---|---|
customer | string | |
name | string | |
currency | string | ISO 4217 code, for example EUR. |
interval | string | day, week, month or year. |
interval_count | integer | |
anchor_date | string | YYYY-MM-DD of the first run. |
send_as | string | invoice or pay_link. |
auto_send | boolean | |
days_until_due | integer | |
lines | array | Rows like those of an invoice. |
curl -X PATCH "https://api.invoicing.respiresoft.com/v1/plans/ID" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Content-Type: application/json" \
-d '{"customer":"cus_…","name":"Hosting","currency":"EUR","interval":"month","lines":[{"description":"Managed hosting","quantity":"1","unit_amount":4900}]}'const res = await fetch("https://api.invoicing.respiresoft.com/v1/plans/ID", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"customer": "cus_…",
"name": "Hosting",
"currency": "EUR",
"interval": "month",
"lines": [
{
"description": "Managed hosting",
"quantity": "1",
"unit_amount": 4900
}
]
}),
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/plans/ID");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"customer" => "cus_…",
"name" => "Hosting",
"currency" => "EUR",
"interval" => "month",
"lines" => [
[
"description" => "Managed hosting",
"quantity" => "1",
"unit_amount" => 4900,
],
],
]),
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("PATCH", "https://api.invoicing.respiresoft.com/v1/plans/ID",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
},
json={
"customer": "cus_…",
"name": "Hosting",
"currency": "EUR",
"interval": "month",
"lines": [
{
"description": "Managed hosting",
"quantity": "1",
"unit_amount": 4900
}
]
},
)
data = res.json()Delete plan
DELETE /v1/plans/{id}
Key scope plans:write
curl -X DELETE "https://api.invoicing.respiresoft.com/v1/plans/ID" \
-H "Authorization: Bearer $RESPIRESOFT_KEY"const res = await fetch("https://api.invoicing.respiresoft.com/v1/plans/ID", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
},
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/plans/ID");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
],
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("DELETE", "https://api.invoicing.respiresoft.com/v1/plans/ID",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
},
)
data = res.json()Pause a plan
POST /v1/plans/{id}/pause
Key scope plans:write. Send an Idempotency-Key header
No runs until it is resumed.
curl -X POST "https://api.invoicing.respiresoft.com/v1/plans/ID/pause" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Idempotency-Key: $(uuidgen)"const res = await fetch("https://api.invoicing.respiresoft.com/v1/plans/ID/pause", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
},
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/plans/ID/pause");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Idempotency-Key: " . bin2hex(random_bytes(16)),
],
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/plans/ID/pause",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
)
data = res.json()Resume a plan
POST /v1/plans/{id}/resume
Key scope plans:write. Send an Idempotency-Key header
It starts again on its next date. Dates that passed while it was paused are not made up.
curl -X POST "https://api.invoicing.respiresoft.com/v1/plans/ID/resume" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Idempotency-Key: $(uuidgen)"const res = await fetch("https://api.invoicing.respiresoft.com/v1/plans/ID/resume", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
},
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/plans/ID/resume");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Idempotency-Key: " . bin2hex(random_bytes(16)),
],
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/plans/ID/resume",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
)
data = res.json()End a plan
POST /v1/plans/{id}/end
Key scope plans:write. Send an Idempotency-Key header
No more runs, for good. Invoices already made stay.
curl -X POST "https://api.invoicing.respiresoft.com/v1/plans/ID/end" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Idempotency-Key: $(uuidgen)"const res = await fetch("https://api.invoicing.respiresoft.com/v1/plans/ID/end", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
},
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/plans/ID/end");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Idempotency-Key: " . bin2hex(random_bytes(16)),
],
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/plans/ID/end",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
)
data = res.json()Skip the next run
POST /v1/plans/{id}/skip_next
Key scope plans:write. Send an Idempotency-Key header
The next date passes without an invoice or link and does not count towards max_runs.
curl -X POST "https://api.invoicing.respiresoft.com/v1/plans/ID/skip_next" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Idempotency-Key: $(uuidgen)"const res = await fetch("https://api.invoicing.respiresoft.com/v1/plans/ID/skip_next", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
},
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/plans/ID/skip_next");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Idempotency-Key: " . bin2hex(random_bytes(16)),
],
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/plans/ID/skip_next",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
)
data = res.json()Run the next date now
POST /v1/plans/{id}/run_now
Key scope plans:write. Send an Idempotency-Key header
Makes the invoice or pay link now. The answer has result.ran and, when it failed, the reason.
curl -X POST "https://api.invoicing.respiresoft.com/v1/plans/ID/run_now" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Idempotency-Key: $(uuidgen)"const res = await fetch("https://api.invoicing.respiresoft.com/v1/plans/ID/run_now", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
},
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/plans/ID/run_now");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Idempotency-Key: " . bin2hex(random_bytes(16)),
],
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/plans/ID/run_now",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
)
data = res.json()Change a plan from the next period
POST /v1/plans/{id}/change
Key scope plans:write. Send an Idempotency-Key header
The change waits on the plan and starts with the next run, or the first run on or after effective_on. Invoices already made are not touched.
| Field | Type | Meaning |
|---|---|---|
effective_on | string | YYYY-MM-DD. |
name | string | |
interval | string | |
interval_count | integer | |
lines | array | The new rows. |
max_runs | integer | |
ends_on | string | |
cancel | boolean | Drop a waiting change. |
curl -X POST "https://api.invoicing.respiresoft.com/v1/plans/ID/change" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"effective_on":"2027-01-01","lines":[{"description":"Managed hosting plus","quantity":"1","unit_amount":5900}]}'const res = await fetch("https://api.invoicing.respiresoft.com/v1/plans/ID/change", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"effective_on": "2027-01-01",
"lines": [
{
"description": "Managed hosting plus",
"quantity": "1",
"unit_amount": 5900
}
]
}),
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/plans/ID/change");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Idempotency-Key: " . bin2hex(random_bytes(16)),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"effective_on" => "2027-01-01",
"lines" => [
[
"description" => "Managed hosting plus",
"quantity" => "1",
"unit_amount" => 5900,
],
],
]),
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/plans/ID/change",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"effective_on": "2027-01-01",
"lines": [
{
"description": "Managed hosting plus",
"quantity": "1",
"unit_amount": 5900
}
]
},
)
data = res.json()