AI Package Actions

One route, several operations: the action field in the body selects create, regenerate, allow download or request an upload URL.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

POST /aiworkflow/aipackage

One route, several operations. The action field — sent in the request body — selects what the call does: create a resource by hand, regenerate it, allow its download, or request a signed upload URL.

Naming: abstract = eBook, mindmap = Mind Map, questions = Quiz.

🚧

action goes in the BODY, not in the query string

Unlike other routes of this API that dispatch on ?action=, here the field is part of the JSON. Sending ?action=regenerate in the URL has no effect — the call falls through to the behaviour without action, which generates the whole package in the old model (and consumes credits).

📘

Authorization

Requires the account API key in the Authorization header, without the Bearer prefix.

Available Operations

actionWhat it doesBody fieldsConsumes credits
createCreates a Mind Map or Quiz by hand, without AIvideo_id, lang, resource, questions, questions_config, mindmapNo
regenerateDeletes and regenerates the resource in the same language, in one callvideo_id, resource, lang + the *_config objectsYes
set_downloadTurns the download of that resource on or offvideo_id, resource, allow_downloadNo
upload_abstract_urlReturns a signed S3 URL to upload an eBook PDFvideo_id, langNo
confirm_abstractConfirms the upload and publishes the uploaded eBookvideo_id, lang, upload_successNo
upload_logo_urlSigned URL for the eBook cover logovideo_id, content_typeNo
upload_abstract_image_urlSigned URL for an image inserted in the editorvideo_id, lang, content_typeNo
(absent)Generates the whole package in the old model (compatibility)video_id, from_lang, type: ALL_TEXT_ITEMSYes

The four upload actions are detailed on Upload an eBook PDF.

Two operations of the same route use other HTTP methods and have their own page:

MethodWhat it doesPage
PUTSaves the edited content of a resource, per languageSave AI Resource Content
DELETERemoves one resource from one languageDelete an AI Resource

HTTP Method & Path

POST /aiworkflow/aipackage

Base URL: https://api-v2.pandavideo.com.br

Authentication Requirements

ItemValue
Security SchemeAPI Key
HeaderAuthorization
FormatThe raw key, without Bearer

Parameters

NameInTypeRequiredDescription
AuthorizationheaderstringYesAccount API key

Request Body

Content-Type: application/json

video_id is required by every action. The remaining fields depend on the action.

action: create — create a resource by hand

Creates a Mind Map or a Quiz with the content you send, without going through the AI and without consuming credits. Useful to import material you already have.

FieldTypeRequiredDescription
actionstringYescreate
video_idstring (uuid)YesVideo the resource belongs to
langstringYesLanguage of the resource (e.g. pt-BR)
resourcestringYesmindmap or questions
questionsarrayConditionalQuestions, when resource is questions
questions_configobjectNoQuiz behaviour
mindmapobjectConditionalMap tree, when resource is mindmap
{
  "action": "create",
  "video_id": "{video_id}",
  "lang": "pt-BR",
  "resource": "questions",
  "questions": [
    {
      "enunciate": "Which vitamin is synthesised through sun exposure?",
      "options": [
        { "text": "Vitamin A", "correct": false },
        { "text": "Vitamin D", "correct": true }
      ]
    }
  ],
  "questions_config": { "num_answers": 2, "allow_skip": false }
}

action: regenerate — regenerate in the same language

Deletes the resource and generates it again, in the same language, in a single call. Consumes credits.

FieldTypeRequiredDescription
actionstringYesregenerate
video_idstring (uuid)YesVideo
resourcestringYesabstract, mindmap or questions
langstringYesLanguage of the resource to regenerate
abstract_configobjectNoeBook layout
mindmap_configobjectNoMind Map appearance
questions_configobjectNoQuiz behaviour
⚠️

An omitted config field reuses the one from the previous generation — it does not reset to defaults.

If the eBook was generated with layout: magazine and you regenerate without sending abstract_config, it comes out magazine again. To go back to defaults, send the object with the values you want explicitly.

