{
  "info": {
    "_postman_id": "412a3cb4-13c0-4de1-9bb3-8e24e7a853ec",
    "name": "Morphly Developers API",
    "description": "Verify Morphly API-key authentication without creating an unmetered provider credential or consuming credits.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "base_url", "value": "https://api.morphly.fun", "type": "string" },
    { "key": "morphly_api_key", "value": "morph_test_REPLACE_ME", "type": "string" },
    { "key": "model", "value": "lucy-2.5", "type": "string" }
  ],
  "item": [
    {
      "name": "1. Health",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('API is operational', function () {",
              "  pm.response.to.have.status(200);",
              "  pm.expect(pm.response.json().status).to.eql('operational');",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": { "raw": "{{base_url}}/v1/health", "host": ["{{base_url}}"], "path": ["v1", "health"] },
        "description": "Confirms that the Morphly API deployment is reachable."
      },
      "response": []
    },
    {
      "name": "2. Validate API key",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Morphly authenticated the key without minting a provider credential', function () {",
              "  pm.response.to.have.status(200);",
              "  const payload = pm.response.json();",
              "  pm.expect(payload.valid).to.eql(true);",
              "  pm.expect(payload.model).to.be.a('string');",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{morphly_api_key}}", "type": "string" }] },
        "method": "GET",
        "header": [],
        "url": { "raw": "{{base_url}}/v1/realtime/validate-key", "host": ["{{base_url}}"], "path": ["v1", "realtime", "validate-key"] },
        "description": "A 200 response with valid=true proves that the key passed backend authentication. This request does not consume credits."
      },
      "response": []
    },
    {
      "name": "3. Reject invalid API key",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Invalid key is rejected', function () {",
              "  pm.response.to.have.status(401);",
              "});"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "morph_test_invalid", "type": "string" }] },
        "method": "GET",
        "header": [],
        "url": { "raw": "{{base_url}}/v1/realtime/validate-key", "host": ["{{base_url}}"], "path": ["v1", "realtime", "validate-key"] },
        "description": "Negative control: proves invalid keys do not reach the Morphly realtime service."
      },
      "response": []
    }
  ]
}
