Call an external API
Send an HTTPS request from your app to an approved host and handle the response.
Use this when your app’s backend needs to call a public HTTPS API. Request the host and methods your app needs. Once the workspace owner approves the deployment, send requests through Smolcloud’s proxy.
For a selected Google or OneDrive file, Slack channel or external database, start with App connections. For a CLI that needs to connect from inside an app, see Network access for agents in apps.
Request access
- Replace
https://example.comwith the API origin in both examples. Add the host and allowed methods toinnie-resources.json, keeping any existing resource requests:
{
"version": 1,
"resources": ["http"],
"http": [{ "origin": "https://example.com", "methods": ["GET"] }]
}
- Run
smolcloud deploy APP_ID SOURCE_DIRECTORYand wait for the owner's review in Deployments. - Run
smolcloud capabilities APP_IDto confirm the access is active.
Call the proxy
After approval the app receives OUTBOUND_HTTP_URL and OUTBOUND_HTTP_TOKEN. Use them only in backend code:
const key = crypto.randomUUID(); // One per action. Save it and reuse it if you retry.
const response = await fetch(process.env.OUTBOUND_HTTP_URL!, {
method: "POST",
headers: {
authorization: `Bearer ${process.env.OUTBOUND_HTTP_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
key,
url: "https://example.com/data",
method: "GET",
headers: { accept: "application/json" },
bodyBase64: "",
}),
signal: AbortSignal.timeout(20000),
});
if (!response.ok)
throw new Error(`External request refused: ${response.status}`);
const result = await response.json();
const bytes = Buffer.from(result.bodyBase64, "base64");
// result.status is the external HTTP status; handle 4xx/5xx in your app.
Approval covers every path on that origin for the allowed methods. Check the caller’s permission in your app before sending a request on their behalf.
Retry safely and remove access
An app administrator can inspect recent calls with GET /api/apps/APP_ID/http/activity. Reuse the original UUID for the same action. If Smolcloud has recorded it, the proxy returns 409 without sending another request.
| Result | What it tells you |
|---|---|
completed | The external service responded. Check result.status for its HTTP status, including errors. |
started or unknown | There is no confirmed result yet. Check the external service before repeating a write. |
denied | Access changed while the request was in flight. The external service may already have acted on it. |
| Proxy HTTP 429 | A concurrency or activity limit was reached. Honour Retry-After when present. |
To revoke access, the owner reads the version from GET /api/apps/APP_ID/http, then sends POST /api/apps/APP_ID/http/revoke with {"expectedVersion":CURRENT_VERSION,"confirm":true} in their signed-in browser session. A stale version returns 409. Restoring access requires a newly approved deployment.
Limits
- 1–8 addresses per app, each an exact
https://host on port 443. No wildcards, IP addresses, credentials in the URL, or redirects. - Methods: GET, HEAD, POST, PUT, PATCH, DELETE. GET/HEAD have no request body.
- Request body up to 64 KiB; response up to 1 MiB.
- Allowed request headers, in lowercase:
accept,content-type,authorization,x-api-key,x-request-id; values up to 1,024 UTF-8 bytes. - 2 concurrent requests per app, 4 across the service, 60 new requests per app per minute, and a maximum of 10,000 recorded requests per app. At that total, new requests return 429.
- Each request has 20 seconds in total, 15 of them for the external call. No automatic retries and no streaming.
- The proxy blocks private addresses and protected domains, including Google APIs and the OpenAI and Anthropic APIs.