Skip to main content
For automated clip publishing with short retention, use the social streaming upload, attach its handle when creating the post, and delete the Sapt post after confirmed publication and your retention period. This flow stores files with the post so post deletion can remove them.
Media imported into the asset library has a separate lifecycle. Deleting a post, its media attachment, or a CMS content item does not delete the referenced library file. Delete it separately with DELETE /projects/{projectId}/assets/{assetId} after every consumer has finished using it. This call deletes the file even if other records still reference it.

What each delete operation removes

These IDs are different: a CMS content ID, Sapt scheduled-post ID, media attachment ID, and library asset ID identify different resources. Use the data.post.id returned by the social create-post endpoint for post cleanup.

Delete a clip 24 hours after publication

  1. Stream the clip with PUT /socials/media/{projectId}/stream-upload. Save the returned data.handle.
  2. Create the post with POST /socials/posts/{projectId}, passing the handle in uploadedHandles. Save data.post.id in your cleanup job.
  3. Track delivery until status is published. Calculate the cleanup time from publishedAt, not scheduledFor or the time you submitted the post. If publishedAt is missing, investigate before deleting.
  4. At least 24 hours after publishedAt, delete the Sapt post. Save any permalink or post details your application needs before deletion.
Check publication:
The response’s data contains status, publishedAt, permalink, and errorMessage. A queued or processing post is not ready for cleanup. Keep failed posts if you intend to retry publication. After the retention period, delete:
A successful deletion returns HTTP 200:
This leaves the published social-platform post in place. Sapt does not automatically apply a 24-hour retention policy; your application schedules this cleanup. If you also created a separate CMS content item, removing the scheduled post does not delete that CMS item.

Handle cleanup failures

Record the delete response and keep failed cleanup jobs visible. A 404 says the post record is missing; it does not verify that its files were removed. If a delete fails or times out and a later attempt returns 404, treat storage cleanup as unverified and contact support with the project ID, post ID, and original file URLs. Do not silently mark that sequence as successful cleanup.

Clips saved by URL into the library

The Sapt MCP save tool accepts media URLs and copies them into the asset library. The post then references those library assets. This save interface has no reference-only option, and the deletion calls above leave those files intact. For future clips that should follow the post’s lifetime, use the streaming flow above. If your source is a URL, your application can download the clip and upload its bytes through the streaming endpoint. For URL-imported clips, your cleanup job can keep using the library:
  1. Store each clip’s library asset ID before deleting its content or post records. If you only have the stored URL, list library assets and match the returned url. Use the asset’s id, not the media attachment ID.
  2. Wait until all destinations that use the clip have published and the retention period has passed. Keep files needed by pending posts, retries, or other content.
  3. Delete the scheduled-post record with the social DELETE endpoint above. Delete its CMS item too if your pipeline created one:
  1. Delete the library asset:
Asset deletion requires assets:manage and returns HTTP 200 with {"deletedCount":1}, or {"deletedCount":0} when already absent from this project. Retry a failed asset deletion using the same ID. CMS deletion returns 404 for an already-missing item; that does not replace the separate asset-delete call. These calls do not retract the published platform post. There is no dedicated library-delete workflow action; API clients can call the REST endpoint directly. See CMS and asset APIs for permissions, pagination, and response details.