Executing workflows
For details on how to build workflows, visit the building workflows page.
Executing a workflow consists of 2 key steps:
- Starting a workflow and receiving its
workflowId, currentworkflowStatus, and human-readablemessage. - Periodically checking for the result using the
workflowId.
Starting workflows
To start executing a workflow, make a POST request to the following endpoint:
POST https://api.linkedapi.io/workflowsIn the request body, include a JSON that describes your workflow, for example:
Start the workflow with the request it should run, for example:
{
"actionType": "st.checkConnectionStatus",
"personUrl": "https://www.linkedin.com/in/person1"
}Every SDK method has execute(), which starts the workflow and returns its workflowId; any workflow JSON goes through customWorkflow. See Predefined vs Custom Workflows.
Commands such as linkedin connection status start the workflow and wait for its result, and so does linkedin workflow run for any workflow JSON – see Custom Workflows. The CLI has no separate start step: while it waits it writes the workflow ID and status to stderr as progress (hidden by --quiet), and at the end it prints the completion as data. The response below is what the API returns to the start request.
Upon successful request, you will receive the following response:
Under the hood – execute() sends this request and returns the fields of its result directly: workflowId, workflowStatus, pendingReason and message (workflow_id, workflow_status, pending_reason and message in Python), without the success and result wrapper:
{
"success": true,
"result": {
"workflowId": "wf-64835e7c-a0gc-40ae-8338-108f02sSe643",
"workflowStatus": "pending",
"pendingReason": "queued",
"message": "This workflow is scheduled and will start after 2 other workflows already scheduled ahead of it."
}
}workflowId– unique workflow identifier for checking the result.workflowStatus– current workflow status. Possible values at start arependingandrunning.pendingReason– why the workflow has not started yet.queuedmeans it is waiting its turn behind other work on the same account;outsideWorkingHoursmeans it is parked until the account working hours reopen. It isnullonce the workflow is no longer pending.message– human-readable execution message, such as queue position or estimated duration. This value can change while polling.
In case of an unsuccessful request, you will receive the following response:
Errors – an unsuccessful start throws LinkedApiError with the type and message of this response:
Errors – the CLI prints an unsuccessful start to stderr as {"error": "<type>", "message": "…"} and exits with the matching exit code. The types are the ones below:
{
"success": false,
"error": {
"type": "linkedApiTokenRequired",
"message": "'linked-api-token' is missing in request headers."
}
}error– either a common error or one of the following specific errors:invalidWorkflow– workflow configuration is not valid due to violated action constraints or invalid action parameters, including a parameter the root action does not define:{validation_details}.subscriptionRequired– no purchased subscription seats are available for this LinkedIn account (message:No purchased subscription seats available for this LinkedIn account.). Add seats, renew the subscription for existing seats, or check for payment issues on the platform.plusPlanRequired– the workflow contains Sales Navigator actions (nv.*), which need a Plus seat and a Sales Navigator subscription on the LinkedIn account.linkedinAccountSignedOut– the LinkedIn account has been signed out in our cloud browser. Reconnect it on the platform.outsideWorkingHours– the account is outside its configured working hours and its off-hours policy is set to reject. Nothing is queued.
Checking for result
Prefer to be notified instead of polling? Register a webhook and Linked API will
POSTan event to your endpoint when the workflow completes.
After starting your workflow and receiving the workflowId, you need to periodically check the workflow result:
GET https://api.linkedapi.io/workflows/{workflowId}result() polls for you and returns { data, errors } once the workflow completes; status() checks once. How the SDK reports workflow and request errors is described in Handling Results and Errors.
Depending on the workflow execution status, you'll receive one of these results:
Under the hood – while the workflow is pending or running, status() returns its workflowStatus, pendingReason and message. Once it completes, status() and result() return the method's own { data, errors } mapped from the completion, not the response itself. A failed workflow throws LinkedApiError whose type is the failure.reason below. These are the API responses they read:
Output – while the workflow is pending or running, linkedin workflow status prints {"success": true, "data": {"workflowId", "status", "message"}}, without pendingReason. Once it completes, it prints the completion as data; --wait waits for that. A failed workflow prints nothing on stdout: stderr gets {"error": "<reason>", "message": "…"} and the command exits with that reason's exit code – 4 for linkedinAccountSignedOut and languageNotSupported, 1 for any other, such as cancelledByUser or workingHoursWaitExpired. See workflow status. These are the API responses it reads:
- Workflow is pending (queued for execution):
{
"success": true,
"result": {
"workflowStatus": "pending",
"pendingReason": "queued",
"message": "This workflow is scheduled and will start after 2 other workflows already scheduled ahead of it."
}
}Workflows are executed sequentially per LinkedIn account. If you submit multiple workflows, the first one starts executing immediately while the others are queued. The pending status means the workflow is waiting in the queue and will start running once the previous workflows complete.
A workflow can also be pending because the account is outside its working hours. In that case pendingReason is outsideWorkingHours and the workflow will not move until the window reopens, which can be the next working day:
{
"success": true,
"result": {
"workflowStatus": "pending",
"pendingReason": "outsideWorkingHours",
"message": "This workflow is scheduled and will start when the account working hours open at Mon, Aug 10, 09:00 (Europe/Berlin)."
}
}Back off your polling in that case rather than retrying every few seconds – the message names the time the window opens.
- Workflow is running:
{
"success": true,
"result": {
"workflowStatus": "running",
"pendingReason": null,
"message": "This workflow usually takes about 30-60 seconds."
}
}While a workflow is pending or running, the message field may update between polling requests. For example, a queued workflow can first return a queue-position message and later return an estimated-duration message after it starts running.
- Workflow completed successfully:
{
"success": true,
"result": {
"workflowStatus": "completed",
"completion": {
"actionType": "st.checkConnectionStatus",
"success": true,
"data": {
"connectionStatus": "pending"
}
}
}
}completion– results of all actions included in this workflow.
- Workflow completed with action error:
{
"success": true,
"result": {
"workflowStatus": "completed",
"completion": {
"actionType": "st.checkConnectionStatus",
"success": false,
"error": {
"type": "limitExceeded",
"message": "The configured limit for this action category has been exceeded."
}
}
}
}- Workflow failed:
{
"success": true,
"result": {
"workflowStatus": "failed",
"failure": {
"reason": "linkedinAccountSignedOut",
"message": "This LinkedIn account has been signed out in our cloud browser."
}
}
}failure– object describing the workflow failure reason:linkedinAccountSignedOut– your LinkedIn account has been signed out in our cloud browser. This occasionally happens as LinkedIn may sign out accounts after an extended period. You'll need to visit our platform and reconnect your account.languageNotSupported– your LinkedIn account uses a language Linked API does not support yet. Supported languages are English, German, Spanish, French and Portuguese. If you need another one, please contact our support – we prioritize new languages based on user requests.
In case of an unsuccessful request, you'll receive one of the common errors.
Cancelling workflows
Some workflows in Linked API can take a long time to complete. If you decide you no longer need a workflow to finish, you have the option to cancel it.
You can cancel a running or pending workflow directly on our platform. Simply click the three dots menu next to the workflow and select "Cancel".
Alternatively, you can cancel a workflow from your code:
DELETE https://api.linkedapi.io/workflows/{workflowId}The CLI has no cancel command: send the request with curl, as above, or cancel the workflow on the platform.
Upon successful cancellation, you will receive the following response:
Under the hood – cancel() returns true (True in Python) when this response reports the workflow cancelled; an unsuccessful request throws LinkedApiError:
{
"success": true,
"result": {
"cancelled": true
}
}In case of an unsuccessful request, you'll receive one of the common errors.
Important notes:
- Partial execution. The workflow is cancelled at its current execution point. Any actions that have already been completed cannot be undone. For example, if the workflow has already sent messages or connection requests from your LinkedIn account, these actions will remain executed.
- No intermediate data. Once a workflow is cancelled, no data is preserved or returned. You will not receive any intermediate results or partial data that may have been collected before cancellation.