Connected apps
Run an app tool
Run one tool on your connected account and get what the app answered.
POST
/
v1
/
apps
/
{app}
/
tools
/
{tool}
/
run
Run an app tool
curl --request POST \
--url https://api.valendata.com/v1/apps/{app}/tools/{tool}/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {
"query": "is:unread",
"max_results": 2
}
}
'import requests
url = "https://api.valendata.com/v1/apps/{app}/tools/{tool}/run"
payload = { "inputs": {
"query": "is:unread",
"max_results": 2
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({inputs: {query: 'is:unread', max_results: 2}})
};
fetch('https://api.valendata.com/v1/apps/{app}/tools/{tool}/run', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.valendata.com/v1/apps/{app}/tools/{tool}/run",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputs' => [
'query' => 'is:unread',
'max_results' => 2
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.valendata.com/v1/apps/{app}/tools/{tool}/run"
payload := strings.NewReader("{\n \"inputs\": {\n \"query\": \"is:unread\",\n \"max_results\": 2\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.valendata.com/v1/apps/{app}/tools/{tool}/run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {\n \"query\": \"is:unread\",\n \"max_results\": 2\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.valendata.com/v1/apps/{app}/tools/{tool}/run")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"inputs\": {\n \"query\": \"is:unread\",\n \"max_results\": 2\n }\n}"
response = http.request(request)
puts response.read_body{
"app": "gmail",
"tool": "GMAIL_FETCH_EMAILS",
"kind": "read",
"data": {
"messages": [
{
"messageId": "19a2f0c4e1b7d3a5",
"sender": "Ada <ada@example.com>",
"subject": "Q4 plan",
"messageTimestamp": "2026-10-08T09:12:00Z",
"preview": {
"body": "Here is the plan for Q4…"
}
}
],
"nextPageToken": null
}
}{
"detail": "The request is malformed: the body is not JSON, the cursor or Idempotency-Key is not valid.",
"code": "invalid_json",
"type": "invalid_request_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "The API key is missing, malformed, revoked, or expired.",
"code": "unauthorized",
"type": "authentication_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "The key lacks a scope, is limited to other skills or workflows, or you may not do this.",
"code": "permission_denied",
"type": "permission_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "It does not exist, or it is not yours to see.",
"code": "not_found",
"type": "invalid_request_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "A conflict with the current state, or a request with this Idempotency-Key is still running.",
"code": "conflict",
"type": "conflict_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "Invalid request — name: Field required",
"code": "validation_error",
"type": "invalid_request_error",
"request_id": "3f9a1c2b7d4e",
"param": "name",
"errors": [
{
"type": "missing",
"loc": [
"body",
"name"
],
"msg": "Field required"
}
]
}{
"detail": "Too many requests for this key, or too many runs in progress. Wait `Retry-After` seconds.",
"code": "rate_limited",
"type": "rate_limit_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "Something broke on our side. Retry; runs that fail on our side are refunded.",
"code": "internal_error",
"type": "api_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "A connected app, or the service that connects it, answered with an error or could not be reached.",
"code": "upstream_error",
"type": "api_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "This part of the API is not available on the server right now. Retry later.",
"code": "service_unavailable",
"type": "api_error",
"request_id": "3f9a1c2b7d4e"
}Send the tool’s inputs in
MCP tools:
inputs, by the names List an app’s tools gives. data is the app’s answer, as the app gave it.
A read tool needs apps:read. A write tool needs apps:write and acts in your real account: the email is sent, the event is created. Send an Idempotency-Key so a retry after a timeout does not send it twice. See Idempotency.
| Status | Why |
|---|---|
404 | The app has no such tool. detail points to its tool list. |
409 app_not_connected | You have not connected the app, or its connection expired. detail.connect_url connects it. |
422 | The body is not valid. |
502 | The app refused the call, for example a missing or wrong input. detail gives the app’s reason. |
read_from_app runs a read tool, act_in_app a write tool.Authorizations
ApiKeyAuthApiKeyHeader
API key with the vd_sk_ prefix, as Authorization: Bearer vd_sk_.... Create keys in Settings → API Keys.
Headers
Any unique string (such as your order id). Resending the same request with the same key within 24 hours returns the first answer (with Idempotent-Replayed: true) and does nothing twice; the same key with a different request is a 422 idempotency_key_reused.
Required string length:
1 - 255Body
application/json
The tool's inputs, by name.
⌘I
Run an app tool
curl --request POST \
--url https://api.valendata.com/v1/apps/{app}/tools/{tool}/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {
"query": "is:unread",
"max_results": 2
}
}
'import requests
url = "https://api.valendata.com/v1/apps/{app}/tools/{tool}/run"
payload = { "inputs": {
"query": "is:unread",
"max_results": 2
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({inputs: {query: 'is:unread', max_results: 2}})
};
fetch('https://api.valendata.com/v1/apps/{app}/tools/{tool}/run', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.valendata.com/v1/apps/{app}/tools/{tool}/run",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputs' => [
'query' => 'is:unread',
'max_results' => 2
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.valendata.com/v1/apps/{app}/tools/{tool}/run"
payload := strings.NewReader("{\n \"inputs\": {\n \"query\": \"is:unread\",\n \"max_results\": 2\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.valendata.com/v1/apps/{app}/tools/{tool}/run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {\n \"query\": \"is:unread\",\n \"max_results\": 2\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.valendata.com/v1/apps/{app}/tools/{tool}/run")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"inputs\": {\n \"query\": \"is:unread\",\n \"max_results\": 2\n }\n}"
response = http.request(request)
puts response.read_body{
"app": "gmail",
"tool": "GMAIL_FETCH_EMAILS",
"kind": "read",
"data": {
"messages": [
{
"messageId": "19a2f0c4e1b7d3a5",
"sender": "Ada <ada@example.com>",
"subject": "Q4 plan",
"messageTimestamp": "2026-10-08T09:12:00Z",
"preview": {
"body": "Here is the plan for Q4…"
}
}
],
"nextPageToken": null
}
}{
"detail": "The request is malformed: the body is not JSON, the cursor or Idempotency-Key is not valid.",
"code": "invalid_json",
"type": "invalid_request_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "The API key is missing, malformed, revoked, or expired.",
"code": "unauthorized",
"type": "authentication_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "The key lacks a scope, is limited to other skills or workflows, or you may not do this.",
"code": "permission_denied",
"type": "permission_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "It does not exist, or it is not yours to see.",
"code": "not_found",
"type": "invalid_request_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "A conflict with the current state, or a request with this Idempotency-Key is still running.",
"code": "conflict",
"type": "conflict_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "Invalid request — name: Field required",
"code": "validation_error",
"type": "invalid_request_error",
"request_id": "3f9a1c2b7d4e",
"param": "name",
"errors": [
{
"type": "missing",
"loc": [
"body",
"name"
],
"msg": "Field required"
}
]
}{
"detail": "Too many requests for this key, or too many runs in progress. Wait `Retry-After` seconds.",
"code": "rate_limited",
"type": "rate_limit_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "Something broke on our side. Retry; runs that fail on our side are refunded.",
"code": "internal_error",
"type": "api_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "A connected app, or the service that connects it, answered with an error or could not be reached.",
"code": "upstream_error",
"type": "api_error",
"request_id": "3f9a1c2b7d4e"
}{
"detail": "This part of the API is not available on the server right now. Retry later.",
"code": "service_unavailable",
"type": "api_error",
"request_id": "3f9a1c2b7d4e"
}
