Nano Banana 2 API Technical Guide

In-depth technical documentation for Nano Banana 2 Visual Production Service utilizing sophisticated artificial intelligence capabilities

View PricingExplore Nano Banana 2 subscription options

Nano Banana 2 API Introduction

The Nano Banana 2 Visual Production API enables integration with sophisticated artificial intelligence systems for crafting premium visuals from textual descriptions and sample graphics. Our Nano Banana 2 platform delivers an uncomplicated REST architecture featuring extensive job coordination and notification capabilities.

Nano Banana 2 Core Capabilities

  • Nano Banana 2 textual-to-visual transformation employing cutting-edge artificial intelligence systems
  • Nano Banana 2 compatibility with sample graphics (maximum 4 images)
  • Nano Banana 2 non-blocking job execution with progress monitoring
  • Nano Banana 2 webhook integration for instantaneous status updates
  • Nano Banana 2 REST architecture delivering JSON-formatted responses
  • Nano Banana 2 Bearer credential verification system

overview.base_url

https://api.defapi.org

overview.api_version

v1.0.0

Nano Banana 2 Implementation Guide

  1. 1. Register for Nano Banana 2 API credentials through our main platform
  2. 2. Embed your Nano Banana 2 access token within the Authorization parameter
  3. 3. Transmit a POST submission to the Nano Banana 2 visual creation terminal
  4. 4. Leverage the provided Nano Banana 2 job identifier for status verification
  5. 5. Acquire your Nano Banana 2 fabricated visuals upon task culmination

Identity Verification

Every API submission requires authentication through Bearer token verification. Incorporate your access credentials within the Authorization parameter for each transmission.

Verification Approach

Implement HTTP Bearer token validation by embedding your access credentials in the Authorization parameter:

Authorization: Bearer <your-api-key>

Sample Access Key Structure

Authorization: Bearer dk-1234567890abcdef

Submission Demonstration

curl -X POST "https://api.defapi.org/api/image/gen" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-api-key-here" \
  -d '{
    "model": "google/gempix2",
    "prompt": "A beautiful landscape"
  }'

Successful Verification

  • Access credentials remain current
  • Client registration maintains active status
  • Adequate service credits persist

Frequent Issues

  • Absent access credentials
  • Incorrect access key configuration
  • Deactivated or suspended registration

Nano Banana 2 Visual Production API

Fabricate visuals utilizing Nano Banana 2 with sophisticated artificial intelligence systems and adaptable textual instructions plus sample imagery.

Connection Terminal

POST /api/image/gen

Submission Variables

ParameterTypeRequiredDescription
modelstringYesModel identifier (e.g., "google/gempix2")
promptstringYesText prompt describing the image
imagesarrayNoReference image URLs (max 4)
callback_urlstringNoWebhook URL for completion notifications

Implementation Illustrations

Fundamental Nano Banana 2 Visual Creation

{
  "model": "google/gempix2",
  "prompt": "A beautiful girl dancing in a garden"
}

Nano Banana 2 Reference-Based Production with Sample Graphics

{
  "model": "google/gempix2",
  "prompt": "Put them in a basket",
  "images": [
    "https://cdn.openai.com/API/docs/images/body-lotion.png",
    "https://cdn.openai.com/API/docs/images/soap.png"
  ],
  "callback_url": "https://example.com/webhook/image-callback"
}

Output Structure

{
  "code": 0,
  "message": "ok",
  "data": {
    "task_id": "ta12345678-1234-1234-1234-123456789abc"
  }
}

Issue Management

400 - Bad Request

{"code": 1, "message": "failed", "detail": "prompt is required"}

401 - Unauthorized

{"code": 1, "message": "Invalid API key"}

Nano Banana 2 Job Status API

Investigate the progress and outcomes of Nano Banana 2 visual production jobs utilizing the task identifier provided by the Nano Banana 2 visual creation terminal.

Connection Terminal

GET /api/task/query?task_id=<task_id>

Investigation Variables

ParameterTypeRequiredDescription
task_idstringYesUnique task identifier returned from generation endpoint

Submission Illustration

curl -X GET "https://api.defapi.org/api/task/query?task_id=ta823dfb-eaac-44fd-aec2-3e2c7ba8e071" \
  -H "Authorization: Bearer your-api-key-here"

Nano Banana 2 Job Status Categories

pending - Nano Banana 2 job initialization completed awaiting processing initiation
submitted - Nano Banana 2 job entered into production sequence
in_progress - Nano Banana 2 job currently undergoing active processing
success - Nano Banana 2 job finalized successfully with fabricated visuals
failed - Nano Banana 2 job terminated due to technical complications

Problem Responses

404 - Task Not Found

{"code": 1, "message": "task not found"}

401 - Unauthorized

{"code": 401, "message": "Invalid API key"}

Nano Banana 2 Information Structures

Comprehensive documentation for all Nano Banana 2 information configurations and templates utilized throughout API communications and submissions.

ImageGenResult

Represents a generated image result.

{
  "image": "https://google.datas.systems/fileSystem/response_images/287/2025/08/29/1756432513771985292_2989.png"
}
FieldTypeDescription
imagestringImage URL or base64 data URI

CallbackPayload

Payload sent to the callback_url when task status changes to final states.

{
  "result": [
    {
      "image": "https://google.datas.systems/fileSystem/response_images/287/2025/08/29/1756432513771985292_2989.png"
    }
  ],
  "status": "success",
  "task_id": "ta5c9705-b8ae-4cb9-aa6f-97c4fee88c8d",
  "consumed": "0.500000",
  "status_reason": {
    "message": null
  }
}
FieldTypeDescription
resultarrayArray of ImageGenResult objects (null if failed)
statusstringFinal task status (success/failed)
task_idstringUnique task identifier
consumedstringCredits consumed by the task
status_reasonobjectStatus details including error message if failed

Nano Banana 2 Supported Configurations

google/gempix2Nano Banana image generation model
google/gemini-2.5-flash-imageGemini 2.5 Flash image model

Issue Management

Thorough handbook for managing complications and interpreting API response indicators. All problem notifications adhere to standardized formatting enabling efficient resolution methodologies.

HTTP Response Indicators

200

OK

Request was successful

400

Bad Request

Invalid request parameters or malformed JSON

401

Unauthorized

Invalid, missing, or expired API key

404

Not Found

Task not found or endpoint doesn't exist

500

Internal Server Error

Server-side error occurred

Issue Resolution Recommended Approaches

  1. Consistently verify HTTP response indicators before analyzing output content
  2. Deploy progressive delay algorithms for repetition mechanisms during 500 complications
  3. Document problem notifications with comprehensive details for troubleshooting purposes
  4. Confirm input validity prior to request submission to prevent 400 complications
  5. Address verification problems by requesting API credential updates from clients
  6. Track job progression at reasonable intervals rather than excessive status inquiries
  7. Employ webhook integration whenever feasible to eliminate constant completion monitoring

Illustration Issue Management (JavaScript)

async function generateImage(prompt, apiKey) {
  try {
    const response = await fetch('https://api.defapi.org/api/image/gen', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${apiKey}`
      },
      body: JSON.stringify({
        model: 'google/gempix2',
        prompt: prompt
      })
    });

    if (!response.ok) {
      const errorData = await response.json();
      throw new Error(`API Error ${response.status}: ${errorData.message}`);
    }

    const data = await response.json();
    return data.data.task_id;

  } catch (error) {
    console.error('Image generation failed:', error.message);
    throw error;
  }
}