Skip to content

Scenes API ​

Endpoints for managing reusable scene presets with prompts, reference images, and generation defaults.

Overview ​

The Scenes API enables creating and managing reusable scene configurations that bundle prompt prefixes, reference images, and default settings. Use scenes to quickly generate images with consistent environments, lighting, or compositions.

List Scenes ​

Retrieve all saved scene presets with pagination and search.

http
GET /api/scenes

Query Parameters ​

ParameterTypeDefaultDescription
limitinteger50Items per page (max: 100)
offsetinteger0Pagination offset
searchstring-Search name/description
sort_bystringnamename, created, used, recent

Request ​

bash
curl -X GET "https://gobananasai.com/api/scenes?sort_by=used&limit=20" \
  -H "X-API-Key: sk_live_xxx"

Response ​

json
{
  "data": [
    {
      "id": 5,
      "sceneName": "Neon Alley",
      "description": "Cyberpunk alley with neon lights",
      "imageCount": 3,
      "defaultReferenceMode": "style",
      "preferredAspectRatio": "16:9",
      "timesUsed": 42,
      "createdAt": "2024-01-15T10:30:00.000Z",
      "lastUsedAt": "2024-01-20T14:22:00.000Z",
      "thumbnailUrl": "https://pub-xxx.r2.dev/.../thumb.jpg"
    },
    {
      "id": 8,
      "sceneName": "Studio Product Shot",
      "description": "Clean white background for products",
      "imageCount": 2,
      "defaultReferenceMode": "add",
      "preferredAspectRatio": "square",
      "timesUsed": 28,
      "createdAt": "2024-01-10T08:15:00.000Z",
      "lastUsedAt": "2024-01-19T16:45:00.000Z",
      "thumbnailUrl": "https://pub-xxx.r2.dev/.../thumb.jpg"
    }
  ],
  "pagination": {
    "total": 15,
    "limit": 20,
    "offset": 0,
    "hasMore": false
  }
}

Get Scene ​

Retrieve full details for a specific scene preset.

http
GET /api/scenes/:identifier

The identifier can be either a numeric ID or the scene name (URL-encoded).

Request ​

bash
curl -X GET "https://gobananasai.com/api/scenes/5" \
  -H "X-API-Key: sk_live_xxx"

Or by name:

bash
curl -X GET "https://gobananasai.com/api/scenes/Neon%20Alley" \
  -H "X-API-Key: sk_live_xxx"

Response ​

json
{
  "data": {
    "id": 5,
    "sceneName": "Neon Alley",
    "description": "Cyberpunk alley with neon lights",
    "scenePrompt": "A dark cyberpunk alley at night, wet pavement reflecting neon signs, atmospheric fog, cinematic lighting, blade runner aesthetic",
    "referenceImages": [
      {
        "id": 101,
        "r2Key": "tenant/2024-01-15/image-xxx.png",
        "url": "https://pub-xxx.r2.dev/.../image.png",
        "thumbnailUrl": "https://pub-xxx.r2.dev/.../thumb.jpg"
      },
      {
        "id": 105,
        "r2Key": "tenant/2024-01-15/image-yyy.png",
        "url": "https://pub-xxx.r2.dev/.../image.png",
        "thumbnailUrl": "https://pub-xxx.r2.dev/.../thumb.jpg"
      }
    ],
    "defaultReferenceMode": "style",
    "preferredAspectRatio": "16:9",
    "tags": ["cyberpunk", "urban", "night"],
    "timesUsed": 42,
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-18T09:15:00.000Z",
    "lastUsedAt": "2024-01-20T14:22:00.000Z"
  }
}

Create Scene ​

Save a new scene preset.

http
POST /api/scenes

Request Body ​

FieldTypeRequiredDescription
scene_namestringYesUnique name (1-100 chars)
descriptionstringNoHuman-readable description (max: 500)
scene_promptstringNoPrompt prefix (max: 4000)
reference_image_idsinteger[]NoUp to 20 existing image IDs
reference_image_urlsstring[]NoUp to 20 public URLs to fetch
default_reference_modestringNostyle or add
preferred_aspect_ratiostringNoDefault aspect ratio
tagsstring[]NoUp to 20 tags (each max 50 chars)

Note

At least one of scene_prompt, reference_image_ids, or reference_image_urls must be provided.

Request ​

bash
curl -X POST "https://gobananasai.com/api/scenes" \
  -H "X-API-Key: sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "scene_name": "Sunset Beach",
    "description": "Golden hour beach scene for lifestyle shots",
    "scene_prompt": "A beautiful sandy beach at sunset, golden hour lighting, warm orange and pink sky, gentle waves, palm trees in silhouette, tropical paradise atmosphere",
    "preferred_aspect_ratio": "16:9",
    "default_reference_mode": "style",
    "tags": ["beach", "sunset", "tropical", "lifestyle"]
  }'

