Aller au contenu

POST /v1/invoices/{id}/schedule-send

POST
/v1/invoices/{id}/schedule-send
curl --request POST \
--url https://api.asap.cool/v1/invoices/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/schedule-send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "email": "example", "send_at": "example", "timezone": "example" }'
id
required
string format: uuid

Document identifier.

Media typeapplication/json

Corps de POST /v1/invoices/{id}/schedule-send.

object
email

Destinataire de substitution pour ce seul envoi. Ne mute pas le contact.

string | null
send_at
required

Instant de déclenchement, RFC3339 avec décalage (2026-10-01T08:00:00+02:00).

string
timezone

Fuseau IANA dans lequel l’échéance est exprimée. Défaut Europe/Paris.

Il n’est pas décoratif : la date d’émission du document sera la date civile de send_at dans ce fuseau, et c’est elle qui décide du mois de TVA et de l’année de la série de numérotation.

string | null

Example generated

{
"email": "example",
"send_at": "example",
"timezone": "example"
}

Send scheduled (or rescheduled), with the readiness verdict.

Media typeapplication/json

Une planification d’envoi telle que l’API la rend.

object
document_id
required

Document visé.

string format: uuid
email

Destinataire de substitution.

string | null
failed_at

Échec définitif (RFC3339).

string | null
failure_reason

Motif de l’échec.

string | null
id
required

Identifiant de la planification.

string format: uuid
issue_date
required

Date d’émission que portera le document (YYYY-MM-DD), calculée dans timezone. Exposée pour que l’UI puisse annoncer la conséquence sans refaire le calcul de fuseau côté client.

string
readiness
required

Verdict de préparation au moment de la réponse.

object
blocking_reason

Motif du refus, tel que la validation métier l’a formulé. None avec ready: false signifie « verdict indisponible », pas « refusé ».

string | null
ready
required

true quand le brouillon passerait la finalisation en l’état.

boolean
send_at
required

Instant de déclenchement (RFC3339).

string
sent_at

Envoi effectué (RFC3339).

string | null
timezone
required

Fuseau IANA retenu.

string

Example generated

{
"document_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"email": "example",
"failed_at": "example",
"failure_reason": "example",
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"issue_date": "example",
"readiness": {
"blocking_reason": "example",
"ready": true
},
"send_at": "example",
"sent_at": "example",
"timezone": "example"
}

No active org.

Media typeapplication/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 typeapplication/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"
}

Not found or cross-org.

Media typeapplication/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"
}

Document is not a draft.

Media typeapplication/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 send_at (past, malformed) or unknown timezone.

Media typeapplication/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"
}

The delayed job could not be enqueued; nothing was scheduled.

Media typeapplication/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"
}