Manage deliveries
Change, remove or send a delivery again, and what happens when a delivery fails.
Change or remove a delivery
GET /v1/projects/{id}/deliveries lists a project's deliveries. PATCH /v1/projects/{id}/deliveries/{delivery_id} changes the fields of its type: frequency, recipients and direct_link for an email, connection_id and path for cloud storage, and enabled for both. New addresses in recipients get their confirmation email. DELETE /v1/projects/{id}/deliveries/{delivery_id} removes one; what was already sent stays where it is.
Deliver a run again
curl -X POST https://dataflow.piloterr.com/v1/projects/PROJECT_ID/deliveries/DELIVERY_ID/send \
-H "x-api-key: YOUR_API_KEY" -H "content-type: application/json" \
-d '{"run_id": "RUN_ID"}'{ "run_id": "RUN_ID" }Queues the delivery of a finished run: to retry after a failure, or to check the delivery. Without a body, the project's latest finished run (completed or failed) goes. A daily or weekly email sends that run's email at once.
The answer, 202, only says the delivery is queued. It is then skipped when the delivery is off, when the run's results have expired, or, for cloud storage, when the run did not complete.
Failures and retries
Each delivery of a run is sent on its own: a slow bucket never holds an email back. A failed attempt is retried for about 30 minutes (after 30 seconds, then 1, 2, 4, 8 and 16 minutes). A retry does not email again the recipients who already got the email.
When the last attempt fails:
- the delivery records
last_errorandlast_error_at, andfailure_countgoes up by one; the next successful delivery setsfailure_countback to 0 and clearslast_error; - the
delivery.failedevent goes to your alerts and webhooks, withdata.delivery_id,data.delivery(emailorcloud) anddata.error; - the run itself stays completed.
A daily or weekly summary is not retried: a failure is recorded on the delivery, and the next summary covers the following period.
last_sent_at is when the last daily or weekly summary was sent.
Errors
| Status | Code | Meaning |
|---|---|---|
422 | validation_failed | A field is missing or wrong: an invalid address, more than 20 recipients, a path without {format} or with an unknown variable, no such cloud connection (path connection_id), a field of the other delivery type, an endpoint that is not https or not reachable from the internet, an invalid bucket name, or only one of the two keys. |
404 | project_not_found, delivery_not_found, connection_not_found, address_not_found | No such project, delivery, connection or address for your workspace. |
404 | run_not_found | Delivering again: no such run in this project, or no finished run yet. |
409 | run_not_finished | Delivering again: the run has not finished yet. |
409 | deliveries_limit | The project already has 10 deliveries. |
409 | connections_limit | The workspace already has 20 connections. |
429 | rate_limited | More than 10 connection tests this minute, or 60 this hour, for the workspace (Retry-After). A failed test is not an error: it answers 200 with ok: false (see Test the permissions). |
429 | confirmation_quota | The confirmation emails a new or changed email delivery needs would pass the workspace's 50 a day or 100 addresses waiting: nothing was saved or sent. See Addresses outside the workspace. |
503 | encryption_unavailable | Emails and connections cannot be set up on this server right now. |