Skip to main content
Read a battery’s state, tell it to charge, and check that the command completed. You’ll use a sandbox battery, so nothing real is controlled.
You need a sandbox API key. Request sandbox access.

1. Set your API key

Sandbox keys start with sk_test_. Send yours in the x-api-key header on every request.

2. Find a battery

Copy the id. If the list is empty, connect a sandbox battery through Link UI.

3. Read its state

state is what the battery is doing now. commands lists what it accepts: here, charge takes a target between 0 and 100 percent.

4. Send a charge command

The API returns 202 Accepted. Commands run asynchronously, so this means Amps has accepted the command, not that the battery has started charging.

5. Check the result

state moves from acknowledged to completed or failed. Read the battery again and it reports status: "charging". In production, subscribe to webhooks instead of polling.

Next steps

Push

Schedule commands, handle conflicts, cancel actions.

Pull

What device state contains and how fresh it is.

Webhooks

Get notified when an action completes.

Battery cookbook

Charge in a cheap-rate window, auto-balance, and more.