{
  "info": {
    "name": "OtomatikEdit API",
    "_postman_id": "otomatikedit-api-v1",
    "description": "Complete API collection for OtomatikEdit - Transform your photos, videos, and music into stunning videos.\n\n## Features\n- Support for images, videos, and ZIP archives\n- 9 professional transitions (including random)\n- Audio fade in/out effects\n- Multiple aspect ratio presets\n- Audio from file or URL\n- Asynchronous job processing\n\n## Base URL\n`https://otomatikedit.online/api`\n\n## Getting Started\n1. Use \"Health Check\" to verify API status\n2. Create a video with \"Create Video\" (supports ZIP archives)\n3. Poll \"Check Status\" until completed\n4. Download with \"Download Video\"\n5. Clean up with \"Delete Job\"\n\n## Media Support\n- **Images:** JPG, PNG, WEBP (max 10MB each)\n- **Videos:** MP4, MOV, AVI, WEBM (max 200MB each)\n- **ZIP Archives:** Automatically extracted, only images/videos processed (max 200MB)\n\n\u00a9 2025 OtomatikEdit. All rights reserved.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "version": "1.0.0"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://otomatikedit.online/api",
      "type": "string"
    },
    {
      "key": "jobId",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Health Check",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test(\"Status code is 200\", function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test(\"API is healthy\", function () {",
              "    var jsonData = pm.response.json();",
              "    pm.expect(jsonData.success).to.be.true;",
              "    pm.expect(jsonData.ffmpeg.installed).to.be.true;",
              "});",
              "",
              "pm.test(\"Response has required fields\", function () {",
              "    var jsonData = pm.response.json();",
              "    pm.expect(jsonData).to.have.property('ffmpeg');",
              "    pm.expect(jsonData).to.have.property('server');",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/video/health",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "video",
            "health"
          ]
        },
        "description": "Check API health status and verify FFmpeg installation.\n\n**Response includes:**\n- FFmpeg version and path\n- Server status and uptime\n- Environment information"
      },
      "response": [
        {
          "name": "Success",
          "originalRequest": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/video/health",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "video",
                "health"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"message\": \"API is healthy\",\n  \"ffmpeg\": {\n    \"installed\": true,\n    \"version\": \"4.4.2\",\n    \"path\": \"/usr/bin/ffmpeg\"\n  },\n  \"server\": {\n    \"name\": \"otomatikedit\",\n    \"version\": \"1.0.0\",\n    \"uptime\": 3600,\n    \"environment\": \"production\"\n  },\n  \"timestamp\": \"2025-10-25T10:30:00.000Z\"\n}"
        }
      ]
    },
    {
      "name": "Create Video - Basic",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test(\"Status code is 200\", function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test(\"Video creation started\", function () {",
              "    var jsonData = pm.response.json();",
              "    pm.expect(jsonData.success).to.be.true;",
              "    pm.expect(jsonData.jobId).to.exist;",
              "    pm.expect(jsonData.status).to.equal('processing');",
              "});",
              "",
              "// Save job ID for other requests",
              "var jsonData = pm.response.json();",
              "if (jsonData.jobId) {",
              "    pm.collectionVariables.set('jobId', jsonData.jobId);",
              "    console.log('Job ID saved:', jsonData.jobId);",
              "}"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "media",
              "type": "file",
              "src": [],
              "description": "Upload media file (Image: JPG, PNG, WEBP | Video: MP4, MOV, AVI, WEBM | ZIP: ZIP archive)"
            },
            {
              "key": "media",
              "type": "file",
              "src": [],
              "description": "Second media file (repeat 'media' field for multiple files)"
            },
            {
              "key": "music",
              "type": "file",
              "src": [],
              "description": "Audio file (MP3, WAV, M4A) - Optional if musicUrl is provided"
            },
            {
              "key": "musicUrl",
              "value": "",
              "type": "text",
              "description": "Direct URL to audio file - Optional if music file is uploaded"
            },
            {
              "key": "duration",
              "value": "30",
              "type": "text",
              "description": "Video duration in seconds (10-300)"
            },
            {
              "key": "aspectPreset",
              "value": "landscape-16-9",
              "type": "text",
              "description": "Video format: landscape-16-9, portrait-9-16, square-1-1, vertical-4-5, linkedin-191-100"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/video/create",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "video",
            "create"
          ]
        },
        "description": "Create a basic video with default settings.\n\n**Required:**\n- `media`: 1-50 media files (images, videos, or ZIP archives)\n  - Repeat `media` field for multiple files\n  - ZIP files are automatically extracted\n- `duration`: 10-300 seconds\n- `music` OR `musicUrl`: Audio file or URL\n\n**Optional:**\n- `aspectPreset`: Video format (default: landscape-16-9)\n- `title`: Custom job title\n- `jobId`: Custom job identifier (UUID)\n\n**Defaults:**\n- `transition`: fade\n- `audioFadeIn`: 0\n- `audioFadeOut`: 3"
      },
      "response": []
    },
    {
      "name": "Create Video - Advanced",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test(\"Status code is 200\", function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test(\"Video creation started\", function () {",
              "    var jsonData = pm.response.json();",
              "    pm.expect(jsonData.success).to.be.true;",
              "    pm.expect(jsonData.jobId).to.exist;",
              "});",
              "",
              "var jsonData = pm.response.json();",
              "pm.collectionVariables.set('jobId', jsonData.jobId);"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "media",
              "type": "file",
              "src": [],
              "description": "Media file (Image, Video, or ZIP)"
            },
            {
              "key": "media",
              "type": "file",
              "src": [],
              "description": "Second media file"
            },
            {
              "key": "media",
              "type": "file",
              "src": [],
              "description": "Third media file (repeat 'media' for multiple files)"
            },
            {
              "key": "music",
              "type": "file",
              "src": [],
              "description": "Audio file (optional if musicUrl provided)"
            },
            {
              "key": "musicUrl",
              "value": "",
              "type": "text",
              "description": "Direct URL to audio file (optional if music file uploaded)"
            },
            {
              "key": "duration",
              "value": "60",
              "type": "text",
              "description": "Video duration (10-300 seconds)"
            },
            {
              "key": "transition",
              "value": "crossfade",
              "type": "text",
              "description": "Options: none, fade, crossfade, dissolve, wipeleft, wiperight, slideup, slidedown, random (different transitions between each clip)"
            },
            {
              "key": "audioFadeIn",
              "value": "2",
              "type": "text",
              "description": "Fade in duration (0-10 seconds)"
            },
            {
              "key": "audioFadeOut",
              "value": "5",
              "type": "text",
              "description": "Fade out duration (0-10 seconds)"
            },
            {
              "key": "loopMusic",
              "value": "false",
              "type": "text",
              "description": "Loop music to match video duration (default: false). If true, music repeats to match video length."
            },
            {
              "key": "loopInstrumental",
              "value": "true",
              "type": "text",
              "description": "Loop instrumental to match video duration (default: true). If false, instrumental stops after one play. Only used when instrumental is provided."
            },
            {
              "key": "aspectPreset",
              "value": "portrait-9-16",
              "type": "text",
              "description": "Video format: landscape-16-9, portrait-9-16, square-1-1, vertical-4-5, linkedin-191-100"
            },
            {
              "key": "title",
              "value": "",
              "type": "text",
              "description": "Custom job title (optional, max 200 chars)"
            },
            {
              "key": "subtitle",
              "type": "file",
              "src": [],
              "description": "Subtitle file (SRT or ASS format, max 5MB)"
            },
            {
              "key": "subtitleContent",
              "value": "",
              "type": "text",
              "description": "Raw subtitle content in SRT format (alternative to file upload)"
            },
            {
              "key": "autoGenerateSubtitles",
              "value": "false",
              "type": "text",
              "description": "Auto-generate subtitles using Whisper AI (default: false)"
            },
            {
              "key": "subtitleLanguage",
              "value": "auto",
              "type": "text",
              "description": "Language for auto-generation: auto (default), en, fr, es, de, it, pt, ar, zh, ja, ko"
            },
            {
              "key": "subtitleOffset",
              "value": "0",
              "type": "text",
              "description": "Subtitle timing offset in seconds (-60 to +60, default: 0)"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/video/create",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "video",
            "create"
          ]
        },
        "description": "Create video with all customization options.\n\n**Media Files:**\n- `media`: 1-50 files (images, videos, or ZIP archives)\n  - Repeat `media` field for multiple files\n  - ZIP files are automatically extracted\n  - Only images/videos from ZIP are processed\n\n**Transitions:**\n- `none`: Direct cut\n- `fade`: Fade to black (default)\n- `crossfade`: Blend between photos\n- `dissolve`: Dissolve effect\n- `wipeleft`, `wiperight`: Wipe transitions\n- `slideup`, `slidedown`: Slide transitions\n- `random`: Different random transition between each clip\n\n**Audio:**\n- `music`: Upload audio file OR\n- `musicUrl`: Direct URL to audio file\n- `audioFadeIn`: 0-10 seconds (default: 0)\n- `audioFadeOut`: 0-10 seconds (default: 3)\n- `loopMusic`: Loop music to match video duration (default: false)\n- `loopInstrumental`: Loop instrumental to match video duration (default: true)\n\n**Subtitles:**\n- `subtitle`: Upload SRT/ASS file OR\n- `subtitleContent`: SRT content as text OR\n- `autoGenerateSubtitles`: Auto-generate with Whisper AI (default: false)\n- `subtitleLanguage`: Language code (default: auto). Options: auto, en, fr, es, de, it, pt, ar, zh, ja, ko\n- `subtitleOffset`: Timing offset in seconds (-60 to +60, default: 0)\n\n**Video Format:**\n- `aspectPreset`: landscape-16-9, portrait-9-16, square-1-1, vertical-4-5, linkedin-191-100\n\n**Optional:**\n- `title`: Custom job title\n- `jobId`: Custom job identifier (UUID)"
      },
      "response": [
        {
          "name": "Success",
          "originalRequest": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "formdata",
              "formdata": []
            },
            "url": {
              "raw": "{{baseUrl}}/video/create",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "video",
                "create"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"jobId\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"status\": \"processing\",\n  \"message\": \"Video creation started\"\n}"
        }
      ]
    },
    {
      "name": "Check Status",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test(\"Status code is 200\", function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test(\"Job exists\", function () {",
              "    var jsonData = pm.response.json();",
              "    pm.expect(jsonData.success).to.be.true;",
              "    pm.expect(jsonData.job).to.exist;",
              "});",
              "",
              "var jsonData = pm.response.json();",
              "console.log('Status:', jsonData.job.status);",
              "console.log('Progress:', jsonData.job.progress + '%');",
              "console.log('Stage:', jsonData.job.stage);",
              "",
              "if (jsonData.job.status === 'completed') {",
              "    console.log('\u2713 Video is ready for download!');",
              "} else if (jsonData.job.status === 'failed') {",
              "    console.log('\u2717 Video creation failed:', jsonData.job.error);",
              "}"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/video/status/:jobId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "video",
            "status",
            ":jobId"
          ],
          "variable": [
            {
              "key": "jobId",
              "value": "{{jobId}}",
              "description": "Job UUID from create endpoint"
            }
          ]
        },
        "description": "Check the status of a video creation job.\n\n**Status Values:**\n- `queued`: Waiting to start\n- `processing`: Video being created\n- `completed`: Ready for download\n- `failed`: Error occurred\n\n**Poll this endpoint every 2-5 seconds until completed.**"
      },
      "response": [
        {
          "name": "Processing",
          "originalRequest": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/video/status/550e8400-e29b-41d4-a716-446655440000",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "video",
                "status",
                "550e8400-e29b-41d4-a716-446655440000"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"job\": {\n    \"jobId\": \"550e8400-e29b-41d4-a716-446655440000\",\n    \"status\": \"processing\",\n    \"progress\": 65,\n    \"stage\": \"Adding audio to video\",\n    \"createdAt\": \"2025-10-25T10:30:00.000Z\"\n  }\n}"
        },
        {
          "name": "Completed",
          "originalRequest": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/video/status/550e8400-e29b-41d4-a716-446655440000",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "video",
                "status",
                "550e8400-e29b-41d4-a716-446655440000"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"job\": {\n    \"jobId\": \"550e8400-e29b-41d4-a716-446655440000\",\n    \"status\": \"completed\",\n    \"progress\": 100,\n    \"stage\": \"Completed\",\n    \"createdAt\": \"2025-10-25T10:30:00.000Z\",\n    \"completedAt\": \"2025-10-25T10:31:30.000Z\",\n    \"processingTime\": 90,\n    \"outputFile\": \"output_550e8400-e29b-41d4-a716-446655440000.mp4\"\n  }\n}"
        }
      ]
    },
    {
      "name": "Download Video",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test(\"Status code is 200\", function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test(\"Response is video file\", function () {",
              "    pm.response.to.have.header('Content-Type', 'video/mp4');",
              "});",
              "",
              "console.log('Video size:', (pm.response.headers.get('Content-Length') / 1024 / 1024).toFixed(2) + ' MB');"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/video/download/:jobId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "video",
            "download",
            ":jobId"
          ],
          "variable": [
            {
              "key": "jobId",
              "value": "{{jobId}}",
              "description": "Job UUID"
            }
          ]
        },
        "description": "Download the completed video file.\n\n**Requirements:**\n- Job status must be `completed`\n\n**Response:**\n- Content-Type: `video/mp4`\n- Binary MP4 file\n\n**Note:** In Postman, use \"Send and Download\" to save the file."
      },
      "response": []
    },
    {
      "name": "List All Jobs",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test(\"Status code is 200\", function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test(\"Response has jobs array\", function () {",
              "    var jsonData = pm.response.json();",
              "    pm.expect(jsonData.success).to.be.true;",
              "    pm.expect(jsonData.jobs).to.be.an('array');",
              "});",
              "",
              "var jsonData = pm.response.json();",
              "console.log('Total jobs:', jsonData.count);",
              "",
              "// Count by status",
              "var completed = jsonData.jobs.filter(j => j.status === 'completed').length;",
              "var processing = jsonData.jobs.filter(j => j.status === 'processing').length;",
              "var failed = jsonData.jobs.filter(j => j.status === 'failed').length;",
              "",
              "console.log('Completed:', completed);",
              "console.log('Processing:', processing);",
              "console.log('Failed:', failed);"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/video/jobs",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "video",
            "jobs"
          ]
        },
        "description": "Get a list of all video creation jobs.\n\n**Returns:**\n- Array of all jobs\n- Job metadata and status\n- Total count\n\n**Use Cases:**\n- Monitor multiple jobs\n- Build admin dashboards\n- Track statistics"
      },
      "response": [
        {
          "name": "Success",
          "originalRequest": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/video/jobs",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "video",
                "jobs"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"count\": 2,\n  \"jobs\": [\n    {\n      \"jobId\": \"550e8400-e29b-41d4-a716-446655440000\",\n      \"status\": \"completed\",\n      \"progress\": 100,\n      \"createdAt\": \"2025-10-25T10:30:00.000Z\"\n    },\n    {\n      \"jobId\": \"660f9511-f3ac-52e5-b827-557766551111\",\n      \"status\": \"processing\",\n      \"progress\": 45,\n      \"createdAt\": \"2025-10-25T11:00:00.000Z\"\n    }\n  ]\n}"
        }
      ]
    },
    {
      "name": "Delete Job",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test(\"Status code is 200\", function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test(\"Job deleted successfully\", function () {",
              "    var jsonData = pm.response.json();",
              "    pm.expect(jsonData.success).to.be.true;",
              "    pm.expect(jsonData.message).to.include('deleted');",
              "});",
              "",
              "var jsonData = pm.response.json();",
              "if (jsonData.spaceFreed) {",
              "    console.log('Space freed:', (jsonData.spaceFreed / 1024 / 1024).toFixed(2) + ' MB');",
              "}"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "DELETE",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/video/:jobId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "video",
            ":jobId"
          ],
          "variable": [
            {
              "key": "jobId",
              "value": "{{jobId}}",
              "description": "Job UUID to delete"
            }
          ]
        },
        "description": "Delete a job and all associated files.\n\n**Deletes:**\n- Job record\n- Uploaded photos\n- Uploaded music\n- Generated video\n\n**Use Cases:**\n- Clean up after download\n- Cancel processing job\n- Free server storage"
      },
      "response": [
        {
          "name": "Success",
          "originalRequest": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/video/550e8400-e29b-41d4-a716-446655440000",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "video",
                "550e8400-e29b-41d4-a716-446655440000"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"message\": \"Job deleted successfully\",\n  \"jobId\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"filesDeleted\": {\n    \"photos\": 5,\n    \"music\": 1,\n    \"video\": 1\n  },\n  \"spaceFreed\": 25165824\n}"
        }
      ]
    },
    {
      "name": "Credits - Get Balance",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test(\"Status code is 200\", function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test(\"Balance data returned\", function () {",
              "    var jsonData = pm.response.json();",
              "    pm.expect(jsonData.success).to.be.true;",
              "    pm.expect(jsonData.data).to.exist;",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{authToken}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/credits/balance",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "credits",
            "balance"
          ]
        },
        "description": "Get the authenticated user's current OtoCredits balance.\n\n**Authentication:** Requires `Authorization: Bearer <token>` header.\n\n**Response:**\n- `creditsEnabled`: Whether the credits feature is enabled\n- `data`: Balance object with subscription credits, bonus credits, and totals"
      },
      "response": [
        {
          "name": "Success",
          "originalRequest": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/credits/balance",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "credits",
                "balance"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"creditsEnabled\": true,\n  \"data\": {\n    \"video\": { \"subscription\": 1200, \"bonus\": 0, \"total\": 1200, \"isUnlimited\": false },\n    \"ai\": { \"subscription\": 10, \"bonus\": 0, \"total\": 10, \"isUnlimited\": false }\n  }\n}"
        }
      ]
    },
    {
      "name": "Credits - Get Packs",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test(\"Status code is 200\", function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test(\"Packs data returned\", function () {",
              "    var jsonData = pm.response.json();",
              "    pm.expect(jsonData.success).to.be.true;",
              "    pm.expect(jsonData.data.videoPacks).to.be.an('array');",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/credits/packs",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "credits",
            "packs"
          ]
        },
        "description": "Get available credit packs for purchase.\n\n**Authentication:** Not required.\n\n**Response:**\n- `creditsEnabled`: Whether the credits feature is enabled\n- `stripeEnabled`: Whether Stripe payments are available\n- `data.videoPacks`: Array of video credit packs\n- `data.aiPacks`: Array of AI credit packs"
      },
      "response": []
    },
    {
      "name": "Credits - History",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test(\"Status code is 200\", function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test(\"History returned\", function () {",
              "    var jsonData = pm.response.json();",
              "    pm.expect(jsonData.success).to.be.true;",
              "    pm.expect(jsonData.data).to.exist;",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{authToken}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/credits/history?limit=50",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "credits",
            "history"
          ],
          "query": [
            {
              "key": "limit",
              "value": "50",
              "description": "Number of records (default: 50)"
            }
          ]
        },
        "description": "Get credit usage history for the authenticated user.\n\n**Authentication:** Required.\n\n**Query:**\n- `limit` (optional): Number of records to return (default: 50)"
      },
      "response": []
    }
  ],
  "auth": {
    "type": "noauth"
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Global pre-request script",
          "console.log('Request to:', pm.request.url.toString());"
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Global test script",
          "pm.test(\"Response time is acceptable\", function () {",
          "    pm.expect(pm.response.responseTime).to.be.below(51790);",
          "});"
        ]
      }
    }
  ]
}