Skip to content
LogoLogo

External APIs

An external API is an origin that this project's workflows are allowed to call with the External API node. For the steps to register an API that uses OAuth2, refer to How to register an API that uses OAuth2.

Registration

FieldRule
Display nameRequired. 1 to 120 characters. For you only; it does not go out with the request.
OriginRequired. The scheme, the host and the optional port, with no path, query, fragment or sign-in details. http or https only, on port 80 or 443. Must not point at a private, loopback or link-local address. One live registration per origin per project.
CredentialNone, an authorization header, or an OAuth2 credential. Each secret is encrypted and is never returned.

An authorization header is a header name and a value. The dashboard shows the header name and a mask. An OAuth2 credential gets an access token for each call. Refer to OAuth2 credential. When you set one kind of credential, Picked removes the other kind.

On a registration with an OAuth2 credential, the dashboard does not show the authorization header. Remove the OAuth2 credential before you set a header.

To change an origin, delete the registration and register the new origin. The origin is the registration's identity.

A preset sets the display name, the origin and an OAuth2 credential for a provider. Refer to OAuth2 credential.

OAuth2 credential

An OAuth2 credential gets an access token from the provider's token URL. Picked sends the header scheme, a space and the access token in the header with each request.

SettingDefaultRule
GrantRefresh tokenRefresh token or Client credentials.
Token URL—Required. An https URL with no fragment. The query must not contain grant_type, client_id, client_secret, refresh_token or code. Picked checks the URL as it checks an origin. Picked does not register its origin.
Client ID—Required. 1 to 512 characters.
Client secret—Required. Encrypted, and never returned. When you edit the credential, an empty field keeps the stored client secret. If you change the token URL, the client ID or the client authentication, enter the client secret again.
Refresh token—Required for the refresh token grant. The client credentials grant does not use one. Encrypted, and never returned. When you edit the credential, an empty field keeps the stored refresh token. If you change the token URL, the client ID or the client authentication, enter the refresh token again.
Client authenticationForm bodyThe client ID and the client secret go in the form body, or in an Authorization: Basic header.
Token parametersNoneUp to 20 more form parameters, such as scope. grant_type, client_id, client_secret, refresh_token and code are not permitted.
Header nameAuthorizationThe header that holds the access token.
Header schemeBearerThe word before the access token, such as Zoho-oauthtoken. No spaces.
401 ruleNoneA path in the JSON body of a 401 answer, and 1 to 20 values at that path that show an expired token. Put a dot between the parts of the path, for example code or data.0.code. A part that is a number identifies an item in a list. With no rule, each 401 shows an expired token.

The Zoho CRM preset sets the display name Zoho CRM and the origin of the API for the region, such as https://www.zohoapis.com.au. It also sets an OAuth2 credential. The credential has the token URL for the region, Form body, Zoho-oauthtoken, and a 401 rule of code with the value INVALID_TOKEN. On the page of a registered external API, the preset sets only the OAuth2 credential.

Access tokens

  • Picked sends the token request as a POST with a form body, so no secret is in a URL.
  • Picked uses an access token until 60 seconds before it expires.
  • Refresh credentials on the page of the external API gets a new access token immediately. The page then shows the time of the last refresh, or the reason for the failure.
  • Picked reads the lifetime from expires_in_sec, or else from expires_in. Picked keeps a token with no lifetime for one hour.
  • Picked counts an answer as a success when its JSON body has an access_token, for all statuses.
  • A refresh_token in the answer replaces the stored refresh token.
  • One token request at a time runs for each credential. Other calls use the token that it gets.
  • After a token request fails with credential_refresh_failed, Picked sends no token request for 60 seconds. Calls in that time fail with credential_refresh_failed.
  • Picked uses a stored access token for all values of timeoutMs.
  • The token request, and the wait for a token request of another call, use time from the node's timeoutMs. Each stops while 5 seconds remain. Picked starts a token request only when 6 seconds or more remain. A token request stops after 10 seconds.
  • When the node's time stops a token request, other calls can send a token request immediately.

A 401 answer

Picked gets a new token and sends the request again when these are all true:

  • The API answered 401.
  • The token is older than 60 seconds.
  • The credential has no 401 rule, or the rule applies to the body of the answer.

