Get started
Authentication
The SDK and REST API authenticate with a Picsart API key sent as a bearer token. The CLI signs in through your browser instead — no key to manage.
Get an API key
Create a key from your Picsart account settings, then load it from an environment variable in your app.
Keep keys secret. Never commit an API key or ship it in client-side code. Load it from an environment variable or a secrets manager.
SDK
Pass apiKey and the SDK builds an authenticated fetch that sends Authorization: Bearer <key> on every request.
TypeScript
import { createClient } from '@picsart/ai-sdk';
const ai = createClient({
apiKey: process.env.PICSART_API_KEY, // sent as: Authorization: Bearer <key>
apiUrl: 'https://api.picsart.com',
});REST API
Send your API key as a bearer token. See the REST API for endpoints and request/response shapes.
curl
curl -X POST 'https://api.picsart.com/gw-v2/workflows/flux-v2/execute' \
-H 'Authorization: Bearer $PICSART_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "params": { "prompt": "A red panda", "model": "flux-2-pro" } }'CLI
The gen-aiCLI doesn't use an API key — it signs in through your browser with an OAuth flow and stores a token locally. Run it once per machine.
bash
gen-ai loginNext: Quickstart →