services
Get a key

library / Integrations / No-code automation / I0149

Apple Shortcuts balance check

A Shortcut on iPhone or Mac reads the SOL balance of one address from Carbium RPC with a single POST, and a short Node check runs the same getBalance call so you can see the reply your Shortcut will parse.

By Carbium · No-code automation · I0149 · updated 2026-11-23

01

What the Shortcut reads

An iOS Shortcut can send a web request and read the reply, which covers a balance check. This one posts a single getBalance call to the RPC endpoint, reads the lamport count from the reply and shows the wallet's SOL on screen. The call only reads. Nothing is signed and nothing is sent to the network, so the Shortcut cannot move funds.

The same Shortcut runs in the Shortcuts app on an iPhone, an iPad or a Mac. Start it by hand, from a Home Screen icon, from the Share sheet, or from an automation that runs at a time you choose. Each run reads the wallet at that moment and shows one number.

A plain SOL wallet is read on demand. Its account does not push changes, so the Shortcut has no way to hear about a payment on its own. The last section covers what to add when you need that.

02

The request the Shortcut sends

The request has four parts you set by hand and one value you read back. The table lists each field the way it appears in the Shortcut's actions.

Shortcut fieldValueWhy
URLhttps://services.carbium.shThe RPC endpoint is one domain for every RPC method.
MethodPOSTJSON-RPC calls are sent as POST requests.
Headerx-api-key set to your keyThe key goes in the header, so the URL carries no secret.
Request bodyJSON with jsonrpc 2.0, id 1, method getBalance, and params holding the address and an options object with commitment set to confirmedThe commitment is written into the body, so the answer does not depend on the server default.
Read backresult, then valuevalue is the balance in lamports, an integer.

The commitment decides which slot the balance is read at. The server default is finalized, but @solana/kit fills in confirmed when a call leaves commitment out. The Shortcut sends confirmed in its body, and the Node check does the same, so both read the same level.

One SOL is 1,000,000,000 lamports. The Shortcut divides value by that number with a Calculate action and keeps the result as a number, so the formatting happens once, at the end.

03

Build the Shortcut

  1. Add a Text action with the wallet address, pasted whole with no spaces. Its output feeds the request body.
  2. Add Get Contents of URL. Set the URL to https://services.carbium.sh, the method to POST, add the header x-api-key with your key, and choose JSON as the request body. Enter jsonrpc, id, method and params as the table lists, and put the Text output in the address slot of params.
  3. Add Get Dictionary Value with the key result, then a second Get Dictionary Value with the key value on that output.
  4. Add a Calculate action that divides by 1000000000, then Show Result.

The key lives in the header of the Shortcut. Anyone who opens the Shortcut, or a copy someone received through iCloud, can read it, so keep the Shortcut on your own devices and make a separate key on your account for it. The key can also go in the URL as ?api-key=, which the auth page accepts, but a URL shows up in more places than a header does, so the header is the better choice.

04

Check the request on a computer

Shortcuts runs only on Apple devices, so the check is a small Node program. It makes the same getBalance call through @solana/kit, reads the lamport count and prints the wallet's SOL. Run it once to see the reply your Shortcut will parse, and to confirm the key works before you build anything.

main.ts
// I0149 · Apple Shortcuts balance check// https://carbium.sh/library/integrate/apple-shortcuts-balance-check// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MITimport {  address,  createDefaultRpcTransport,  createSolanaRpcFromTransport,  isSolanaError,  SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR,} from "@solana/kit";const key = process.env.CARBIUM_KEY;if (!key) {  console.error("Set CARBIUM_KEY to your Carbium API key, then run again.");  process.exit(1);}const rpc = createSolanaRpcFromTransport(  createDefaultRpcTransport({    url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh",    headers: { "x-api-key": key },  }),);function toAddress(text: string) {  try {    return address(text);  } catch {    console.error(`Not a Solana address: ${text}`);    process.exit(1);  }}const target = toAddress(process.argv[2] ?? "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");const LAMPORTS_PER_SOL = BigInt(1000000000);try {  const { value: lamports } = await rpc    .getBalance(target, { commitment: "confirmed" })    .send({ abortSignal: AbortSignal.timeout(5000) });  const whole = lamports / LAMPORTS_PER_SOL;  const frac = (lamports % LAMPORTS_PER_SOL).toString().padStart(9, "0");  console.log(JSON.stringify({ address: target, lamports: lamports.toString(), sol: `${whole}.${frac}` }, null, 2));} catch (err) {  if (isSolanaError(err, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR)) {    console.error(`Carbium answered HTTP ${err.context.statusCode}`);  } else {    console.error(err instanceof Error ? err.message : String(err));  }  process.exit(1);}

