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
- Stream the clip with
PUT /socials/media/{projectId}/stream-upload. Save the returneddata.handle. - Create the post with
POST /socials/posts/{projectId}, passing the handle inuploadedHandles. Savedata.post.idin your cleanup job. - Track delivery until
statusispublished. Calculate the cleanup time frompublishedAt, notscheduledForor the time you submitted the post. IfpublishedAtis missing, investigate before deleting. - At least 24 hours after
publishedAt, delete the Sapt post. Save any permalink or post details your application needs before deletion.
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:
200:
Handle cleanup failures
Record the delete response and keep failed cleanup jobs visible. A404 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 MCPsave 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:
- 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’sid, not the media attachment ID. - 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.
- Delete the scheduled-post record with the social DELETE endpoint above. Delete its CMS item too if your pipeline created one:
- Delete the library asset:
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.