{
  "info": {
    "name": "Valossa Core API",
    "description": "Valossa AI video analysis API. Submit videos, poll for completion, and download rich AI-generated metadata.\n\n**Setup:**\n1. Set the `api_key` collection variable to your Valossa API key\n2. Get a free API key at https://valossa.com/transcribe-video-to-text-ai/\n3. Run 'New Job' — the `job_id` is saved automatically by the test script\n\n**Docs:** https://docs.valossa.com",
    "version": "1.0.0",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://api-eu.valossa.com/core/1.0",
      "type": "string"
    },
    {
      "key": "api_key",
      "value": "YOUR_API_KEY",
      "type": "string",
      "description": "Your Valossa API key — get one free at https://valossa.com/transcribe-video-to-text-ai/"
    },
    {
      "key": "job_id",
      "value": "",
      "type": "string",
      "description": "Automatically saved after running New Job (via test script)"
    },
    {
      "key": "video_url",
      "value": "https://upload.wikimedia.org/wikipedia/commons/transcoded/c/c0/Big_Buck_Bunny_4K.webm/Big_Buck_Bunny_4K.webm.480p.vp9.webm",
      "type": "string",
      "description": "Public URL of the video to analyze"
    },
    {
      "key": "upload_id",
      "value": "",
      "type": "string",
      "description": "Set from initialize_file_upload response for chunked upload flow"
    },
    {
      "key": "file_size_bytes",
      "value": "12740839",
      "type": "string",
      "description": "Total file size for initialize_file_upload"
    }
  ],
  "item": [
    {
      "name": "1. New Job — Submit video for analysis",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "var jsonData = pm.response.json();",
              "if (jsonData.job_id) {",
              "    pm.collectionVariables.set('job_id', jsonData.job_id);",
              "    console.log('job_id saved:', jsonData.job_id);",
              "}"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"api_key\": \"{{api_key}}\",\n  \"media\": {\n    \"video\": {\n      \"url\": \"{{video_url}}\"\n    },\n    \"title\": \"My Test Video\",\n    \"language\": \"en-US\"\n  }\n}"
        },
        "url": {
          "raw": "{{base_url}}/new_job",
          "host": ["{{base_url}}"],
          "path": ["new_job"]
        },
        "description": "Submits a video for AI analysis. The test script automatically saves the returned `job_id` to the collection variable so subsequent requests work without manual copying."
      },
      "response": [
        {
          "name": "Success — Job created",
          "status": "OK",
          "code": 200,
          "body": "{\n  \"job_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\"\n}"
        }
      ]
    },
    {
      "name": "2. Job Status — Poll for completion",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{base_url}}/job_status?api_key={{api_key}}&job_id={{job_id}}",
          "host": ["{{base_url}}"],
          "path": ["job_status"],
          "query": [
            { "key": "api_key", "value": "{{api_key}}" },
            { "key": "job_id", "value": "{{job_id}}" }
          ]
        },
        "description": "Poll this until `status` is `\"finished\"`. Use `poll_again_after_seconds` to know when to poll again."
      },
      "response": [
        {
          "name": "Processing",
          "status": "OK",
          "code": 200,
          "body": "{\n  \"job_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n  \"status\": \"processing\",\n  \"media_transfer_status\": \"finished\",\n  \"details\": null,\n  \"poll_again_after_seconds\": 30\n}"
        },
        {
          "name": "Finished",
          "status": "OK",
          "code": 200,
          "body": "{\n  \"job_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n  \"status\": \"finished\",\n  \"media_transfer_status\": \"finished\",\n  \"details\": null,\n  \"poll_again_after_seconds\": 0\n}"
        }
      ]
    },
    {
      "name": "3. Job Results — Download Core Metadata",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{base_url}}/job_results?api_key={{api_key}}&job_id={{job_id}}&type=core",
          "host": ["{{base_url}}"],
          "path": ["job_results"],
          "query": [
            { "key": "api_key", "value": "{{api_key}}" },
            { "key": "job_id", "value": "{{job_id}}" },
            { "key": "type", "value": "core" }
          ]
        },
        "description": "Downloads the full Valossa Core Metadata JSON. Change `type` to `frames_faces`, `seconds_objects`, `frames_objects`, `speech_to_text_srt`, `speech_to_text_vtt`, `speech_to_text_ttml`, `speech_to_text_avid_txt`, or `visual_captions` for other result formats. Note: `visual_captions` returns JSON in `selected_sections` with `caption` text and `section.s_start` / `section.s_end` time fields."
      }
    },
    {
      "name": "3b. Job Results — Download SRT Subtitles",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{base_url}}/job_results?api_key={{api_key}}&job_id={{job_id}}&type=speech_to_text_srt",
          "host": ["{{base_url}}"],
          "path": ["job_results"],
          "query": [
            { "key": "api_key", "value": "{{api_key}}" },
            { "key": "job_id", "value": "{{job_id}}" },
            { "key": "type", "value": "speech_to_text_srt" }
          ]
        },
        "description": "Downloads the speech-to-text transcript as an SRT subtitle file."
      }
    },
    {
      "name": "3c. Job Results — Download Face Bounding Boxes",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{base_url}}/job_results?api_key={{api_key}}&job_id={{job_id}}&type=frames_faces",
          "host": ["{{base_url}}"],
          "path": ["job_results"],
          "query": [
            { "key": "api_key", "value": "{{api_key}}" },
            { "key": "job_id", "value": "{{job_id}}" },
            { "key": "type", "value": "frames_faces" }
          ]
        },
        "description": "Downloads per-frame face bounding box coordinates."
      }
    },
    {
      "name": "4. List Jobs",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{base_url}}/list_jobs?api_key={{api_key}}&show_status=true&show_media_info=true&n_jobs=200",
          "host": ["{{base_url}}"],
          "path": ["list_jobs"],
          "query": [
            { "key": "api_key", "value": "{{api_key}}" },
            { "key": "show_status", "value": "true" },
            { "key": "show_media_info", "value": "true" },
            { "key": "n_jobs", "value": "200" }
          ]
        },
        "description": "Lists analysis jobs associated with your API key. Optional query parameters can include job status and media info."
      }
    },
    {
      "name": "5. Cancel Job",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Content-Type", "value": "application/json" }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"api_key\": \"{{api_key}}\",\n  \"job_id\": \"{{job_id}}\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/cancel_job",
          "host": ["{{base_url}}"],
          "path": ["cancel_job"]
        },
        "description": "Cancels a job if it is still in a cancellable state (queued or early processing)."
      }
    },
    {
      "name": "6. Delete Job",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Content-Type", "value": "application/json" }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"api_key\": \"{{api_key}}\",\n  \"job_id\": \"{{job_id}}\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/delete_job",
          "host": ["{{base_url}}"],
          "path": ["delete_job"]
        },
        "description": "Permanently deletes a job and all its associated assets. This cannot be undone."
      }
    },
    {
      "name": "7. Initialize File Upload",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "var jsonData = pm.response.json();",
              "if (jsonData.upload_id) {",
              "    pm.collectionVariables.set('upload_id', jsonData.upload_id);",
              "    console.log('upload_id saved:', jsonData.upload_id);",
              "}"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "POST",
        "body": {
          "mode": "formdata",
          "formdata": [
            { "key": "api_key", "value": "{{api_key}}", "type": "text" },
            { "key": "file_size_bytes", "value": "{{file_size_bytes}}", "type": "text" }
          ]
        },
        "url": {
          "raw": "{{base_url}}/initialize_file_upload",
          "host": ["{{base_url}}"],
          "path": ["initialize_file_upload"]
        },
        "description": "Initializes chunked upload and stores `upload_id` from response."
      }
    },
    {
      "name": "8. Send File Chunk",
      "request": {
        "method": "POST",
        "body": {
          "mode": "formdata",
          "formdata": [
            { "key": "api_key", "value": "{{api_key}}", "type": "text" },
            { "key": "upload_id", "value": "{{upload_id}}", "type": "text" },
            { "key": "chunk_index", "value": "0", "type": "text" },
            { "key": "file_data", "type": "file", "src": "" }
          ]
        },
        "url": {
          "raw": "{{base_url}}/send_file_chunk",
          "host": ["{{base_url}}"],
          "path": ["send_file_chunk"]
        },
        "description": "Sends one file chunk for the active upload_id. Set `file_data` to a chunk file."
      }
    },
    {
      "name": "9. Finalize File Upload",
      "request": {
        "method": "POST",
        "body": {
          "mode": "formdata",
          "formdata": [
            { "key": "api_key", "value": "{{api_key}}", "type": "text" },
            { "key": "upload_id", "value": "{{upload_id}}", "type": "text" }
          ]
        },
        "url": {
          "raw": "{{base_url}}/finalize_file_upload",
          "host": ["{{base_url}}"],
          "path": ["finalize_file_upload"]
        },
        "description": "Finalizes chunked upload and returns `uploaded_file_url` for use in `new_job`."
      }
    }
  ]
}