{
  "action": "regenerate",
  "video_id": "{video_id}",
  "resource": "abstract",
  "lang": "en",
  "abstract_config": { "layout": "modern", "accent_color": "#3F55EE" }
}

action: set_download — allow or block the download

FieldTypeRequiredDescription
actionstringYesset_download
video_idstring (uuid)YesVideo
resourcestringYesabstract, mindmap or questions
allow_downloadbooleanYestrue allows, false blocks
{
  "action": "set_download",
  "video_id": "{video_id}",
  "resource": "abstract",
  "allow_download": true
}

Response (200):

{ "status": "updated", "resource": "abstract", "allow_download": true }
⚠️

The permission is per resource, not per language. Allowing abstract applies to all languages of that video's eBook. You cannot allow the English eBook while keeping the Portuguese one blocked.

The flag is stored in config.ai.allow_download of GET /videos/{video_id}, keyed by resource — for example { "abstract": true, "questions": false }.

⚠️

set_download does not check whether the resource exists. Calling it for a resource the video does not have still returns 200 and stores the flag, which then applies if that resource is created later. Do not use this call to test whether a resource exists — read config.ai.resources[] instead.

Without action — whole package, old model

Kept for backward compatibility. Generates eBook, Mind Map and Quiz together, in one language, in the v1 format (a file without a language suffix).

FieldTypeRequiredDescription
video_idstring (uuid)YesVideo
from_langstringNoAudio language
typestringNoALL_TEXT_ITEMS
🚧

For new content, prefer POST /aiworkflow, which generates one resource at a time and accepts several languages in to_langs, writing schema_version: 2 in the output file.

Response

The response body depends on the action — the upload actions return the signed URL, set_download returns the updated state, and create and regenerate return the job that was created.

Error Responses

  • 400: unknown action, a field required by the chosen action is missing, or an unknown field inside a *_config (strict object).
  • 401: missing or invalid API key.
  • 402: not enough AI credits (regenerate and package generation).
  • 404: video not found. Note that set_download does not return 404 for a resource that does not exist — see the warning above.
  • 500: internal error.

Validation errors come back as { "errCode": "BadRequest", "errMsg": "..." }, and errMsg names the offending field.

Example Usage

cURL

# Allow the eBook download
curl -X POST "https://api-v2.pandavideo.com.br/aiworkflow/aipackage" \
  -H "Authorization: {api_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "set_download",
    "video_id": "{video_id}",
    "resource": "abstract",
    "allow_download": true
  }'

# Regenerate the Portuguese Quiz
curl -X POST "https://api-v2.pandavideo.com.br/aiworkflow/aipackage" \
  -H "Authorization: {api_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "regenerate",
    "video_id": "{video_id}",
    "resource": "questions",
    "lang": "pt-BR",
    "questions_config": { "num_questions": 5, "num_answers": 4 }
  }'
Body Params
string
enum

Operation to run. Absent means the legacy full package generation.

Allowed:
uuid
required

Video the resource belongs to. Required by every action.

string
enum

Resource the action applies to. Used by create, regenerate and set_download.

Allowed:
string

Language of the resource. Used by create, regenerate, upload_abstract_url, confirm_abstract and upload_abstract_image_url.

questions
array of objects

Quiz questions, when creating a Quiz by hand with action create.

questions
questions_config
object

Quiz behaviour. In the player an absent boolean counts as enabled.

mindmap
object

Mind Map tree, when creating a Mind Map by hand with action create.

mindmap_config
object

Mind Map appearance. On regenerate, an omitted field reuses the value of the previous generation.

abstract_config
object

eBook layout. Strict object: an unknown field returns 400. On regenerate, an omitted field reuses the value of the previous generation.

boolean

Turns the download of that resource on or off. Used by set_download.

boolean

Confirms the PDF was uploaded to the signed URL. Used by confirm_abstract.

string

MIME type of the file to upload. Used by upload_logo_url and upload_abstract_image_url.

string
enum

Legacy field of the full package generation, used when action is absent.

Allowed:
string

Legacy field of the full package generation, used when action is absent.

Responses

401

Missing or invalid API key.

402

Not enough AI credits.

404

Video or resource not found.

500

Internal error.

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json