Sandstorm API

Generate images, video and audio on your brand from your own code, read the brand kit and library, and search competitor ads, with an API key.

What the API does

The Sandstorm API is for developers. One request shape runs every image, video and audio model, on your brand: each finished generation comes back with a permanent link and is saved to the brand's asset library. The API also reads your brand kit, assets, offers, characters and voices, and searches the ads your competitors run. The API reference has every endpoint, model and price, with requests you can try.

Open the API reference

Get a key

Open Settings → API keys, name the key and copy it. It's shown once. A key belongs to your team: it works on the brand you were on when you made it, or on the brand each request names, and spends your team's credits. You can also make one from a terminal: the command below opens your browser to sign in, makes a key and saves it to .env as SANDSTORM_API_KEY. Revoke a key any time in Settings → API keys.

Terminal command
curl -fsSL https://ads.dev/login.mjs -o sandstorm-login.mjs && node sandstorm-login.mjs
Open API keys

SDKs

Use the TypeScript SDK (npm install ads.dev) or the Python one (pip install ads_dev). Both read SANDSTORM_API_KEY, type every model's input, and wait for a generation or tell your webhook when it ends.

TypeScript
npm install ads.dev

Credits and keeping keys safe

Generations spend the same credits as work in the app, at the prices the API reference lists. Credits are held while a generation runs and released if it fails, or if you cancel it before the model starts. Keep the key on your server: anyone who holds it spends your credits.

Open Usage