Trash and restore
A delete puts an object in the Trash for 30 days. Restore it with the API or in the dashboard. After 30 days AffFast deletes it fully.
A delete never removes data at once. DELETE puts the object in the Trash. For 30 days, an owner or an admin can bring it back. After 30 days, a daily job deletes it fully.
Which objects have a Trash
Connections, links, sites, tags, notes, destinations, notification channels, webhook endpoints, log drains and postback sources. A workspace delete has the same 30 days. The owner can cancel it in the settings during this time.
An API key is different. A revoke is final. A revoked key never works again, and it has no Trash.
What a delete does
While an object is in the Trash, it acts as if it is deleted:
GET /v1/<objects>/{id}returns 404, and the lists do not show it.- A link stops to redirect. A connection stops to sync. A destination, a notification channel, a webhook endpoint and a log drain stop to send.
- The objects under it go to the Trash with it: the programs, the conversions, the deals, the payouts, the imports and the links of a connection. The stats do not count the conversions of a connection in the Trash.
- The short code of a link and the name of a site or a tag are free. A new object can use them.
The response of DELETE is the same as before.
Find the objects in the Trash
Add deleted=true to a list. The list then has only the deleted objects, with deleted_at and purge_at. purge_at is the time of the full delete: 30 days after deleted_at.
curl "https://api.afffast.com/v1/links?deleted=true" \
-H "Authorization: Bearer $AFFFAST_API_KEY"GET /v1/<objects>/{id}?deleted=true returns one deleted object. A dashboard user needs the role owner or admin to read the Trash.
An object that went to the Trash with another object is not in the list. Restore the object that holds it.
Restore an object
Send POST /v1/<objects>/{id}/restore. The object comes back with the objects that went to the Trash with it. The side effects start again: a link redirects, a connection syncs and a destination sends.
| Object | Endpoint |
|---|---|
| Link | POST /v1/links/{id}/restore |
| Connection | POST /v1/connections/{id}/restore |
| Site | POST /v1/sites/{id}/restore |
| Tag | POST /v1/tags/{id}/restore |
| Note | POST /v1/notes/{id}/restore |
| Destination | POST /v1/destinations/{id}/restore |
| Notification channel | POST /v1/notification_channels/{id}/restore |
| Webhook endpoint | POST /v1/webhook_endpoints/{id}/restore |
| Log drain | POST /v1/log_drains/{id}/restore |
| Postback source | POST /v1/postback_sources/{id}/restore |
A key needs the write scope of the object. A dashboard user needs the role owner or admin. A member can delete a link but cannot restore it.
A restore can fail with 409:
restore_conflict: a new object uses the short code or the name now. Change or delete the other object. Then restore again.parent_in_trash: the object belongs to an object that is in the Trash. Restore that object first.
An object that went to the Trash on its own stays there when you restore the object that holds it.
The full delete
A daily job deletes each object 30 days after its delete. It deletes the objects under it too, in the database, in the stats store and in the redirector. The audit log keeps its entries. A delete and a restore each make an entry with the actor.
Audit log
See who changed what and when. Read the history of a conversion, a program, a deal, a payout or a connection, and the audit log of your workspace, with the API.
Stats and forecast
Read revenue, conversions, clicks, EPC, AOV and CR with the API. Compare periods, get the top items of a grouping, and get a revenue forecast.