Generate Video GIF

January 20, 2026 (November 16, 2026)

Table of contents

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

Generate an animated GIF preview from a previously generated video. This is a synchronous operation that returns base64-encoded GIF data.

  • No captcha required - this endpoint doesn’t require reCAPTCHA solving.
  • GIF generation can take up to 90 seconds.

https://api.useapi.net/v1/google-flow/videos/gif

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...-video:CAMaJDMx..."
}
  • mediaGenerationId is required. The mediaGenerationId from a previously generated video via POST /videos.

Responses

  • 200 OK

    GIF generated successfully. Returns base64-encoded GIF data.

    {
      "encodedGif": "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7...base64 encoded GIF data...",
      "backend": "flow"
    }
    
  • 400 Bad Request

    Invalid request (missing or invalid mediaGenerationId).

    {
      "error": "Parameter mediaGenerationId is required",
      "code": 400
    }
    

    An image’s mediaGenerationId instead of a video’s:

    {
      "error": "Parameter mediaGenerationId type must be 'video', got 'image'",
      "code": 400
    }
    
  • 401 Unauthorized

    Invalid API token.

    {
      "error": "useapi.net ⁝ Unauthorized",
      "code": 401
    }
    
  • 402 Payment Required

    Your useapi.net subscription is missing or has expired, so nothing was sent to Google. Subscribe or renew it, then send the request again.

    {
      "error": "useapi.net ⁝ Your account has no subscription, please subscribe to our services before submitting requests",
      "code": 402
    }
    

    When the subscription has expired:

    {
      "error": "useapi.net ⁝ Monthly subscription 261008 expired, please renew your subscription before submitting new requests.",
      "code": 402
    }
    
  • 403 Forbidden

    Google refused to make the GIF (PERMISSION_DENIED), so no GIF was made. Google’s answer is passed on as it came, with Google’s reason in details when it gives one.

    {
      "error": {
        "code": 403,
        "message": "flow.google.com QZasKb failed",
        "status": "PERMISSION_DENIED",
        "details": []
      }
    }
    
  • 404 Not Found

    Account not found or video not found.

    {
      "error": "Google Flow account john@gmail.com not found",
      "code": 404
    }
    
  • 429 Too Many Requests

    Google is limiting requests from this account (RESOURCE_EXHAUSTED), so no GIF was made. Wait before you retry. Google’s answer is passed on as it came, with Google’s reason in details when it gives one.

    {
      "error": {
        "code": 429,
        "message": "flow.google.com QZasKb failed",
        "status": "RESOURCE_EXHAUSTED",
        "details": []
      }
    }
    
  • 503 Service Unavailable

    Google Flow could not be reached for this request, so nothing was made. Retry shortly. If Google signed the account out, the API re-verifies it on its own and the account answers 596 meanwhile.

    {
      "error": {
        "code": 503,
        "message": "flow.google.com unavailable for this request — retry",
        "status": "UNAVAILABLE",
        "details": []
      }
    }
    
  • 596 Session Error

    Google rejected the account’s session, and the API is re-verifying the account on its own: retry in about a minute. If Google signed the account out, the account keeps answering 596 and you get a reconnect email: add it again by following Setup Google Flow.

    {
      "error": "Google Flow account john@gmail.com Google rejected this account session (HTTP 401). We are automatically re-verifying it — please retry in about a minute. If the account was signed out, you will receive a reconnect email.",
      "code": 596
    }
    

Model

The GIF as Base64 data, or an error object when the request fails.

The GIF and the error answer, field by field
{
  encodedGif: string                // Base64-encoded GIF data (decode and save as .gif)
  backend: 'flow'                   // the GIF was made on `flow.google.com`
}

When the request fails, the answer is either our own { error, code } or Google’s error object as Google answered it:

{
  error: string | {                 // what went wrong: our own text, or Google's error object when Google refused the request
    code: number                    // HTTP status Google answered, e.g. 404
    message: string                 // the error message
    status: string                  // Google's status name
    details: Array<{                // Google's error details
      '@type': string               // the type name of the detail
      reason: string                // Google's reason code
    }>
  }
  code?: number                     // the HTTP status, with our own text
}

Examples

  • # First generate a video
    curl -X POST \
         -H "Authorization: Bearer YOUR_API_TOKEN" \
         -H "Content-Type: application/json" \
         -d '{"prompt": "A serene mountain landscape at sunset"}' \
         "https://api.useapi.net/v1/google-flow/videos" > generate.json
    
    # Extract mediaGenerationId from the response
    MEDIA_ID=$(jq -r '.media[0].mediaGenerationId' generate.json)
    
    # Generate GIF preview
    curl -X POST \
         -H "Authorization: Bearer YOUR_API_TOKEN" \
         -H "Content-Type: application/json" \
         -d "{\"mediaGenerationId\": \"$MEDIA_ID\"}" \
         "https://api.useapi.net/v1/google-flow/videos/gif" > gif.json
    
    # Decode base64 and save as GIF
    jq -r '.encodedGif' gif.json | base64 -d > video_preview.gif
    
  • const token = 'YOUR_API_TOKEN';
    
    // First generate a video
    const generateResponse = await fetch('https://api.useapi.net/v1/google-flow/videos', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        prompt: 'A serene mountain landscape at sunset'
      })
    });
    
    const generated = await generateResponse.json();
    const mediaGenerationId = generated.media[0].mediaGenerationId;
    
    // Generate GIF preview
    const gifResponse = await fetch('https://api.useapi.net/v1/google-flow/videos/gif', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ mediaGenerationId })
    });
    
    const gifResult = await gifResponse.json();
    
    // Decode base64 and save (Node.js)
    const buffer = Buffer.from(gifResult.encodedGif, 'base64');
    require('fs').writeFileSync('video_preview.gif', buffer);
    console.log('GIF preview saved!');
    
    // Or use in browser as data URL
    const dataUrl = `data:image/gif;base64,${gifResult.encodedGif}`;
    document.getElementById('preview').src = dataUrl;
    
  • import requests
    import base64
    
    token = 'YOUR_API_TOKEN'
    headers = {
        'Authorization': f'Bearer {token}',
        'Content-Type': 'application/json'
    }
    
    # First generate a video
    generate_response = requests.post(
        'https://api.useapi.net/v1/google-flow/videos',
        headers=headers,
        json={'prompt': 'A serene mountain landscape at sunset'}
    )
    generated = generate_response.json()
    media_generation_id = generated['operations'][0]['mediaGenerationId']
    
    # Generate GIF preview
    gif_response = requests.post(
        'https://api.useapi.net/v1/google-flow/videos/gif',
        headers=headers,
        json={'mediaGenerationId': media_generation_id}
    )
    gif_result = gif_response.json()
    
    # Decode base64 and save
    gif_data = base64.b64decode(gif_result['encodedGif'])
    with open('video_preview.gif', 'wb') as f:
        f.write(gif_data)
    print('GIF preview saved!')
    

Try It