Skip to main content

Endpoint

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

Overview

Retry one or more failed posts by resetting their status to scheduled and setting their post time to now. This allows you to re-attempt posting content that previously failed.
Important Restrictions:
  • You can only retry posts with status failed
  • Posts with other statuses (scheduled, pending, complete, retrying) cannot be retried using this endpoint
  • The retry will reset the post time to the current time and change the status to scheduled

Request Body

postIds
string[]
required
Array of post IDs to retryAll posts must belong to your organization and must have status failed

Response

data
object
Retry result information

Error Cases

  • 400 Bad Request: Attempting to retry posts that are not in failed status
  • 404 Not Found: Some posts don’t exist or don’t belong to your organization
  • 400 Bad Request: No post IDs provided
curl -X POST https://api.ugc.inc/post/retry \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "postIds": ["post_abc123", "post_def456"]
  }'
import requests

response = requests.post(
    'https://api.ugc.inc/post/retry',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'postIds': ['post_abc123', 'post_def456']
    }
)

data = response.json()

if data['ok']:
    print(f"Retried {data['data']['retried']} posts")
    print("Posts will be reattempted shortly")
else:
    print(f"Error: {data['message']}")
const response = await fetch('https://api.ugc.inc/post/retry', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    postIds: ['post_abc123', 'post_def456']
  })
});

const data = await response.json();

if (data.ok) {
  console.log(`Retried ${data.data.retried} posts`);
  console.log('Posts will be reattempted shortly');
} else {
  console.error(`Error: ${data.message}`);
}
import { UGCClient } from 'ugcinc';

const client = new UGCClient({
  apiKey: 'YOUR_API_KEY'
});

// Retry multiple failed posts
const response = await client.posts.retryPosts({
  postIds: ['post_abc123', 'post_def456']
});

if (response.ok) {
  console.log(`Successfully retried ${response.data.retried} posts`);
  console.log('Retried IDs:', response.data.ids);
  console.log('Posts will be reattempted shortly');
} else {
  console.error(`Error: ${response.message}`);
  // Common errors:
  // - "Cannot retry X post(s) that are not in failed status"
  // - "Some posts not found or don't belong to your organization"
}
{
  "ok": true,
  "code": 200,
  "message": "Successfully retried 2 post(s)",
  "data": {
    "retried": 2,
    "ids": [
      "post_abc123",
      "post_def456"
    ]
  }
}
{
  "ok": false,
  "code": 400,
  "message": "Cannot retry 2 post(s) that are not in failed status"
}
{
  "ok": false,
  "code": 404,
  "message": "Some posts not found or don't belong to your organization"
}
{
  "ok": false,
  "code": 400,
  "message": "No post IDs provided"
}

What Happens When You Retry

When you retry a failed post, the system:
  1. Updates the status from failed to scheduled
  2. Sets the post time to the current time (now)
  3. Resets the retry count to 0
  4. Queues the post for immediate processing
The post will be picked up by the posting system and attempted again shortly.

Best Practices

Check post status before retrying:Always verify that posts have failed before attempting to retry them. Use the Get Posts endpoint to check post statuses first.
1

Fetch posts

Use the Get Posts endpoint to retrieve posts and check their status
2

Filter failed posts

Filter out posts with status failed from your post list
3

Retry posts

Call the retry endpoint with the filtered post IDs
4

Monitor status

Use the Get Post Status endpoint to track the retry attempt

Example: Automatic Retry Workflow

// Get all posts
const postsResponse = await client.posts.getPosts();

if (postsResponse.ok) {
  // Filter posts that failed
  const failedPosts = postsResponse.data.filter(
    post => post.status === 'failed'
  );
  
  if (failedPosts.length > 0) {
    console.log(`Found ${failedPosts.length} failed posts`);
    
    const retryResponse = await client.posts.retryPosts({
      postIds: failedPosts.map(p => p.id)
    });
    
    if (retryResponse.ok) {
      console.log(`Retried ${retryResponse.data.retried} posts`);
      
      // Wait a bit and check status
      await new Promise(resolve => setTimeout(resolve, 5000));
      
      for (const postId of retryResponse.data.ids) {
        const statusResponse = await client.posts.getStatus({ postId });
        
        if (statusResponse.ok) {
          console.log(`Post ${postId} status: ${statusResponse.data.status}`);
        }
      }
    }
  }
}

Common Retry Reasons

Posts typically fail for reasons such as:
  • Temporary network issues - Retry usually succeeds
  • Account authentication expired - May need account re-authorization
  • Platform rate limits - Retry after waiting period
  • Content violations - Review and modify content before retrying
  • Invalid media URLs - Fix media URLs before retrying
If a post continues to fail after multiple retries, check the post details and error logs to identify the underlying issue. Some failures may require manual intervention or content modifications.