The examples use a fake key (
samsa_sk_example…) and placeholder ids. Replace
them with your own. Store your key in an environment variable so it never lands
in source control:Create an API key
API keys are organization-owned and can only be created by an organization admin (OWNER or ADMIN).
Open your organization settings
In the Samsa app, go to your organization settings and
open the API Keys tab.
Create a key
Give the key a name. By default it is granted all scopes
(
images.generate, images.edit, videos.generate, models.read,
models.write, usage.read); narrow them if the integration needs less.
You can also set an optional expiry.Verify the key with GET /me
GET /me is the fastest way to confirm a key works. It returns the key’s
organization, its safe metadata (prefix, scopes, expiry — never the secret), and
the organization’s available credit balance.
Response
Generate an image
Submit a prompt toPOST /images/generations. Here we also compose one of the
organization’s trained style models by passing its id as style_id — you can
combine object_ids, person_ids, setting_ids, and a color_palette_id the
same way. The request returns 202 immediately with a job id; the image is
produced asynchronously.
Response — 202 Accepted
The default engine is
nano_banana_pro (pass engine to choose
nano_banana_2). num_outputs defaults to 1; each output costs
5 credits at 1K, scaling with resolution (1K ×1, 2K ×2, 4K ×4). The
style_id must reference a completed model in your organization.Poll for the result
PollGET /images/generations/{id} until status is completed (or failed).
Statuses are pending, processing, completed, failed, and cancelled.
Response — completed
Download the result
Each entry inimages carries a presigned HTTPS url that is valid for 24
hours — download and store the asset before it expires.
Next steps
API reference
The base URL, authentication, and the conventions every endpoint shares.
Run it locally
Preview and contribute to these docs with the Mintlify CLI.