Skip to main content
When SuperAI Flows processes documents, task outputs often include file references as gs:// URLs. These point to files stored in Google Cloud Storage, but you don’t need to understand GCS internals — the File API handles everything. Example gs:// URL in a task output:

Prerequisites

  • curl — for making HTTP requests
  • jq — for parsing JSON in shell scripts (optional, but recommended)
  • A SuperAI Flows API key — get one from the dashboard under Settings → API Keys

Quick start

Download a file in one command:
  • The -L flag tells curl to follow the redirect to the actual download URL.
  • The -f flag makes curl fail with an error instead of saving error responses as your file.

Authentication

Both file endpoints require authentication. You can use either method: About API keys:
  • API keys start with the saf_ prefix (e.g., saf_org_550e8400_abc123...).
  • Get your API key from the dashboard under Settings → API Keys.
  • Store keys in environment variables — never hardcode them in scripts.
About JWT tokens: obtained by authenticating with your email and password. See the API Quickstart. Tokens expire after 1 hour and must be refreshed.

Two ways to download

Option 1: Direct download (GET)

Use GET /api/files/download for the simplest approach. This endpoint redirects you to a temporary signed URL.
If your URI contains special characters, URL-encode it first:
Response: 302 redirect to a pre-signed download URL (valid for 1 hour).

Option 2: Resolve URL first (POST)

Use POST /api/files/resolve when you need the download URL for further processing or want to keep URIs out of server logs.
Then download using the returned URL:

Complete example: download after flow completion

This script executes a flow, waits for completion, and downloads any output files:

Error handling

Example error response:
Include the request_id when contacting support for faster resolution.
Always use -f -L with curl on the GET endpoint: -L follows the redirect to the actual download URL, and -f makes curl return a non-zero exit code on HTTP 4xx/5xx errors instead of silently saving an error response as your output file.

Security

  • Organization-scoped access — You can only download files from flows your organization owns.
  • Temporary URLs — Pre-signed download URLs expire after 1 hour.
  • Path validation — The API rejects path traversal attempts.
  • Bucket validation — Only files from the authorized storage bucket can be accessed.
For sensitive files, prefer POST /api/files/resolve to keep URIs out of server access logs.

FAQ

Currently only gs:// URIs (Google Cloud Storage) are supported.
Pre-signed URLs are valid for 1 hour. Request a new URL if your download fails after this time.
No. You can only download files from flows that belong to your organization.
No — pass the full URI exactly as received from the task output.
Use GET /api/files/download for simple downloads with curl. Use POST /api/files/resolve when you need the URL for programmatic use or want to keep URIs out of logs.
Need help? Email support@super.ai and include your request_id and flow ID.