Skip to content

API Reference ​

Complete REST API documentation for Go Bananas!.

Overview ​

The Go Bananas! API provides programmatic access to all image generation, management, and administrative features. The API follows REST conventions with JSON request/response bodies.

Response envelope

  • Most endpoints return { data: ... } (no top‑level success flag).
  • List endpoints return { data: [...], pagination: { limit, offset, total } }.
  • Errors return { error: "message", ... } with optional details.

Base URL ​

Production: https://gobananasai.com
Development: http://localhost:8787

API Categories ​

API Overview

Tenant API, Admin API, and MCP endpoints

Quick Reference ​

Tenant Endpoints ​

MethodEndpointDescription
GET/api/profileGet tenant profile and quotas
GET/api/imagesList images with pagination
POST/api/imagesGenerate new image
GET/api/images/:idGet image details
DELETE/api/images/:idDelete image
GET/api/sessionsList sessions
GET/api/sessions/:idGet session details
GET/api/charactersList characters
POST/api/charactersCreate character
GET/api/characters/:idGet character
PATCH/api/characters/:idUpdate character
DELETE/api/characters/:idDelete character
POST/api/characters/:id/generateGenerate with character
POST/api/characters/generate-multiMulti‑character generation
GET/api/productsList product references
POST/api/productsCreate product reference
GET/api/products/:idGet product reference
PATCH/api/products/:idUpdate product reference
DELETE/api/products/:idDelete product reference
POST/api/products/:id/generateGenerate with product
GET/api/reference-groupsList reference groups
POST/api/reference-groupsCreate reference group
GET/api/reference-groups/:idGet reference group
PATCH/api/reference-groups/:idUpdate reference group
DELETE/api/reference-groups/:idDelete reference group
GET/api/style-presetsList style presets
POST/api/style-presetsCreate style preset
PATCH/api/style-presets/:idUpdate style preset
DELETE/api/style-presets/:idDelete style preset
GET/api/scenesList scene presets
POST/api/scenesCreate scene preset
GET/api/scenes/:idGet scene preset
PATCH/api/scenes/:idUpdate scene preset
DELETE/api/scenes/:idDelete scene preset
GET/api/search-presetsList saved search presets
POST/api/search-presetsCreate search preset
DELETE/api/search-presets/:idDelete search preset
GET/api/usageGet usage statistics
GET/api/sessions/:id/logsSession execution logs
GET/api/executions/activeActive executions
POST/api/images/uploadDirect file upload (multipart)
POST/api/images/batchBatch generate (1-8 images)
POST/api/images/delete-bulkBulk delete (max 20)
POST/api/edit-imageEdit existing image
POST/api/upload-for-editingUpload image for editing
GET/api/quota-checkPre-flight quota/rate-limit check
GET/api/webhooksList tenant webhooks
POST/api/webhooksCreate webhook
DELETE/api/webhooks/:idDelete webhook
GET/api/keysList API keys
GET/api/settingsGet tenant settings

Admin Endpoints ​

MethodEndpointDescription
GET/admin/tenantsList all tenants
POST/admin/tenantsCreate new tenant
GET/admin/tenants/:idGet tenant details
PATCH/admin/tenants/:idUpdate tenant
POST/admin/tenants/:id/api-keysCreate API key
GET/admin/usersList users
PATCH/admin/users/:idUpdate user
POST/admin/users/:id/unlockUnlock user account
GET/admin/invitationsList invitations
POST/admin/invitationsCreate invitation
DELETE/admin/invitations/:tokenRevoke invitation

MCP Endpoints ​

MethodEndpointDescription
POST/mcpMCP HTTP transport
GET/sseServer-Sent Events transport (legacy; use /mcp)

OAuth 2.1 Endpoints ​

MethodEndpointDescription
GET/.well-known/oauth-protected-resourceProtected resource metadata
GET/oauth/.well-known/openid-configurationAuthorization server metadata
GET/oauth/authorizeAuthorization with PKCE
POST/oauth/tokenToken exchange/refresh
POST/oauth/registerDynamic client registration

Authentication ​

