{
  "info": {
    "name": "HookCloud Partner API · Public Collection",
    "_postman_id": "b432c79f-76cc-48be-95a8-7839d1d1cdee",
    "description": "Coleção pública para a HookCloud Partner API. Use apenas no backend.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "api_base",
      "value": "https://api.hookcloud.app/functions/v1/swift-worker"
    },
    {
      "key": "publishable_key",
      "value": "SUA_PUBLISHABLE_KEY"
    },
    {
      "key": "partner_api_key",
      "value": "hc_partner_live_SUA_CHAVE"
    },
    {
      "key": "instance_id",
      "value": "UUID_DA_INSTANCIA"
    },
    {
      "key": "phone_number_id",
      "value": "PHONE_NUMBER_ID"
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{partner_api_key}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "1 · Upsert customer",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "apikey",
            "value": "{{publishable_key}}",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{api_base}}",
          "host": [
            "{{api_base}}"
          ],
          "query": []
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"route\": \"upsert-partner-customer\",\n  \"external_customer_id\": \"cliente_56790\",\n  \"customer_name\": \"Clínica Mais Vida\",\n  \"customer_email\": \"contato@maisvida.com\",\n  \"customer_phone\": \"5511999999999\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "2 · Create instance",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "apikey",
            "value": "{{publishable_key}}",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{api_base}}",
          "host": [
            "{{api_base}}"
          ],
          "query": []
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"route\": \"create-customer-instance\",\n  \"external_customer_id\": \"cliente_56790\",\n  \"instance_key\": \"cliente_56790-whatsapp-principal\",\n  \"create_connect_session\": true,\n  \"return_url\": \"https://app.seusistema.com/integracoes/whatsapp\",\n  \"success_url\": \"https://partner-connect.hookcloud.app/connect/success\",\n  \"error_url\": \"https://partner-connect.hookcloud.app/connect/error\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "3 · Get instance",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "apikey",
            "value": "{{publishable_key}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{api_base}}?route=get-partner-instance&instance_id={{instance_id}}",
          "host": [
            "{{api_base}}"
          ],
          "query": [
            {
              "key": "route",
              "value": "get-partner-instance"
            },
            {
              "key": "instance_id",
              "value": "{{instance_id}}"
            }
          ]
        }
      }
    },
    {
      "name": "4 · Reveal Meta token",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "apikey",
            "value": "{{publishable_key}}",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{api_base}}",
          "host": [
            "{{api_base}}"
          ],
          "query": []
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"route\": \"reveal-partner-instance-meta-token\",\n  \"phone_number_id\": \"{{phone_number_id}}\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "5 · List templates",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "apikey",
            "value": "{{publishable_key}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{api_base}}?route=list-partner-meta-templates&instance_id={{instance_id}}&status=APPROVED&sendable_only=true",
          "host": [
            "{{api_base}}"
          ],
          "query": [
            {
              "key": "route",
              "value": "list-partner-meta-templates"
            },
            {
              "key": "instance_id",
              "value": "{{instance_id}}"
            },
            {
              "key": "status",
              "value": "APPROVED"
            },
            {
              "key": "sendable_only",
              "value": "true"
            }
          ]
        }
      }
    },
    {
      "name": "6 · Refresh templates",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "apikey",
            "value": "{{publishable_key}}",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{api_base}}",
          "host": [
            "{{api_base}}"
          ],
          "query": []
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"route\": \"refresh-partner-meta-templates\",\n  \"instance_id\": \"{{instance_id}}\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "7 · Report 131049",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "apikey",
            "value": "{{publishable_key}}",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{api_base}}",
          "host": [
            "{{api_base}}"
          ],
          "query": []
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"route\": \"report-partner-message-delivery-failure\",\n  \"phone_number_id\": \"{{phone_number_id}}\",\n  \"message_id\": \"wamid.xxxxx\",\n  \"template_name\": \"campanha_marketing\",\n  \"error_code\": 131049,\n  \"occurred_at\": \"2026-07-21T12:00:00Z\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "8 · Delivery health",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "apikey",
            "value": "{{publishable_key}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{api_base}}?route=get-partner-delivery-health&window_hours=24",
          "host": [
            "{{api_base}}"
          ],
          "query": [
            {
              "key": "route",
              "value": "get-partner-delivery-health"
            },
            {
              "key": "window_hours",
              "value": "24"
            }
          ]
        }
      }
    },
    {
      "name": "9 · Deactivate instance",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "apikey",
            "value": "{{publishable_key}}",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{api_base}}",
          "host": [
            "{{api_base}}"
          ],
          "query": []
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"route\": \"deactivate-partner-instance\",\n  \"instance_id\": \"{{instance_id}}\",\n  \"reason\": \"Cliente cancelou esta linha\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    }
  ]
}