Upscale Images

January 2, 2026

Table of contents

  1. Request Headers
  2. Request Body
  3. Responses
  4. Model
  5. Examples
  6. Try It

Upscale a previously generated image to 2K or 4K resolution. This endpoint uses Google Flow’s native image upscaling capabilities.

Important:

  • Upscaling is only supported for images generated with nano-banana-pro model. Other models (imagen-4, nano-banana) will return a 429 error.
  • 4k resolution requires a paid Google account with an active subscription. Free accounts can only use 2k resolution.

https://api.useapi.net/v1/google-flow/images/upscale

Request Headers

Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data

Request Body

{
  "mediaGenerationId": "user:12345-email:6a6f...-image:CAMaJDMx...",
  "resolution": "2k"
}
  • mediaGenerationId is required. The mediaGenerationId from a previously generated image via POST /images.
  • resolution is optional. Target resolution for upscaling (default: 2k). Supported values: 2k, 4k.
  • captchaRetry is optional, number of captcha retry attempts (1-10, default: 3). Cycles through configured captcha providers starting with EzCaptcha if available.
  • captchaOrder is optional, explicit captcha provider sequence as comma-separated string (e.g., "EzCaptcha,EzCaptcha,CapSolver"). Maximum 10 entries. Each provider must have an API key configured.

Note: captchaRetry and captchaOrder are mutually exclusive - only one can be specified per request.

Responses

  • 200 OK

    Image upscaled successfully. Returns base64-encoded image data.

    {
      "encodedImage": "/9j/4AAQSkZJRgABAQAAAQ...base64 encoded image data...",
      "captcha": {
        "service": "EzCaptcha",
        "taskId": "abc123...",
        "durationMs": 3500,
        "attempts": [
          {
            "service": "EzCaptcha",
            "taskId": "abc123...",
            "durationMs": 3500,
            "success": true
          }
        ]
      }
    }
    
  • 400 Bad Request

    Invalid request (missing or invalid mediaGenerationId).

    {
      "error": "mediaGenerationId is required"
    }
    
  • 401 Unauthorized

    Invalid API token.

    {
      "error": "Unauthorized"
    }
    
  • 403 Forbidden

    Request rejected by Google.

    Recommendations:

    • Ensure captchaRetry is set to at least 3 (default). Try increasing to a higher value (e.g., 5) to see if that helps
    • If issues persist, contact useapi.net support
    {
      "error": {
        "code": 403,
        "details": [
          {
            "@type": "type.googleapis.com/google.rpc.ErrorInfo",
            "reason": "PUBLIC_ERROR_SOMETHING_WENT_WRONG"
          }
        ],
        "message": "reCAPTCHA evaluation failed",
        "status": "PERMISSION_DENIED"
      },
      "captcha": {
        "service": "EzCaptcha",
        "taskId": "ab0251dc-6930-4a82-966a-71fe6ab6aa42",
        "durationMs": 5789,
        "attempts": [
          {
            "service": "EzCaptcha",
            "taskId": "ab0251dc-6930-4a82-966a-71fe6ab6aa42",
            "durationMs": 5789,
            "success": true
          }
        ]
      }
    }
    
  • 404 Not Found

    Account not found or image not found.

    {
      "error": "Google Flow account [email protected] not found"
    }
    
  • 429 Too Many Requests

    Upscaling not supported for this image. Only images generated with nano-banana-pro model can be upscaled.

    {
      "error": {
        "code": 429,
        "message": "Resource has been exhausted (e.g. check quota).",
        "status": "RESOURCE_EXHAUSTED",
        "details": [
          {
            "@type": "type.googleapis.com/google.rpc.ErrorInfo",
            "reason": "PUBLIC_ERROR_PER_MODEL_DAILY_QUOTA_REACHED_UPGRADEABLE",
            "metadata": {
              "canUpgradeForQuota": "true"
            }
          }
        ]
      },
      "captcha": {
        "service": "EzCaptcha",
        "taskId": "e07eb626-a824-40e1-ae03-51a631fbe6ef",
        "durationMs": 3519,
        "attempts": [
          {
            "service": "EzCaptcha",
            "taskId": "e07eb626-a824-40e1-ae03-51a631fbe6ef",
            "durationMs": 3519,
            "success": true
          }
        ]
      }
    }
    

