Get Asset Download URL
June 14, 2026
Table of contents
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}
API tokenis required, see Setup useapi.net for details.
Path Parameters
-
mediaGenerationIdis required β themediaGenerationId.mediaGenerationIdvalue returned from POST /assets (URL-encoded).Format:
user:{userid}-email:{hex_encoded_email}-{image|video}:{internal_media_id}. The encodeduser:andemail:segments already identify the owning account, so no separateemailpath parameter is needed.
Responses
-
{ "url": "https://storage.googleapis.com/...signed-url-with-expiry...", "mediaGenerationId": "user:12345-email:6a6f...-image:ff9aa5cc-...redacted..." }Field Description urlSigned 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. mediaGenerationIdEcho of the request path parameter, for convenience when correlating responses. -
The path parameter could not be parsed as a valid
mediaGenerationId, or it is a character/voice reference type (onlyimageandvideoare accepted on this endpoint β use GET /characters/refor GET /voices/reffor those).{ "error": "Invalid mediaGenerationId format: not-a-valid-ref-id" }{ "error": "mediaGenerationId type must be 'image' or 'video', got 'character'" } -
Invalid API token.
{ "error": "Unauthorized" } -
The
mediaGenerationIdbelongs to a different useapi.net user than the one identified by theAuthorizationtoken. EachmediaGenerationIdencodes its owning user id; requests across users are rejected before any Google call is made.{ "error": "Unauthorized access to user:99999 detected in mediaGenerationId" } -
The owning Google Flow account (decoded from the
mediaGenerationId) is not configured for this token.{ "error": "Google Flow account [email protected] not found" } -
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/
emailand 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')