Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Execute a tool

POST/api/v1/execute_tool

Runs one tool as a user, with that user's credentials for the connection. Identify the account with connector and identifier, or with connected_account_id, and pass the tool's inputs in params; each connector page lists its tools and their inputs. When the connected account is EXPIRED, the call returns 401 with TOOL_ERROR; when it's otherwise not ACTIVE, 400 with INVALID_ARGUMENT. Either way, send the user an authorization link. Errors and rate limits explains each tool error code.

Authorization

Authorization: Bearer $TOKEN, an access token from the client credentials grant. See Authentication.

Body

tool_namestringrequired
Name of the tool to execute
agent_run_idstring
Customer-supplied identifier grouping multiple tool calls into a single agent run. Useful for correlating logs across an agentic workflow.
connected_account_idstring
The unique ID of the connected account. Use this to directly identify the connected account instead of using identifier + connector combination.
connectorstring
The connection name, as shown in AgentKit > Connections.
identifierstring
Your app's ID for the user, the same value you used when the user connected. Use a stable internal ID, not an email address.
organization_idstring
The organization ID to scope the connected account lookup. Use this to narrow down the search when the same identifier exists across multiple organizations.
paramsobject
JSON object containing the parameters required for tool execution. The structure depends on the specific tool being executed.
user_idstring
The user ID to scope the connected account lookup. Use this to narrow down the search when the same identifier exists across multiple users.

Response 200

dataobject
The tool's output: the app's response, as JSON.
execution_idstring
Unique identifier for the tool execution

Errors

Every error has the same body: code, message and details. See Errors and rate limits.

400Invalid request - error code INVALID_ARGUMENT when the tool name is missing, the input doesn't match the tool's schema, the connected account belongs to a different app than the tool, or the account isn't ACTIVE. Error code TOOL_ERROR when the app rejected the call; tool_error_info.tool_error_code is INVALID_ARGUMENT, EXECUTION_ERROR, INTERNAL_ERROR or, for a tool from an app's MCP server, TOOL_ERROR, and tool_error_message has the app's message.
401Error code UNAUTHENTICATED when your access token is missing, invalid or expired; get a new token and retry. Error code TOOL_ERROR with tool_error_code REAUTHENTICATION_NEEDED or UNAUTHENTICATED when the user's access to the app was revoked or expired; send the user a new authorization link.
403Error code TOOL_ERROR with tool_error_code FORBIDDEN or PERMISSION_DENIED - the app refused the call. The account's credentials are valid but lack the scope this tool needs. The connected account stays ACTIVE; grant the missing scope on the connection, have the user authorize again, then retry.
404Not found - the tool or the connected account doesn't exist. Error code TOOL_ERROR with tool_error_code RESOURCE_NOT_FOUND when the app couldn't find what the call refers to, such as an event ID.
429Error code TOOL_ERROR with tool_error_code RATE_LIMITED - the app rate-limited the call. Back off and retry.
500Error code TOOL_ERROR with tool_error_code INTERNAL_ERROR when Scalekit couldn't run the tool, for example because the connection's auth type isn't supported for this tool. For a tool from an app's MCP server, tool_error_code TOOL_ERROR when that server failed, rate-limited the call or couldn't be reached; its status is in tool_error_message. A retry can run the tool twice, so retry only tools that are safe to repeat, and quote execution_id to support.

Used in

Every connector page shows this call with that connector's tools and their inputs.