Get Asset Download URL

June 14, 2026

Table of contents

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

Resolve a signed Google Cloud Storage download URL for an image or video previously uploaded via POST /assets.

Pass the mediaGenerationId you received from the upload response β€” the endpoint returns a signed URL you can fetch directly to read back the original bytes. The signed URL is valid for ~6 hours.

This endpoint accepts only image and video mediaGenerationIds. Character and voice references use GET /characters/ref and GET /voices/ref respectively.

https://api.useapi.net/v1/google-flow/assets/mediaGenerationId

Request Headers

Authorization: Bearer {API token}

Path Parameters

  • mediaGenerationId is required β€” the mediaGenerationId.mediaGenerationId value returned from POST /assets (URL-encoded).

    Format: user:{userid}-email:{hex_encoded_email}-{image|video}:{internal_media_id}. The encoded user: and email: segments already identify the owning account, so no separate email path parameter is needed.

Responses

  • 200 OK

    {
      "url": "https://storage.googleapis.com/...signed-url-with-expiry...",
      "mediaGenerationId": "user:12345-email:6a6f...-image:ff9aa5cc-...redacted..."
    }
    
    Field Description
    url Signed Google Cloud Storage download URL. Fetch this URL directly to retrieve the original uploaded bytes. Valid for ~6 hours. Do not cache the URL itself β€” request a fresh one when needed.
    mediaGenerationId Echo of the request path parameter, for convenience when correlating responses.
  • 400 Bad Request

    The path parameter could not be parsed as a valid mediaGenerationId, or it is a character/voice reference type (only image and video are accepted on this endpoint β€” use GET /characters/ref or GET /voices/ref for those).

    {
      "error": "Invalid mediaGenerationId format: not-a-valid-ref-id"
    }
    
    {
      "error": "mediaGenerationId type must be 'image' or 'video', got 'character'"
    }
    
  • 401 Unauthorized

    Invalid API token.

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

    The mediaGenerationId belongs to a different useapi.net user than the one identified by the Authorization token. Each mediaGenerationId encodes its owning user id; requests across users are rejected before any Google call is made.

    {
      "error": "Unauthorized access to user:99999 detected in mediaGenerationId"
    }
    
  • 404 Not Found

    The owning Google Flow account (decoded from the mediaGenerationId) is not configured for this token.

    {
      "error": "Google Flow account [email protected] not found"
    }
    
  • 502 Bad Gateway

    Google did not return a download URL for the requested media (e.g. the asset no longer exists upstream or Google’s redirect endpoint returned a transient error).

    {
      "error": "Failed to resolve URL for media ff9aa5cc-...redacted..."
    }
    
  • 596 Session Error

    Google session refresh failed. The account needs to be reconfigured. Delete the account using DELETE /accounts/email and add it again by strictly following the procedure in Setup Google Flow.

    {
      "error": "Failed to refresh session: 500 Internal Server Error"
    }
    

Model

{
  url: string                 // Signed GCS download URL, valid for ~6 hours
  mediaGenerationId: string   // Echo of the request path parameter
  error?: string              // Present only on error responses
}

Examples

  • # Step 1: read back an asset uploaded earlier
    MEDIA_GEN_ID='user:12345-email:6a6f...-image:ff9aa5cc-...'
    
    RESP=$(curl -s \
      -H "Authorization: Bearer YOUR_API_TOKEN" \
      "https://api.useapi.net/v1/google-flow/assets/$(printf %s "$MEDIA_GEN_ID" | jq -sRr @uri)")
    
    # Step 2: fetch the signed URL directly to read the bytes
    URL=$(echo "$RESP" | jq -r .url)
    curl -L -o restored.png "$URL"
    
  • const token = 'YOUR_API_TOKEN';
    const mediaGenerationId = 'user:12345-email:6a6f...-image:ff9aa5cc-...';
    
    const apiUrl = `https://api.useapi.net/v1/google-flow/assets/${encodeURIComponent(mediaGenerationId)}`;
    
    const resp = await fetch(apiUrl, {
      headers: { 'Authorization': `Bearer ${token}` }
    });
    const { url } = await resp.json();
    
    // Fetch the signed URL directly to read the bytes
    const dl = await fetch(url);
    const bytes = new Uint8Array(await dl.arrayBuffer());
    console.log(`Downloaded ${bytes.length} bytes`);
    
  • import requests
    from urllib.parse import quote
    
    token = 'YOUR_API_TOKEN'
    media_generation_id = 'user:12345-email:6a6f...-image:ff9aa5cc-...'
    
    api_url = f'https://api.useapi.net/v1/google-flow/assets/{quote(media_generation_id, safe="")}'
    resp = requests.get(api_url, headers={'Authorization': f'Bearer {token}'})
    url = resp.json()['url']
    
    # Fetch the signed URL directly to read the bytes
    dl = requests.get(url)
    with open('restored.png', 'wb') as f:
        f.write(dl.content)
    print(f'Downloaded {len(dl.content)} bytes')
    

Try It