Skip to Content
Docs

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.

ObjectEndpoint
LinkPOST /v1/links/{id}/restore
ConnectionPOST /v1/connections/{id}/restore
SitePOST /v1/sites/{id}/restore
TagPOST /v1/tags/{id}/restore
NotePOST /v1/notes/{id}/restore
DestinationPOST /v1/destinations/{id}/restore
Notification channelPOST /v1/notification_channels/{id}/restore
Webhook endpointPOST /v1/webhook_endpoints/{id}/restore
Log drainPOST /v1/log_drains/{id}/restore
Postback sourcePOST /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.

On this page