{
  "info": {
    "name": "SauBit API",
    "description": "Coleção oficial da SauBit — segurança medicamentosa. Defina as variáveis baseUrl e apiKey (use uma chave sm_test_ para sandbox, que não é cobrada).",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://api.saubit.com.br" },
    { "key": "apiKey", "value": "sm_test_xxx" }
  ],
  "item": [
    {
      "name": "Health",
      "request": { "method": "GET", "url": "{{baseUrl}}/api/v1/health" }
    },
    {
      "name": "Status",
      "request": { "method": "GET", "url": "{{baseUrl}}/api/v1/status" }
    },
    {
      "name": "Interactions - check",
      "request": {
        "method": "POST",
        "header": [
          { "key": "X-API-Key", "value": "{{apiKey}}" },
          { "key": "Content-Type", "value": "application/json" },
          { "key": "Idempotency-Key", "value": "{{$guid}}" }
        ],
        "url": "{{baseUrl}}/api/v1/interactions/check",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"medications\": [\n    { \"name\": \"Varfarina\", \"dose\": 5, \"dose_unit\": \"mg\" },\n    { \"name\": \"Aspirina\", \"dose\": 100, \"dose_unit\": \"mg\" }\n  ],\n  \"patient_record\": { \"conditions\": [\"insuficiência renal\"] },\n  \"language\": \"pt-BR\"\n}"
        }
      }
    },
    {
      "name": "Interactions - batch",
      "request": {
        "method": "POST",
        "header": [
          { "key": "X-API-Key", "value": "{{apiKey}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": "{{baseUrl}}/api/v1/interactions/batch",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"items\": [\n    { \"medications\": [ { \"name\": \"ibuprofeno\" }, { \"name\": \"naproxeno\" } ] },\n    { \"medications\": [ { \"name\": \"paracetamol\" } ] }\n  ]\n}"
        }
      }
    },
    {
      "name": "Interactions - alert decision",
      "request": {
        "method": "POST",
        "header": [
          { "key": "X-API-Key", "value": "{{apiKey}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": "{{baseUrl}}/api/v1/interactions/alerts/decision",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"analysis_id\": \"<analysis_id>\",\n  \"alert_id\": \"<clinical_alert.id>\",\n  \"decision\": \"modified\",\n  \"changed_conduct\": true\n}"
        }
      }
    },
    {
      "name": "Analysis status",
      "request": {
        "method": "GET",
        "header": [ { "key": "X-API-Key", "value": "{{apiKey}}" } ],
        "url": "{{baseUrl}}/api/v1/analyses/<analysis_id>/status"
      }
    },
    {
      "name": "FHIR R4 - $check",
      "request": {
        "method": "POST",
        "header": [
          { "key": "X-API-Key", "value": "{{apiKey}}" },
          { "key": "Content-Type", "value": "application/fhir+json" }
        ],
        "url": "{{baseUrl}}/api/v1/fhir/$check",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"resourceType\": \"Bundle\",\n  \"type\": \"collection\",\n  \"entry\": [\n    { \"resource\": { \"resourceType\": \"MedicationRequest\", \"status\": \"active\", \"medicationCodeableConcept\": { \"text\": \"Ibuprofeno\" } } },\n    { \"resource\": { \"resourceType\": \"Condition\", \"code\": { \"text\": \"Insuficiência renal\" } } }\n  ]\n}"
        }
      }
    },
    {
      "name": "CDS Hooks - discovery",
      "request": { "method": "GET", "url": "{{baseUrl}}/api/v1/cds-services" }
    },
    {
      "name": "CDS Hooks - invoke",
      "request": {
        "method": "POST",
        "header": [
          { "key": "X-API-Key", "value": "{{apiKey}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": "{{baseUrl}}/api/v1/cds-services/saubit-medication-safety",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"hook\": \"medication-prescribe\",\n  \"context\": { \"medications\": { \"resourceType\": \"Bundle\", \"entry\": [ { \"resource\": { \"resourceType\": \"MedicationRequest\", \"status\": \"active\", \"medicationCodeableConcept\": { \"text\": \"Ibuprofeno\" } } } ] } }\n}"
        }
      }
    },
    {
      "name": "HL7 v2 - $check",
      "request": {
        "method": "POST",
        "header": [
          { "key": "X-API-Key", "value": "{{apiKey}}" },
          { "key": "Content-Type", "value": "text/plain" }
        ],
        "url": "{{baseUrl}}/api/v1/hl7v2/$check",
        "body": {
          "mode": "raw",
          "raw": "MSH|^~\\&|EHR|HOSP|SAUBIT|SAUBIT|20260629||RDE^O11|MSG1|P|2.5\rRXE|1|IBUPRO^Ibuprofeno^L|400|||mg"
        }
      }
    },
    {
      "name": "Usage summary",
      "request": {
        "method": "GET",
        "header": [ { "key": "X-API-Key", "value": "{{apiKey}}" } ],
        "url": "{{baseUrl}}/api/v1/usage/summary"
      }
    }
  ]
}
