{
  "info": {
    "name": "Xavira AI",
    "_postman_id": "xavira-ai-collection-v1",
    "description": "Reference Postman collection for the Xavira AI API. Set `apiKey` and `characterId` in the collection variables, then run the requests in order.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://api.xavira.ai", "type": "string" },
    { "key": "apiKey", "value": "xav_live_<your-key-here>", "type": "string" },
    { "key": "characterId", "value": "", "type": "string", "description": "Filled in after Create character runs." },
    { "key": "generationId", "value": "", "type": "string", "description": "Filled in after Generate video runs." }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{apiKey}}", "type": "string" }]
  },
  "item": [
    {
      "name": "Status (public)",
      "request": {
        "auth": { "type": "noauth" },
        "method": "GET",
        "url": { "raw": "{{baseUrl}}/v1/status", "host": ["{{baseUrl}}"], "path": ["v1", "status"] }
      }
    },
    {
      "name": "Characters",
      "item": [
        {
          "name": "Create character (traits mode)",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if (pm.response.code === 201) {",
                  "  const json = pm.response.json();",
                  "  if (json.character_id) {",
                  "    pm.collectionVariables.set('characterId', json.character_id);",
                  "    console.log('characterId set to', json.character_id);",
                  "  }",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"model_id\": \"realistic-sharp-v1\",\n  \"traits\": {\n    \"gender\": \"female\",\n    \"ethnicity\": \"east-asian\",\n    \"ageRange\": \"23-29\",\n    \"hairLength\": \"long\",\n    \"hairColor\": \"black\",\n    \"build\": \"slim\",\n    \"breastSize\": \"medium\"\n  },\n  \"scene\": \"blue eyes, light freckles, soft window light\",\n  \"name\": \"Sora\"\n}"
            },
            "url": { "raw": "{{baseUrl}}/v1/characters", "host": ["{{baseUrl}}"], "path": ["v1", "characters"] }
          }
        },
        {
          "name": "Create character (reference image mode)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"model_id\": \"realistic-sharp-v1\",\n  \"reference_image_url\": \"https://example.com/avatar.jpg\",\n  \"name\": \"Imported\"\n}"
            },
            "url": { "raw": "{{baseUrl}}/v1/characters", "host": ["{{baseUrl}}"], "path": ["v1", "characters"] }
          }
        }
      ]
    },
    {
      "name": "Images",
      "item": [
        {
          "name": "Generate image",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"character_id\": \"{{characterId}}\",\n  \"prompt\": \"sitting in a sunlit kitchen, casual sweater, candid photographic portrait\"\n}"
            },
            "url": { "raw": "{{baseUrl}}/v1/images:generate", "host": ["{{baseUrl}}"], "path": ["v1", "images:generate"] }
          }
        },
        {
          "name": "Generate image (with seed + idempotency)",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Idempotency-Key", "value": "{{$guid}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"character_id\": \"{{characterId}}\",\n  \"prompt\": \"moody low-key studio lighting, leather jacket, three-quarter view\",\n  \"negative_prompt_append\": \"warm tones, daylight\",\n  \"seed\": 12345\n}"
            },
            "url": { "raw": "{{baseUrl}}/v1/images:generate", "host": ["{{baseUrl}}"], "path": ["v1", "images:generate"] }
          }
        }
      ]
    },
    {
      "name": "Videos",
      "item": [
        {
          "name": "Generate video (async)",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if (pm.response.code === 202) {",
                  "  const json = pm.response.json();",
                  "  if (json.generation_id) {",
                  "    pm.collectionVariables.set('generationId', json.generation_id);",
                  "    console.log('generationId set to', json.generation_id);",
                  "  }",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"character_id\": \"{{characterId}}\",\n  \"prompt\": \"slow head turn, gentle smile spreading, hair flowing\",\n  \"callback_url\": \"https://api.yourapp.com/xavira-webhook\"\n}"
            },
            "url": { "raw": "{{baseUrl}}/v1/videos:generate", "host": ["{{baseUrl}}"], "path": ["v1", "videos:generate"] }
          }
        }
      ]
    },
    {
      "name": "Generations",
      "item": [
        {
          "name": "Get generation status",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/v1/generations/{{generationId}}",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "generations", "{{generationId}}"]
            }
          }
        }
      ]
    }
  ]
}
