Aller au contenu

POST /v1/recurring-invoices

POST
/v1/recurring-invoices
curl --request POST \
--url https://api.asap.cool/v1/recurring-invoices \
--header 'Content-Type: application/json' \
--data '{ "auto_collect_sepa": true, "auto_send": true, "contact_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "frequency": "example", "items": [ { "description": "example", "details": "example", "position": 1, "quantity": "example", "unit_price": 1, "vat_rate": "example" } ], "next_generation_date": "example", "notes": "example", "operation_nature": "example", "title": "example" }'
Media type application/json

Body of POST /v1/recurring-invoices. org_id is never accepted here.

object
auto_collect_sepa

Debit each auto-sent invoice off-session via the buyer’s stored SEPA mandate. Per-series opt-in, defaults to false; when off, no invoice of this template is auto-debited even if the contact holds an active mandate.

boolean
auto_send

Finalize and send each generated draft automatically. Defaults to false. When true, operation_nature is required.

boolean
contact_id
required

Target contact id.

string format: uuid
frequency
required

Cadence (monthly/quarterly/yearly).

string
items
required

Line items (at least one).

Array<object>

One line item in a recurring-invoice create request.

object
description
required

Line description.

string
details

Long description printed under the label. Optional free text.

string | null
position

Ordering position (defaults to the array index).

integer | null format: int32
quantity
required

Quantity (decimal token, strictly positive).

string
unit_price
required

Unit price excluding VAT, in cents (>= 0).

integer format: int64
vat_rate
required

VAT rate as a percentage token ([0, 100]).

string
next_generation_date
required

First generation date (YYYY-MM-DD).

string
notes

Notes for generated documents.

string | null
operation_nature

Operation nature (biens/services/mixte) applied to generated documents. Required when auto_send is true (finalize needs it).

string | null
title

Title for generated documents.

string | null
Example generated
{
"auto_collect_sepa": true,
"auto_send": true,
"contact_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"frequency": "example",
"items": [
{
"description": "example",
"details": "example",
"position": 1,
"quantity": "example",
"unit_price": 1,
"vat_rate": "example"
}
],
"next_generation_date": "example",
"notes": "example",
"operation_nature": "example",
"title": "example"
}

Recurring template created.

Media type application/json

Public projection of a [RecurringInvoice].

object
auto_collect_sepa
required

Whether each auto-sent invoice is debited off-session via a stored SEPA mandate (per-series opt-in; defaults to false).

boolean
auto_send
required

Whether generated drafts are finalized and sent automatically.

boolean
contact_id
required

Target contact.

string format: uuid
created_at
required

RFC3339 creation timestamp.

string
frequency
required

Cadence (monthly/quarterly/yearly).

string
id
required

Stable identifier.

string format: uuid
items
required

Line items snapshot (JSONB array).

object
next_generation_date
required

Next generation date (YYYY-MM-DD).

string
notes

Optional notes for generated documents.

string | null
operation_nature

Operation nature (biens/services/mixte) applied to generated documents; null when unset.

string | null
paused_at

RFC3339 pause timestamp, or null when active.

string | null
status
required

Lifecycle status derived from paused_at: "active" or "paused".

string
title

Optional title for generated documents.

string | null
updated_at
required

RFC3339 last-update timestamp.

string
Example generated
{
"auto_collect_sepa": true,
"auto_send": true,
"contact_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"created_at": "example",
"frequency": "example",
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"items": {},
"next_generation_date": "example",
"notes": "example",
"operation_nature": "example",
"paused_at": "example",
"status": "example",
"title": "example",
"updated_at": "example"
}

No active org.

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}

Missing invoice:write scope.

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}

Invalid recurring payload.

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}