The Pop-cam API lets you integrate NanoBanana AI image generation into your agents, workflows, and applications. Transform any photo into a miniature figure illustration with a single API call.
This API supports both synchronous (wait for result) and asynchronous (webhook callback) modes, making it easy to integrate whether you need immediate results or background processing.
Get up and running in three steps:
pk_... token immediately — it's only shown once.curl -X POST https://pop-cam.com/api/v1/nanobanana \
-H "Authorization: Bearer pk_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"image": "data:image/png;base64,iVBOR...",
"prompt": "Create a miniature figure of this character"
}'{
"job_id": "a1b2c3d4-e5f6-...",
"image_url": "https://storage.pop-cam.com/generated/...",
"used_prompt": "Create a miniature figure of this character",
"credits_remaining": 42
}All API requests must include your API token in the Authorization header:
Authorization: Bearer pk_your_token_here
Tokens are prefixed with pk_ and are 64 hex characters long. Each token is tied to your user account and shares your credit balance.
API usage is limited by your credit balance. Each image generation costs 1 credit. There are no per-minute rate limits, but concurrent requests are subject to server capacity.
You need an API token to authenticate requests. Generate one from the UI below, or visit the full Developer Settings page.
/api/v1/nanobananaTransform an image into a NanoBanana-style miniature figure. Supports both synchronous and asynchronous (webhook) modes.
| Parameter | Type | Description |
|---|---|---|
Authorizationrequired | string | Bearer pk_your_token |
Content-Typerequired | string | application/json |
| Parameter | Type | Description |
|---|---|---|
imagerequired | string | Base64 data URL. Format: data:image/png;base64,... |
prompt | string | Custom generation prompt. Omit to use the default NanoBanana prompt. |
webhook_url | string | URL to POST results to when done. Enables async mode (returns HTTP 202). |
Returned when no webhook_url is provided:
{
"job_id": "a1b2c3d4-e5f6-...",
"image_url": "https://storage.pop-cam.com/generated/...",
"used_prompt": "...",
"credits_remaining": 42
}Returned when webhook_url is provided. Results are POSTed to your URL.
{
"job_id": "a1b2c3d4-e5f6-...",
"status": "processing",
"message": "Your image is being generated. Results will be POSTed to your webhook_url."
}import requests
import base64
with open("photo.png", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
response = requests.post(
"https://pop-cam.com/api/v1/nanobanana",
headers={"Authorization": "Bearer pk_YOUR_TOKEN"},
json={
"image": f"data:image/png;base64,{b64}",
"prompt": "Create a miniature figure of this character"
}
)
data = response.json()
print(f"Image URL: {data['image_url']}")
print(f"Credits remaining: {data['credits_remaining']}")import fs from "fs";
const imageData = fs.readFileSync("photo.png");
const base64 = imageData.toString("base64");
const response = await fetch("https://pop-cam.com/api/v1/nanobanana", {
method: "POST",
headers: {
"Authorization": "Bearer pk_YOUR_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
image: `data:image/png;base64,${base64}`,
prompt: "Create a miniature figure of this character",
}),
});
const data = await response.json();
console.log("Image URL:", data.image_url);Provide a webhook_url in your request to enable async mode. The API returns immediately with HTTP 202 and a job_id, then POSTs the result to your URL when generation completes.
{
"success": true,
"job_id": "a1b2c3d4-e5f6-...",
"image_url": "https://storage.pop-cam.com/generated/...",
"used_prompt": "...",
"credits_remaining": 41
}{
"success": false,
"job_id": "a1b2c3d4-e5f6-...",
"error": "Description of what went wrong"
}Delivery is attempted up to 3 times with exponential backoff (1s, 2s, 4s). Return a 2xx status to acknowledge receipt.
job_id for idempotency.These endpoints use Clerk session auth (cookie or JWT), not API tokens. For a UI, visit Developer Settings.
/api/v1/tokensList all API tokens (masked) for the authenticated user.
{
"tokens": [
{
"id": "uuid",
"name": "My Agent",
"token": "pk_...a1b2c3",
"createdAt": "2025-01-15T...",
"lastUsedAt": "2025-01-16T...",
"revokedAt": null
}
]
}/api/v1/tokensCreate a new API token. The full token is only returned in this response.
| Parameter | Type | Description |
|---|---|---|
name | string | Label for the token (e.g. "My Agent"). Defaults to "Default". |
/api/v1/tokens?id=TOKEN_IDRevoke a token. It immediately stops working for all requests.
| Status | Meaning | Resolution |
|---|---|---|
400 | Bad Request | Missing or malformed image field. |
401 | Unauthorized | Invalid or revoked API token. |
402 | Payment Required | Insufficient credits. Purchase more. |
500 | Server Error | Retry after a short delay. |
All errors return JSON with an error field:
{
"error": "Human-readable error description"
}Machine-readable OpenAPI spec: /api/v1/docs