Model

  • encodedImage - Base64-encoded upscaled image data (JPEG format)
  • captcha - Captcha metadata for debugging/research
  • captcha.service - Provider that returned the successful token
  • captcha.taskId - Task ID from the captcha service
  • captcha.durationMs - Total time for all captcha attempts
  • captcha.attempts - Array of all captcha attempts (including failures)
{
  encodedImage: string                // Base64-encoded image (decode and save as .jpg)
  captcha?: {                         // Captcha metadata
    service: string                   // "EzCaptcha" | "CapSolver" | "YesCaptcha"
    taskId: string
    durationMs: number
    attempts: Array<{
      service: string
      taskId?: string
      durationMs: number
      success: boolean
      error?: string
    }>
  }
  error?: string | {                  // Error: string (useapi.net) or object (Google API)
    code: number
    message: string
    status: string
    details: Array<{
      '@type': string
      reason: string
    }>
  }
}

Examples

  • # First generate an image
    curl -X POST \
         -H "Authorization: Bearer YOUR_API_TOKEN" \
         -H "Content-Type: application/json" \
         -d '{"prompt": "A beautiful sunset over mountains"}' \
         "https://api.useapi.net/v1/google-flow/images" > generate.json
    
    # Extract mediaGenerationId from the response
    MEDIA_ID=$(jq -r '.media[0].image.generatedImage.mediaGenerationId' generate.json)
    
    # Upscale the image to 2K
    curl -X POST \
         -H "Authorization: Bearer YOUR_API_TOKEN" \
         -H "Content-Type: application/json" \
         -d "{\"mediaGenerationId\": \"$MEDIA_ID\", \"resolution\": \"2k\"}" \
         "https://api.useapi.net/v1/google-flow/images/upscale" > upscale.json
    
    # Decode base64 and save as image
    jq -r '.encodedImage' upscale.json | base64 -d > upscaled_image.jpg
    
  • const token = 'YOUR_API_TOKEN';
    
    // First generate an image
    const generateResponse = await fetch('https://api.useapi.net/v1/google-flow/images', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        prompt: 'A beautiful sunset over mountains'
      })
    });
    
    const generated = await generateResponse.json();
    const mediaGenerationId = generated.media[0].image.generatedImage.mediaGenerationId;
    
    // Upscale the image
    const upscaleResponse = await fetch('https://api.useapi.net/v1/google-flow/images/upscale', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        mediaGenerationId,
        resolution: '2k'
      })
    });
    
    const upscaled = await upscaleResponse.json();
    
    // Decode base64 and save
    const buffer = Buffer.from(upscaled.encodedImage, 'base64');
    require('fs').writeFileSync('upscaled_image.jpg', buffer);
    console.log('Upscaled image saved!');
    
  • import requests
    import base64
    
    token = 'YOUR_API_TOKEN'
    headers = {
        'Authorization': f'Bearer {token}',
        'Content-Type': 'application/json'
    }
    
    # First generate an image
    generate_response = requests.post(
        'https://api.useapi.net/v1/google-flow/images',
        headers=headers,
        json={'prompt': 'A beautiful sunset over mountains'}
    )
    generated = generate_response.json()
    media_generation_id = generated['media'][0]['image']['generatedImage']['mediaGenerationId']
    
    # Upscale the image
    upscale_response = requests.post(
        'https://api.useapi.net/v1/google-flow/images/upscale',
        headers=headers,
        json={
            'mediaGenerationId': media_generation_id,
            'resolution': '2k'
        }
    )
    upscaled = upscale_response.json()
    
    # Decode base64 and save
    image_data = base64.b64decode(upscaled['encodedImage'])
    with open('upscaled_image.jpg', 'wb') as f:
        f.write(image_data)
    print('Upscaled image saved!')
    

Try It