{
  "info": {
    "name": "Markdown Converter API",
    "description": "Complete collection for testing the Markdown Converter API endpoints. Convert any file format to AI-ready Markdown with advanced OCR capabilities.",
    "version": "2.0.0",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_postman_id": "markdown-converter-api-v2"
  },
  "auth": {
    "type": "apikey",
    "apikey": [
      {
        "key": "key",
        "value": "X-API-Key",
        "type": "string"
      },
      {
        "key": "value",
        "value": "{{api_key}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://api.markdownconverters.com"
    },
    {
      "key": "api_key",
      "value": "your-api-key-here",
      "type": "string"
    },
    {
      "key": "org_id",
      "value": "your-org-id",
      "type": "string"
    },
    {
      "key": "user_id",
      "value": "your-user-id",
      "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('Response has correct structure', function () {",
              "    const jsonData = pm.response.json();",
              "    pm.expect(jsonData).to.have.property('status');",
              "    pm.expect(jsonData).to.have.property('version');",
              "    pm.expect(jsonData.status).to.eql('healthy');",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "auth": {
          "type": "noauth"
        },
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{base_url}}/health",
          "host": ["{{base_url}}"],
          "path": ["health"]
        },
        "description": "Check the health status of the API service including database and storage connectivity."
      }
    },
    {
      "name": "Convert Single File (Base64)",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Status code is 200', function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test('Response has conversion data', function () {",
              "    const jsonData = pm.response.json();",
              "    pm.expect(jsonData).to.have.property('conversion_id');",
              "    pm.expect(jsonData).to.have.property('markdown_url');",
              "    pm.expect(jsonData).to.have.property('status');",
              "    pm.expect(jsonData.status).to.eql('success');",
              "    ",
              "    // Store conversion ID for other tests",
              "    pm.collectionVariables.set('conversion_id', jsonData.conversion_id);",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"source_type\": \"file\",\n  \"file\": \"PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CiAgPG1ldGEgY2hhcnNldD0iVVRGLTgiPgogIDxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgsIGluaXRpYWwtc2NhbGU9MS4wIj4KICA8dGl0bGU+U2FtcGxlIEhUTUwgRG9jdW1lbnQ8L3RpdGxlPgo8L2hlYWQ+Cjxib2R5PgogIDxoMT5XZWxjb21lIHRvIE1hcmtkb3duIENvbnZlcnRlciBBUEk8L2gxPgogIDxwPlRoaXMgaXMgYSBzYW1wbGUgSFRNTCBkb2N1bWVudCBmb3IgdGVzdGluZyB0aGUgQVBJLjwvcD4KICA8dWw+CiAgICA8bGk+U3VwcG9ydHMgUERGLCBXT1JELCBIVE1MLCBhbmQgbW9yZTwvbGk+CiAgICA8bGk+QWR2YW5jZWQgT0NSIGNhcGFiaWxpdGllczwvbGk+CiAgICA8bGk+QUktcmVhZHkgTWFya2Rvd24gb3V0cHV0PC9saT4KICA8L3VsPgo8L2JvZHk+CjwvaHRtbD4=\",\n  \"org_id\": \"{{org_id}}\",\n  \"user_id\": \"{{user_id}}\",\n  \"options\": {\n    \"ocr_type\": \"basic\",\n    \"sas_expiry_hours\": 24\n  }\n}"
        },
        "url": {
          "raw": "{{base_url}}/api/v1/convert",
          "host": ["{{base_url}}"],
          "path": ["api", "v1", "convert"]
        },
        "description": "Convert a single file to Markdown using Base64 encoding. This example converts a sample HTML document."
      }
    },
    {
      "name": "Convert from URL",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Status code is 200', function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test('Response has conversion data', function () {",
              "    const jsonData = pm.response.json();",
              "    pm.expect(jsonData).to.have.property('conversion_id');",
              "    pm.expect(jsonData).to.have.property('markdown_url');",
              "    pm.expect(jsonData).to.have.property('status');",
              "    pm.expect(jsonData.status).to.eql('success');",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"source_type\": \"url\",\n  \"source_url\": \"https://httpbin.org/html\",\n  \"org_id\": \"{{org_id}}\",\n  \"user_id\": \"{{user_id}}\",\n  \"options\": {\n    \"ocr_type\": \"basic\",\n    \"sas_expiry_hours\": 24\n  }\n}"
        },
        "url": {
          "raw": "{{base_url}}/api/v1/convert",
          "host": ["{{base_url}}"],
          "path": ["api", "v1", "convert"]
        },
        "description": "Convert content directly from a URL. This example converts a sample HTML page from httpbin.org."
      }
    },
    {
      "name": "File Upload Conversion",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Status code is 200', function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test('Response has conversion data', function () {",
              "    const jsonData = pm.response.json();",
              "    pm.expect(jsonData).to.have.property('conversion_id');",
              "    pm.expect(jsonData).to.have.property('markdown_url');",
              "    pm.expect(jsonData).to.have.property('status');",
              "    pm.expect(jsonData.status).to.eql('success');",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "file",
              "type": "file",
              "src": [],
              "description": "Select a file to upload"
            },
            {
              "key": "org_id",
              "value": "{{org_id}}",
              "type": "text"
            },
            {
              "key": "user_id",
              "value": "{{user_id}}",
              "type": "text"
            },
            {
              "key": "ocr_type",
              "value": "basic",
              "type": "text"
            },
            {
              "key": "sas_expiry_hours",
              "value": "24",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{base_url}}/api/v1/convert/upload",
          "host": ["{{base_url}}"],
          "path": ["api", "v1", "convert", "upload"]
        },
        "description": "Upload and convert a file using multipart/form-data. Select a file in the file field to test."
      }
    },
    {
      "name": "Batch Conversion",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Status code is 200', function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "pm.test('Response has batch data', function () {",
              "    const jsonData = pm.response.json();",
              "    pm.expect(jsonData).to.have.property('batch_id');",
              "    pm.expect(jsonData).to.have.property('conversions');",
              "    pm.expect(jsonData).to.have.property('status');",
              "    pm.expect(jsonData.conversions).to.be.an('array');",
              "    ",
              "    // Store batch ID for other tests",
              "    pm.collectionVariables.set('batch_id', jsonData.batch_id);",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"conversions\": [\n    {\n      \"source_type\": \"file\",\n      \"file\": \"PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CiAgPG1ldGEgY2hhcnNldD0iVVRGLTgiPgogIDx0aXRsZT5GaWxlIDE8L3RpdGxlPgo8L2hlYWQ+Cjxib2R5PgogIDxoMT5GaWxlIDE8L2gxPgogIDxwPlRoaXMgaXMgdGhlIGZpcnN0IGZpbGUgaW4gdGhlIGJhdGNoLjwvcD4KPC9ib2R5Pgo8L2h0bWw+\",\n      \"filename\": \"file1.html\",\n      \"org_id\": \"{{org_id}}\",\n      \"user_id\": \"{{user_id}}\",\n      \"options\": {\n        \"ocr_type\": \"basic\"\n      }\n    },\n    {\n      \"source_type\": \"file\",\n      \"file\": \"PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CiAgPG1ldGEgY2hhcnNldD0iVVRGLTgiPgogIDx0aXRsZT5GaWxlIDI8L3RpdGxlPgo8L2hlYWQ+Cjxib2R5PgogIDxoMT5GaWxlIDI8L2gxPgogIDxwPlRoaXMgaXMgdGhlIHNlY29uZCBmaWxlIGluIHRoZSBiYXRjaC48L3A+CjwvYm9keT4KPC9odG1sPg==\",\n      \"filename\": \"file2.html\",\n      \"org_id\": \"{{org_id}}\",\n      \"user_id\": \"{{user_id}}\",\n      \"options\": {\n        \"ocr_type\": \"basic\"\n      }\n    }\n  ],\n  \"batch_options\": {\n    \"sas_expiry_hours\": 48\n  }\n}"
        },
        "url": {
          "raw": "{{base_url}}/api/v1/convert-batch",
          "host": ["{{base_url}}"],
          "path": ["api", "v1", "convert-batch"]
        },
        "description": "Convert multiple files simultaneously. This example converts two HTML files in a batch."
      }
    },
    {
      "name": "Check Conversion Status",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Status code is 200 or 404', function () {",
              "    pm.expect(pm.response.code).to.be.oneOf([200, 404]);",
              "});",
              "",
              "if (pm.response.code === 200) {",
              "    pm.test('Response has status data', function () {",
              "        const jsonData = pm.response.json();",
              "        pm.expect(jsonData).to.have.property('conversion_id');",
              "        pm.expect(jsonData).to.have.property('status');",
              "    });",
              "}"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{base_url}}/api/v1/conversionstatus/{{conversion_id}}",
          "host": ["{{base_url}}"],
          "path": ["api", "v1", "conversionstatus", "{{conversion_id}}"]
        },
        "description": "Check the status of a specific conversion. Uses the conversion_id from previous conversion requests."
      }
    },
    {
      "name": "Check Batch Status",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Status code is 200 or 404', function () {",
              "    pm.expect(pm.response.code).to.be.oneOf([200, 404]);",
              "});",
              "",
              "if (pm.response.code === 200) {",
              "    pm.test('Response has batch status data', function () {",
              "        const jsonData = pm.response.json();",
              "        pm.expect(jsonData).to.have.property('batch_id');",
              "        pm.expect(jsonData).to.have.property('status');",
              "        pm.expect(jsonData).to.have.property('conversions');",
              "    });",
              "}"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{base_url}}/api/v1/conversionstatus-batch/{{batch_id}}",
          "host": ["{{base_url}}"],
          "path": ["api", "v1", "conversionstatus-batch", "{{batch_id}}"]
        },
        "description": "Check the status of a batch conversion. Uses the batch_id from previous batch conversion requests."
      }
    },
    {
      "name": "Get Usage Statistics",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Status code is 200 or 500', function () {",
              "    pm.expect(pm.response.code).to.be.oneOf([200, 500]);",
              "});",
              "",
              "if (pm.response.code === 200) {",
              "    pm.test('Response has usage data', function () {",
              "        const jsonData = pm.response.json();",
              "        pm.expect(jsonData).to.have.property('total_conversions');",
              "        pm.expect(jsonData).to.have.property('period_days');",
              "    });",
              "}"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{base_url}}/api/v1/usage?days=7",
          "host": ["{{base_url}}"],
          "path": ["api", "v1", "usage"],
          "query": [
            {
              "key": "days",
              "value": "7",
              "description": "Number of days to look back (1-365)"
            }
          ]
        },
        "description": "Get API usage statistics for the specified number of days."
      }
    },
    {
      "name": "Extend SAS URL",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Status code is 200 or 404', function () {",
              "    pm.expect(pm.response.code).to.be.oneOf([200, 404]);",
              "});",
              "",
              "if (pm.response.code === 200) {",
              "    pm.test('Response has extension data', function () {",
              "        const jsonData = pm.response.json();",
              "        pm.expect(jsonData).to.have.property('conversion_id');",
              "        pm.expect(jsonData).to.have.property('markdown_url');",
              "        pm.expect(jsonData).to.have.property('new_expiry');",
              "    });",
              "}"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"conversion_id\": \"{{conversion_id}}\",\n  \"expiry_hours\": 72\n}"
        },
        "url": {
          "raw": "{{base_url}}/api/v1/extend-sas",
          "host": ["{{base_url}}"],
          "path": ["api", "v1", "extend-sas"]
        },
        "description": "Extend the expiry time of download URLs for a conversion. Uses the conversion_id from previous conversion requests."
      }
    }
  ]
}