Call app tool

POST /v1/organisations/{organisation_id}/spaces/{space_id}/apps/{app_id}/instances/{instance_id}/tools/{tool}/calls

Calls one of the app's tools on this running instance, as the caller, checked like a call from the agent: its page app's window.ivy.callTool(name, input) arrives here through the host. The call is recorded (app.tool_called), never its input or output; the session saves what the call changed in the working copy. A call has 40 s, on an instance that already runs; tools that take longer are for the agent.

Authentication

Send an API key, or an access token from your organisation’s identity provider, in the Authorization header. How API keys work

Scope the API key needs: conversations:write

Security schemes in the OpenAPI document: session_cookie (cookie __Host-ivy_session)bearer (bearer)api_key (bearer)

Parameters

  • organisation_id path string required
  • space_id path string required
  • app_id path string required
  • instance_id path string required
  • tool path string required

    The tool's name as the app declares it, without the app's prefix

Request body

application/json CallAppTool required

  • input object required

    The tool's input, checked against the schema the app declares for it.

Responses

  • 200 application/json AppToolCallResult

    What the app's MCP server answered; is_error when the tool reported an error

  • 401 application/json ErrorBody

    unauthenticated

  • 403 application/json ErrorBody

    Viewers can't use a write app; workspace_content_restricted, insufficient_scope

  • 404 application/json ErrorBody

    No such instance of this app (or the caller can't see its conversation); app_tool_unavailable: the app declares no such tool, or offers no tools here

  • 409 application/json ErrorBody

    app_not_running: the instance has stopped; app_runs_as_another: the instance runs as another person in the conversation; the caller stops it and, once it has stopped, starts the app again as themselves

  • 422 application/json ErrorBody

    invalid_tool_input: the input doesn't fit the tool's schema; invalid_body

  • 429 application/json ErrorBody

    rate_limited: the API key's requests per minute are used up; retry after Retry-After seconds

  • 500 application/json ErrorBody

    internal

  • 502 application/json ErrorBody

    app_tool_failed: the app's MCP server failed, or didn't answer within 40 s

  • 503 application/json ErrorBody

    sandbox_unavailable: the conversation's sandbox didn't answer; or unavailable: the database is briefly unavailable; retry after Retry-After seconds

Error codes

Errors come back as an ErrorBody whose code is one of these.

  • 401 unauthenticated
  • 403 workspace_content_restrictedinsufficient_scope
  • 404 app_tool_unavailable
  • 409 app_not_runningapp_runs_as_another
  • 422 invalid_tool_inputinvalid_body
  • 429 rate_limited
  • 500 internal
  • 502 app_tool_failed
  • 503 sandbox_unavailableunavailable

Examples

curl
curl -X POST "$IVY_API_URL/v1/organisations/$ORGANISATION_ID/spaces/$SPACE_ID/apps/$APP_ID/instances/$INSTANCE_ID/tools/$TOOL/calls" \
  -H "Authorization: Bearer $IVY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{}}'
JavaScript SDK
import { client, callAppTool } from "@spacivapp/ivy-sdk";

client.setConfig({
  baseUrl: process.env.IVY_API_URL,
  headers: { Authorization: `Bearer ${process.env.IVY_API_KEY}` },
});

const { data, error, response } = await callAppTool({
  path: { organisation_id: organisationId, space_id: spaceId, app_id: appId, instance_id: instanceId, tool },
  body: {
    input: {}
  },
});
Example request body
{
  "input": {}
}
Example response (200)
{
  "content": [
    {}
  ],
  "is_error": false
}