Nano Banana 2 API Technical Guide
In-depth technical documentation for Nano Banana 2 Visual Production Service utilizing sophisticated artificial intelligence capabilities
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.orgoverview.api_version
v1.0.0Nano Banana 2 Implementation Guide
- 1. Register for Nano Banana 2 API credentials through our main platform
- 2. Embed your Nano Banana 2 access token within the Authorization parameter
- 3. Transmit a POST submission to the Nano Banana 2 visual creation terminal
- 4. Leverage the provided Nano Banana 2 job identifier for status verification
- 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-1234567890abcdefSubmission 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/genSubmission Variables
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model identifier (e.g., "google/gempix2") |
| prompt | string | Yes | Text prompt describing the image |
| images | array | No | Reference image URLs (max 4) |
| callback_url | string | No | Webhook 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
| Parameter | Type | Required | Description |
|---|---|---|---|
| task_id | string | Yes | Unique 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 initiationsubmitted - Nano Banana 2 job entered into production sequencein_progress - Nano Banana 2 job currently undergoing active processingsuccess - Nano Banana 2 job finalized successfully with fabricated visualsfailed - Nano Banana 2 job terminated due to technical complicationsProblem 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"
}| Field | Type | Description |
|---|---|---|
| image | string | Image 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
}
}| Field | Type | Description |
|---|---|---|
| result | array | Array of ImageGenResult objects (null if failed) |
| status | string | Final task status (success/failed) |
| task_id | string | Unique task identifier |
| consumed | string | Credits consumed by the task |
| status_reason | object | Status details including error message if failed |
Nano Banana 2 Supported Configurations
google/gempix2Nano Banana image generation modelgoogle/gemini-2.5-flash-imageGemini 2.5 Flash image modelIssue 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
OK
Request was successful
Bad Request
Invalid request parameters or malformed JSON
Unauthorized
Invalid, missing, or expired API key
Not Found
Task not found or endpoint doesn't exist
Internal Server Error
Server-side error occurred
Issue Resolution Recommended Approaches
- Consistently verify HTTP response indicators before analyzing output content
- Deploy progressive delay algorithms for repetition mechanisms during 500 complications
- Document problem notifications with comprehensive details for troubleshooting purposes
- Confirm input validity prior to request submission to prevent 400 complications
- Address verification problems by requesting API credential updates from clients
- Track job progression at reasonable intervals rather than excessive status inquiries
- 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;
}
}