run: node main.ts

Install the one dependency with npm install @solana/[email protected] and set "type": "module" in package.json. Export CARBIUM_KEY in the shell, then run node main.ts with an address after it. With no address, the program reads the SPL Token program account, a public account that always holds some lamports.

The printed JSON carries the same lamport count the Shortcut reads at value. If the two disagree, the Shortcut is reading a different address, a different commitment, or a reply from an earlier run.

05

Where it ends

  • It reads once per run. A payment that lands between runs appears at the next run, and nothing wakes the phone when it arrives.
  • A plain SOL wallet sends nothing on accountSubscribe, so a push alert needs a server that opens logsSubscribe mentions for the address and calls getBalance on each notice. The Free plan carries 5 sockets, so count the connections before you build it.
  • The key sits in one Shortcut on one phone, and it shares its budget with every other key on the account, because limits are per account.
  • It reads one address and one number. Token balances, token accounts and transaction history are other calls.
  • It needs the phone to reach services.carbium.sh. Offline, the request fails and the Shortcut shows the error, with no number.
06

When it goes wrong

what goes wrongwhat to do
The reply is HTTP 401 and the Shortcut shows no number.An unknown key gets 401 at the door. Paste the whole key into the x-api-key header, with nothing cut off, and run the Shortcut again. The error codes page lists the rest.
The Shortcut shows HTTP 429, or the reply carries a retry-after hint.A call over its rate waits once and is served if its cells refill within 1 s. Past that it gets 429 with a retry-after hint. Wait the hinted seconds and run again. If it happens on every run, other traffic on your account is using the shared budget; see the limits page.
The Shortcut shows an error about the address, or zero for a wallet you know holds SOL.Run the Node check with the same address. A malformed address fails there with a message, so fix the Text action. If the check prints zero, the wallet holds no SOL on the confirmed read, and the Shortcut is right.
The balance is 1,000,000,000 times too large.The Calculate step is missing, or it reads a value other than value. value is in lamports, so divide by 1000000000 before you show it.
A transfer you just made does not show yet.The Shortcut reads at confirmed, so a transfer appears once the cluster has confirmed it. Wait a few seconds and run the Shortcut again.
The Shortcut was shared, and someone else holds your key.Stop sharing the Shortcut, create a new key on your account as the account keys page describes, and put only the new key in your own copy.
07

Questions

Can the Shortcut alert me when a payment arrives?

Not on its own. A Shortcut reads only when it runs, so it can compare the new balance with the last one it saved, but it cannot hear the change. An alert that arrives unprompted needs a small server with a WebSocket subscription, as the where-it-ends section describes.

Why does the request body say confirmed and not finalized?

The server default is finalized, and @solana/kit uses confirmed when a call leaves commitment out. Setting it in the body means the Shortcut and the Node check read the same level, whatever the default is.

Is it safe to keep my key in a Shortcut?

On a phone with a passcode only you know, yes, with the precautions in the build section. A key inside a shared or exported Shortcut is visible to whoever gets that copy.

Does the check need a Mac or a Linux box?

Any machine with Node 24 runs it. Nothing in it is tied to one operating system, and it needs only the @solana/kit package.

Can the Shortcut read a token balance too?

Not with this request. A token balance is a different call, and the SPL token balance entry shows how to make it.