Skip to content
LogoLogo

How to call an external API from a workflow

This guide shows you how to make a workflow send a request to a system outside Picked. It also shows you how to read the answer in a later node.

A workflow can only call an origin that you register first. An origin is the scheme, the host and the optional port of an address, such as https://api.vendor.test. When you register one, every path on it becomes available to the workflow.

1. Register the external API

  1. Open Integrations.
  2. Choose Configure external APIs.
  3. Choose New external API.
  4. Enter a Display name. This name is for you. Picked does not send it with the request.
  5. Enter the Origin, such as https://api.vendor.test. Do not enter a path, a query or a fragment.
  6. If the API needs an authorization header, set Credential to Authorization header.
  7. Enter the header name and its value.
  8. Choose Register external API.

For an API whose access tokens expire, refer to How to register an API that uses OAuth2.

The header value is write-only. After you save it, Picked shows only the header name and a mask. To replace the value, choose Rotate authorization header.

2. Add an External API node

  1. Open the workflow.
  2. Choose Add node.
  3. Choose Add tool.
  4. Choose External API.
  5. Set method to the request method, such as GET or POST.
  6. Set url to the full address, such as https://api.vendor.test/v1/orders. Picked lists the origins you registered below the field.
  7. For a POST or a PUT, set body to the JSON to send.

3. Read the answer

A later node reads what the call recorded:

  • {{ nodes.<node-id>.status }} — the HTTP status.
  • {{ nodes.<node-id>.ok }} — true for a status from 200 to 299.
  • {{ nodes.<node-id>.body }} — the parsed JSON answer.

4. Continue after an error status

By default, a status outside 200 to 299 fails the node and stops the run. The run page shows the node that failed. Refer to the workflow runs reference. To test the status in the workflow instead:

  1. Set failOnErrorStatus to off.
  2. Add a condition node after the External API node.
  3. Test {{ nodes.<node-id>.status }} in the condition.

5. Continue after a failed call

A timeout or a connection failure also fails the node. To continue the run after a failed call:

  1. Connect the node's error exit to a condition node.
  2. Test {{ nodes.<node-id>.error.retryable }} in the condition.
  3. Connect the condition's false exit to the nodes that record the failure.

To send the request again, refer to How to retry a failed call with a loop.

The run follows the error exit only when the call fails. These failures stop the run at the node:

  • A required argument has no value.
  • An argument has a value that the tool does not accept. For example, the value has the wrong type, method is not one of the six methods, or timeoutMs is not from 1000 to 30000.
  • A template cannot be rendered.
  • The workflow does not have a scope that the tool needs.
  • An error occurs in Picked.

Refer to the External APIs reference for each reason.

API and MCP

You can also do this task with the Management API, the MCP server, or code that you send to picked_run.

TaskGraphQLMCP toolRun
Register the external APIexternalApiCreateNoneNone
Replace the header valueexternalApiAuthHeaderSetNoneNone
Add an External API nodeworkflowGraphUpdateupdate_workflow_graphtools.update_workflow_graph({ workflow_id, create_nodes, create_edges })
Find the node that failedworkflowRunget_workflow_run, list_workflow_run_taskstools.get_workflow_run({ run_id }), tools.list_workflow_run_tasks({ run_id })
Add a condition nodeworkflowGraphUpdateupdate_workflow_graphtools.update_workflow_graph({ workflow_id, create_nodes, create_edges })

The external API mutations refuse an API key. Use the access token of a user.