Skip to main content

Endpoint

POST https://api.ugc.inc/post/delete

Overview

Delete one or more posts from your organization. This endpoint handles both scheduled posts and published posts:
  • Unpublished posts (scheduled, pending, failed, retrying) are deleted immediately from the database
  • Published posts (complete) trigger a deletion flow that removes the post from the social media platform (TikTok/Instagram) and then marks it as deleted
Published Post Deletion:When deleting a complete post, the API will:
  1. Trigger a GeeLark automation to delete the post from the social media platform
  2. Set the post status to deleting while the deletion is in progress
  3. Automatically update to deleted once the platform deletion completes
You can check the status using the Get Post Status endpoint.

Request Body

postIds
string[]
required
Array of post IDs to deleteAll posts must belong to your organization. Posts can be in any status.

Response

data
object
Deletion result information

Error Cases

  • 404 Not Found: Some posts don’t exist or don’t belong to your organization
  • 400 Bad Request: No post IDs provided
  • Partial errors: Some posts may fail to delete while others succeed (returned in errors array)
curl -X POST https://api.ugc.inc/post/delete \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "postIds": ["post_abc123", "post_def456"]
  }'
{
  "ok": true,
  "code": 200,
  "message": "Successfully processed deletion request",
  "data": {
    "deleted": 2,
    "deleting": 0,
    "deletedIds": [
      "post_abc123",
      "post_def456"
    ],
    "deletingIds": []
  }
}

Best Practices

Deleting published posts:When you delete a post that has already been published (complete status), the API triggers an automation to remove it from the social media platform. The post status changes to deleting and then to deleted once the platform deletion completes. Use the Get Post Status endpoint to monitor the deletion progress.
1

Delete posts

Call the delete endpoint with the post IDs you want to remove
2

Check response

The response tells you which posts were deleted immediately vs. queued for platform deletion
3

Monitor status (for published posts)

For posts being deleted from the platform, monitor their status until it changes to deleted

Example: Bulk Delete with Status Monitoring

// Delete multiple posts (mix of published and unpublished)
const deleteResponse = await client.posts.deletePosts({
  postIds: ['post_abc123', 'post_xyz789', 'post_uvw012']
});

if (deleteResponse.ok) {
  // Handle immediately deleted posts
  if (deleteResponse.data.deleted > 0) {
    console.log(`✓ Deleted ${deleteResponse.data.deleted} unpublished posts`);
  }
  
  // Monitor posts being deleted from platform
  if (deleteResponse.data.deleting > 0) {
    console.log(`⏳ Deleting ${deleteResponse.data.deleting} published posts from platform...`);
    
    // Poll status until deletion completes
    for (const postId of deleteResponse.data.deletingIds) {
      const checkStatus = async () => {
        const statusResponse = await client.posts.getStatus({ postId });
        
        if (statusResponse.ok) {
          if (statusResponse.data.status === 'deleted') {
            console.log(`✓ Post ${postId} deleted from platform`);
            return true;
          } else if (statusResponse.data.status === 'failed') {
            console.error(`✗ Post ${postId} deletion failed`);
            return true;
          }
        }
        return false;
      };
      
      // Check every 10 seconds until complete
      const interval = setInterval(async () => {
        const done = await checkStatus();
        if (done) clearInterval(interval);
      }, 10000);
    }
  }
  
  // Handle any errors
  if (deleteResponse.data.errors && deleteResponse.data.errors.length > 0) {
    console.error('Some posts failed to delete:', deleteResponse.data.errors);
  }
}