Response ​

json
{
  "data": {
    "id": 12,
    "sceneName": "Sunset Beach",
    "description": "Golden hour beach scene for lifestyle shots",
    "scenePrompt": "A beautiful sandy beach at sunset, golden hour lighting, warm orange and pink sky, gentle waves, palm trees in silhouette, tropical paradise atmosphere",
    "referenceImages": [],
    "defaultReferenceMode": "style",
    "preferredAspectRatio": "16:9",
    "tags": ["beach", "sunset", "tropical", "lifestyle"],
    "timesUsed": 0,
    "createdAt": "2024-01-20T15:00:00.000Z",
    "updatedAt": "2024-01-20T15:00:00.000Z",
    "lastUsedAt": null
  }
}

Update Scene ​

Modify an existing scene preset.

http
PATCH /api/scenes/:identifier

The identifier can be either a numeric ID or the scene name.

Request Body ​

All fields are optional. Only provided fields are updated. Pass null to clear optional fields.

FieldTypeDescription
new_scene_namestringRename the scene
descriptionstring | nullNew description (null clears)
scene_promptstring | nullNew prompt (null clears)
reference_image_idsinteger[]Replace reference images
reference_image_urlsstring[]Fetch and add new references
default_reference_modestring | nullstyle, add, or null
preferred_aspect_ratiostring | nullNew aspect ratio (null clears)
tagsstring[] | nullReplace tags (null clears)

WARNING

The scene must maintain at least a prompt or reference images. You cannot clear both.

Request ​

bash
curl -X PATCH "https://gobananasai.com/api/scenes/12" \
  -H "X-API-Key: sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "new_scene_name": "Tropical Sunset Beach",
    "reference_image_ids": [150, 152, 155],
    "tags": ["beach", "sunset", "tropical", "lifestyle", "golden-hour"]
  }'

Response ​

json
{
  "data": {
    "id": 12,
    "sceneName": "Tropical Sunset Beach",
    "description": "Golden hour beach scene for lifestyle shots",
    "scenePrompt": "A beautiful sandy beach at sunset...",
    "referenceImages": [
      { "id": 150, "url": "https://pub-xxx.r2.dev/...", "thumbnailUrl": "..." },
      { "id": 152, "url": "https://pub-xxx.r2.dev/...", "thumbnailUrl": "..." },
      { "id": 155, "url": "https://pub-xxx.r2.dev/...", "thumbnailUrl": "..." }
    ],
    "defaultReferenceMode": "style",
    "preferredAspectRatio": "16:9",
    "tags": ["beach", "sunset", "tropical", "lifestyle", "golden-hour"],
    "timesUsed": 0,
    "createdAt": "2024-01-20T15:00:00.000Z",
    "updatedAt": "2024-01-20T15:30:00.000Z",
    "lastUsedAt": null
  }
}

Delete Scene ​

Remove a scene preset from the library.

http
DELETE /api/scenes/:identifier

Request ​

bash
curl -X DELETE "https://gobananasai.com/api/scenes/12" \
  -H "X-API-Key: sk_live_xxx"

Response ​

json
{
  "data": {
    "deleted": true,
    "sceneId": 12,
    "sceneName": "Tropical Sunset Beach",
    "imageCount": 3
  }
}

Note

Deleting a scene does not delete the reference images. They remain in your image library.

Error Responses ​

400 Invalid Payload ​

json
{
  "error": "Invalid scene preset payload",
  "details": ["Provide at least one of scene_prompt, reference_image_ids, or reference_image_urls"]
}

400 Duplicate Name ​

json
{
  "error": "Scene preset \"Neon Alley\" already exists. Use a different name or update the existing scene."
}

400 Invalid Reference Images ​

json
{
  "error": "Reference image 999 not found or does not belong to this tenant"
}

404 Scene Not Found ​

json
{
  "error": "Scene preset with ID 999 not found for this tenant"
}

400 Cannot Clear Both Prompt and References ​

json
{
  "error": "Scene preset must include at least a prompt or reference images"
}

Using Scenes with MCP ​

Scenes created via the REST API are available in MCP tools:

json
{
  "tool": "generate_image",
  "params": {
    "prompt": "A lone figure walking with an umbrella",
    "scene_name": "Neon Alley"
  }
}

Or by ID:

json
{
  "tool": "generate_image",
  "params": {
    "prompt": "A sports car",
    "scene_id": 5
  }
}

Next Steps ​

Released under the MIT License.