REST API endpoints (/api/*) require API keys. MCP endpoints (/mcp, and the legacy /sse) accept API keys or OAuth access tokens.

API Key Authentication ​

bash
curl -X GET "https://gobananasai.com/api/profile" \
  -H "X-API-Key: sk_live_your_key_here"

Or using Bearer token:

bash
curl -X GET "https://gobananasai.com/api/profile" \
  -H "Authorization: Bearer sk_live_your_key_here"

OAuth 2.1 Authentication (MCP) ​

bash
curl -X POST "https://mcp.gobananasai.com" \
  -H "Authorization: Bearer <oauth_access_token>" \
  -H "Content-Type: application/json" \
  -d '{"method":"tools/list","params":{}}'

See OAuth 2.1 API → for complete OAuth documentation.

Admin API ​

bash
curl -X GET "https://gobananasai.com/admin/tenants" \
  -H "Authorization: Bearer <admin_session_token>"

Request Format ​

Headers ​

Content-Type: application/json
X-API-Key: sk_live_xxx (or Authorization: Bearer sk_live_xxx)
Authorization: Bearer <access_token> (OAuth for /mcp)
X-Session-Id: optional-session-id (for session tracking)

Request Body ​

json
{
  "field": "value",
  "nested": {
    "key": "value"
  }
}

Response Format ​

Success Response ​

json
{
  "data": {
    // Response data
  }
}

Some endpoints return a bare top‑level object (for example /api/profile returns { tenant: ... }).

Error Response ​

json
{
  "error": "Human-readable error message",
  "code": "OPTIONAL_ERROR_CODE",
  "details": {
    // Additional context (optional)
  }
}

Paginated Response ​

json
{
  "data": [...],
  "pagination": {
    "total": 100,
    "limit": 20,
    "offset": 0,
    "hasMore": true
  }
}

Rate Limiting ​

Rate limits are applied per tenant:

TierRequests/minuteDaily limit
Free10100
Basic601,000
Pro30010,000
EnterpriseCustomCustom

Rate Limit Headers ​

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1704067200

Rate Limit Exceeded ​

json
{
  "error": "Rate limit exceeded. Try again in 30 seconds.",
  "retryAfter": 30
}

Pagination ​

List endpoints support pagination:

bash
curl "https://gobananasai.com/api/images?limit=20&offset=40" \
  -H "X-API-Key: sk_live_xxx"

Parameters ​

ParameterTypeDefaultMaxDescription
limitinteger20100Items per page
offsetinteger0-Skip items

Filtering ​

Many list endpoints support filtering:

bash
# Search images by prompt
curl "https://gobananasai.com/api/images?search=sunset" \
  -H "X-API-Key: sk_live_xxx"

# Filter by date range
curl "https://gobananasai.com/api/images?dateFrom=2024-01-01&dateTo=2024-02-01" \
  -H "X-API-Key: sk_live_xxx"

# Filter by operation type
curl "https://gobananasai.com/api/images?operationType=generate" \
  -H "X-API-Key: sk_live_xxx"

Sorting ​

Images are returned newest‑first; sorting is not currently configurable.

CORS ​

The API supports CORS for browser-based applications:

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type, X-API-Key, Authorization, X-Session-Id
Access-Control-Max-Age: 86400

Health Check ​

bash
curl "https://gobananasai.com/health"

Response:

json
{
  "status": "ok",
  "timestamp": "2024-01-15T10:30:00.000Z"
}

SDK Support ​

While no official SDKs are provided, the REST API is easy to integrate:

JavaScript/TypeScript ​

typescript
class NanoBananaClient {
  constructor(private apiKey: string, private baseUrl: string) {}

  async request(method: string, path: string, body?: any) {
    const response = await fetch(`${this.baseUrl}${path}`, {
      method,
      headers: {
        'Content-Type': 'application/json',
        'X-API-Key': this.apiKey,
      },
      body: body ? JSON.stringify(body) : undefined,
    });
    return response.json();
  }

  // Images
  listImages(params?: { limit?: number; offset?: number; search?: string }) {
    const query = new URLSearchParams(params as any).toString();
    return this.request('GET', `/api/images?${query}`);
  }

  generateImage(prompt: string, options?: GenerateOptions) {
    return this.request('POST', '/api/images', { prompt, ...options });
  }

  // Characters
  listCharacters() {
    return this.request('GET', '/api/characters');
  }

  createCharacter(data: CharacterInput) {
    return this.request('POST', '/api/characters', data);
  }
}

Python ​

python
import requests

class NanoBananaClient:
    def __init__(self, api_key: str, base_url: str):
        self.api_key = api_key
        self.base_url = base_url

    def _request(self, method: str, path: str, json=None):
        response = requests.request(
            method,
            f"{self.base_url}{path}",
            headers={"X-API-Key": self.api_key},
            json=json
        )
        return response.json()

    def list_images(self, limit=20, offset=0):
        return self._request("GET", f"/api/images?limit={limit}&offset={offset}")

    def generate_image(self, prompt: str, **options):
        return self._request("POST", "/api/images", {"prompt": prompt, **options})

Next Steps ​

Released under the MIT License.