The second request has the same Idempotency-Key, if the node sends one. Its answer is the result of the node.

If Picked cannot get a new token, the node fails with credential_rejected or credential_refresh_failed. Then nodes.<node-id>.status, ok and body keep the 401 answer.

Node arguments

ArgumentDefaultRule
method—Required. GET, HEAD, POST, PUT, PATCH or DELETE.
url—Required. The full address. Its origin must be registered to this project.
headersnoneA JSON object of headers to send. Picked refuses a credential here when you save.
bodynoneThe JSON body. Used by POST, PUT and PATCH.
timeoutMs100001000 to 30000. The time that the whole call has, with every retry.
retryon for GET, HEAD, PUT and DELETE; off for POST and PATCHWhether to send the request again after a failed connection, an unknown host, or a status of 408, 429 or 500 to 599.
failOnErrorStatusonWhether a status outside 200 to 299 fails the node.
recordBodyonWhether to record the answer's body.
idempotencyKeyoffWhether to send the Idempotency-Key header. Set it to on when the API accepts it.

Output

NameValue
statusThe HTTP status.
okTrue for a status from 200 to 299.
bodyThe parsed JSON answer, or null when it is not JSON or was not recorded.
bodyTruncatedTrue when the answer was too large to record in full.
durationMsThe time the call took.

Limits

  • The request body is limited to 1 MiB.
  • The recorded answer is limited to 1 MiB. A larger answer sets bodyTruncated.
  • Picked records the status that asks the caller to redirect. Picked does not go to the new address.
  • Picked sends a request three times at most. Picked waits longer before each retry, and waits for the time that a Retry-After header gives.
  • A timeout uses all of timeoutMs, so Picked does not send the request again after a timeout.

Errors

When the node fails, the run stops at the node. If the call fails and an edge leaves the node's error exit, the run continues on that edge. These failures stop the run at the node, with or without that edge:

  • 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.

A later node reads why the call failed from nodes.<node-id>.error:

FieldValue
codehttp_failed.
messageThe node, the tool and the message from the table below.
reasonThe reason from the table below.
retryableTrue when the same request can pass at a later time.
statusThe HTTP status, for the reason error_status. Also for a credential reason after a 401 answer.

After an error status, nodes.<node-id>.status, ok and body also keep the answer.

ReasonMessage ends withRetryableWhen
error_statusthe API answered <status>For 408, 429 and 500 to 599The status was outside 200 to 299, and failOnErrorStatus is on.
timeoutno answer within the node's timeoutYesNothing answered within timeoutMs.
transportthe request could not be deliveredYesThe connection failed.
unresolvablethe destination hostname did not resolveYesNo address was found for the host.
refusedthe destination was refusedNoThe URL points at a private, loopback or link-local address.
refusedno external API is registered for <origin>NoThe URL's origin has no live registration in this project.
request_too_largethe request body is over 1 MiBNoThe body is larger than the limit.
invalid_requestthe request is not one the tool can sendNoThe arguments do not make a valid request.
invalid_requestthe URL is not one the tool can sendNoThe tool cannot send to the URL.
invalid_headersThe header that Picked refusedNoA header name or value is not valid for HTTP.
credential_unavailablethe credential for this external API is unavailableNoPicked cannot read a secret of the registration's credential.
credential_rejectedthe token endpoint refused this external API's credentialNoThe token endpoint answered invalid_client, invalid_grant, invalid_code, invalid_client_secret or unauthorized_client.
credential_refresh_failedno access token could be fetched for this external APIYesThe token endpoint did not answer in time, or Picked cannot reach it. Or the token endpoint answered with no token, or a token request failed less than 60 seconds before. Or the node's time ran out.

Picked also refuses a workflow when you save it if a node holds a credential in headers. Register the external API, and put the credential on the registration.

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 an external APIexternalApiCreateNoneNone
Set or replace the authorization headerexternalApiAuthHeaderSetNoneNone
Get a new OAuth2 access tokenexternalApiOAuth2RefreshNoneNone
Delete a registrationexternalApiDeleteNoneNone
Set the arguments of an External API nodeworkflowGraphUpdateupdate_workflow_graphtools.update_workflow_graph({ workflow_id, update_nodes })

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

  • About apps — when to use an app in place of an external API.