Skip to content

Call a tool

POST/v1/tools/{tool}/callsNeeds an API key

Call a tool and return its output.

The call is served by the cheapest provider that supports your input, falling back to the next one if it fails. Set provider to use one provider only, and require to insist on optional outputs. You are charged when the call succeeds, as shown in cost.

Some providers take minutes. The request waits up to wait seconds (25 by default, 0 to 50) for the call to finish. A call still running then answers 202 with status: "pending" and a Location header: it goes on running, and you are charged only if it succeeds. Read it at GET /v1/calls/{call_id}?wait=50 until its status is succeeded or failed. A call is never cut short because your request ended.

A call that no provider could serve answers 502, or 504 when it ran out of time, or 429 with PROVIDER_RATE_LIMITED when every provider tried refused it for its rate limit: retry after the Retry-After header's seconds. All three carry a call_id: the call is recorded, was not charged, and can be read back from GET /v1/calls/{call_id}. One exception: a provider that fails a call and bills it ends the call there, with no fallback, and 502's detail says what you were charged: what that provider billed. The call's failure_reason is then billed_provider_failure. A request refused before any provider was contacted (unknown tool, invalid input, insufficient balance) records nothing.

A 503 with CALL_RESULT_DEFERRED means the call ran but Voxoria was too busy to return its result: it carries a call_id and a Location header. Read the call at GET /v1/calls/{call_id} rather than calling again, which would make, and charge, a new call.

To retry safely, send an Idempotency-Key header. If a call with that key already succeeded in the last 24 hours, you get that call back with the header Idempotent-Replayed: true: no provider is called and you are not charged again, so cost is what the first call cost. The key must come with the same tool and body each time; a different request answers 422 with IDEMPOTENCY_KEY_REUSED. While the first call is still running a retry waits for it as the first request did, and answers it, or 202 with it still running. A call that failed does not keep its key, so retrying it makes a new call. Without the header, every request is a new call.

To reuse a result you already paid for, set reuse_within in seconds. If your workspace has a succeeded call with the same tool, input, provider and require made within that window, the newest one is returned with reused: true: no provider is called, nothing is charged and no call is recorded, so id and cost are that earlier call's. A replay for an Idempotency-Key is checked first; a reused answer does not claim the key.

Set label to name the call, then find it with GET /v1/calls?label=... or change it with PATCH /v1/calls/{call_id}. A reused or replayed answer keeps its own label. Outputs are kept with no time limit.

Test keys cannot call tools yet and answer 403 with TEST_KEY_NOT_ALLOWED. Use a live key.

Path parameters

toolstringRequired

The tool's ID, such as google.serp.organic.

Headers

Idempotency-Keystring

A key of your choosing, 1 to 128 printable ASCII characters, that makes a retry safe. The same key with the same request within 24 hours returns the first call and is not charged again.

Request body

What to call a tool with.

inputobjectRequired

The tool's input, as its input schema describes.

providerstring

Serve the call from this provider only. Omit to use the cheapest that can.

1 or more characters.

Can be null.

requirearray of string

Outputs the serving provider must return, by name. Only providers that return each optional one are used; a required one is always returned, so naming it changes nothing.

Each item: 1 or more characters.

Can be null.

reuse_withininteger

Reuse a result instead of calling again: if your workspace has a succeeded call with the same tool, input, provider and require made within this many seconds (1 to 2592000, 30 days), the newest such call is returned with reused: true. No provider is called, nothing is charged and no call is recorded; id and cost are that earlier call's. Omit to always make a new call.

From 1 to 2592000.

Can be null.

labelstring

A name of your choosing for the call, 1 to 100 characters, to find it again by. Not unique. Ignored when the answer is a reused or replayed call.

1 to 100 characters.

Can be null.

waitinteger· default 25

Seconds to wait for the call to finish, 0 to 50. A call that finishes in time is answered with its result. One still running is answered with status: "pending": it goes on running, and reading the call again by its id returns its result. 0 answers at once.

From 0 to 50.

Response

The call, finished: succeeded, or an earlier call replayed or reused.

The body is a call: see the call response for every field, an example and the error bodies.

  • Idempotent-Replayed: true when the response is an earlier call returned for its Idempotency-Key. Absent otherwise.