Aller au contenu

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

GET
/v1/invoices/{id}/schedule-send
curl --request GET \
--url https://api.asap.cool/v1/invoices/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/schedule-send \
--header 'Authorization: Bearer <token>'

Le verdict de préparation est calculé ici, et non dans GET /v1/invoices/{id} : un dry-run est une transaction avec allocation de compteur puis annulation, trop coûteux pour chaque lecture de document. L’UI l’appelle quand elle affiche le bandeau, et au retour de chaque modification du brouillon.

id
required
string format: uuid

Document identifier.

The pending scheduled send, with its 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:read 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"
}

No pending scheduled send, 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"
}