Why Retries Matter

Workflows can sometimes encounter interruptions due to paused, stopped, or shutdown statuses. Understanding why retries are important, when to retry, and how to do it effectively is essential for maintaining smooth operations and minimizing delays.

Account Rotation: A Smoother Process

Using account rotation for search and enrichment actions ensures retries are seamless and done on our end.

Here’s how it works:

  • When an account becomes invalid or reaches its daily limit, the system automatically switches to another available account.
  • If no valid accounts remain, the system uses the account with the limit reached and schedules the job to retry automatically once it’s ready.

To enable Account Rotation, include this parameter when launching a workflow via API:

{
  "account": [], // Provide the account ID(s) for rotation or leave it empty.
  "accounts_rotation_enabled": true
}

Refresh & Resume Paused Jobs

Workflows may pause due to integration issues, such as a broken cookie. Here are several ways to address the issue.

  1. Resume all paused jobs at once while updating the user’s cookies:

    Use the POST Add or Update an Integration Account endpoint and set resume_paused_jobs to true:

    POST https://api.captaindata.co/v3/integrations/:integration_uid/accounts
    

    Request payload example:

    {
      "account": {
        "uid": "Pass this UID to update an account only",
        "name": "Your account",
        "cookies": {
          "li_at": "YOUR_SESSION_COOKIE"
        },
        "user_uid": "67890-wxyz"
      },
      "resume_paused_jobs": true
    }
    
  2. To retry Specific Runs only: Update the user account cookies and use the POST Retry a Run endpoint:

    POST https://api.captaindata.co/v3/jobs/:job_uid/retry
    

    Example payload:

    {
      "job_name": "Get Yann Lecun Linkedin Profile",
      "steps": [
        {
          "accounts": ["xxxxxx-63da-47f8-9a3c-53f2581d0ccb"],
          "accounts_rotation_enabled": false,
          "parameters": {},
          "output_column": null,
          "step_uid": "xxxxxx-xxxxx-451f-ac94-2b41972ec6a7"
        }
      ],
      "inputs": [
        {
          "linkedin_profile_url": "https://www.linkedin.com/in/yann-lecun/"
        }
      ]
    }
    
  3. For Shared Accounts: Share this link with the account owner to refresh the cookie manually: https://app.captaindata.co/integrations/linkedin/accounts/{user_id}.

    This avoids waiting for Captain Data’s (or your own) Chrome extension to update it (updates occur every 2 hours).

    And then, use the POST Retry a Run endpoint.

    For more information, see the related article: Add & Managing Users.

Should I retry stopped Runs (Jobs) or not?

  1. Canceling Jobs:

    You realize you did a mistake or the job is stuck for too long, you can cancel it using the POST Cancel a Run endpoint. This allows you to quickly stop any ongoing processes that are no longer needed.

  2. Restarting Stopped Jobs:

    After addressing the issue, restart the job using the POST Retry a Run endpoint. Ensure all necessary updates, such as fixing inputs or updating account credentials, are completed before retrying.

Managing Shutdown Job

Polling for Shutdown Jobs: Stop polling as soon as a job enters the Shutdown status; there’s no need to continue.

If you believe the inputs should work or need assistance, please contact us with all relevant details.

  • Single input: You should receive a straightforward and clear error message for the shutdown status when running a single input. This is typically caused by an invalid cookie, so retrying is unnecessary.
  • By batch (multiple inputs): If the API return the error All inputs failed. Please correct them before retrying your job., it typically means the provided inputs are invalid. In this case, check Inputs - To gain more details regarding this error by inputs, use the Get a Run’s Inputs:
    curl --request GET \
      --url https://api.captaindata.co/v3/jobs/{job_uid}/inputs \
      --header 'Authorization: <api-key>' \
      --header 'x-project-id: <project-id>'
    

By understanding and using retries effectively, you can overcome interruptions and keep your workflows on track.

Common Errors & How-to Retry

Here’s a list of the most common errors you could come across; classified by API.