API Platform

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.

Page as Markdown

Get an API key#

Create a key on the console's API keys page — the key is shown once, when you create it. 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.

Authenticate a request#

SDK — pass apiKey (api_key in Python) and the SDK builds an authenticated client that sends Authorization: Bearer <key> on every request.

REST — send your API key as a bearer token. See the REST API for endpoints and request/response shapes.

CLI — the gen-ai CLI 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.

import { createClient } from '@picsart/ai-sdk';

const ai = createClient({
  apiKey: process.env.PICSART_API_KEY, // sent as: Authorization: Bearer <key>
  apiUrl: 'https://api.green-salad-4efd.toolsminati.workers.dev',
});

Protect your API key#

Keep API requests that use a secret key on your server. Do not include the key in browser code, mobile app bundles, screenshots, or support messages. If you expose a key, revoke it on the API keys page and replace it in your application.

If authentication fails, check that your application reads the correct environment variable and sends the bearer header shown above. Use the authentication guide for your specific endpoint if you maintain a legacy Creative APIs integration.

Next steps#