Skip to main content
This endpoint downloads all output files from a completed screenplay extraction task as a single zip archive. The zip contains storyboard files, transcript JSONs, namelist, and/or merged XLSX based on the configuration used when submitting the task.
Pricing:
  • $0.12/1GB download (based on total original file sizes, not compressed zip size)
Response Behavior:
  • Success: Returns zip file stream (binary data) — browser automatically downloads to local storage
  • Error: Returns JSON error — use json() to parse error message
Key Points:
  • Success response is a file (binary data), NOT JSON
  • The zip filename is {task_id}.zip
  • Error response is JSON with error details
  • Task must be in completed status, otherwise an error is returned
  • Check response status before deciding how to handle the response

Code Examples

const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
const API_KEY = "sk-mai-this_a_test_string_please_use_your_generated_key_during_testing";
const fs = require('fs');

const taskId = "ros-sd-20260313-a3f8c2b1";
const response = await fetch(`${BASE_URL}/screenplay/tasks/${taskId}/download`, {
  method: 'GET',
  headers: {
    'Authorization': API_KEY
  }
});

if (response.ok) {
  // Success: save as zip file
  const buffer = await response.arrayBuffer();
  fs.writeFileSync(`${taskId}.zip`, Buffer.from(buffer));
  console.log(`Downloaded ${taskId}.zip`);
} else {
  // Error: parse JSON
  const error = await response.json();
  console.error('Download failed:', error);
}

Path Parameters

ParameterTypeRequiredDescription
task_idstringYesThe screenplay task ID of a completed task

Response

On success, returns a binary zip file stream with the following headers:
HeaderValue
Content-Typeapplication/zip
Content-Dispositionattachment; filename="{task_id}.zip"

Zip File Contents

The zip archive contains the following files based on your task configuration:
Config FlagFiles IncludedDescription
require_json: true*_transcript.json, *_storyboard.json, namelist.jsonPer-episode transcript and storyboard JSONs, plus a global character namelist
require_xlsx: true*.xlsx (per episode)Per-episode storyboard spreadsheets
require_merge_xlsx: truemerged.xlsxSingle merged spreadsheet combining all episodes

Error Responses

ScenarioError Message
Task not found"Task not found for id: {task_id}"
Task not completed"Task is not completed yet, current status: {status}"
No result data"No result data available for this task."
No files found"No downloadable files found for this task."
Insufficient balance"Insufficient balance to download the resource. Please recharge and try again."

Notes

  • The task must be in completed status — check with Get Task Status first
  • Download cost is calculated based on the sum of all individual file sizes (original sizes, not compressed)
  • Files with duplicate names are automatically renamed with a numeric suffix (e.g., file.json, file_1.json)
  • The zip is streamed directly — no intermediate storage is used