{
  "info": {
    "name": "ProFeedback API v1",
    "description": "NPS por API. Preencha base_url e api_key (pf_test_ grava no sandbox). Documentacao: https://profeedback.com.br/docs/",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://api.profeedback.com.br/v1"
    },
    {
      "key": "api_key",
      "value": "pf_test_"
    },
    {
      "key": "customer_id",
      "value": ""
    },
    {
      "key": "webhook_id",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "Clientes",
      "item": [
        {
          "name": "Criar cliente",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customers",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customers"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"external_id\": \"crm-001\",\n  \"name\": \"Maria Souza\",\n  \"phone\": \"11987654321\",\n  \"email\": \"maria@exemplo.com.br\",\n  \"attributes\": {\n    \"plano\": \"Mensal\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Listar clientes",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customers",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customers"
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Buscar por external_id",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customers?external_id=crm-001",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customers"
              ],
              "query": [
                {
                  "key": "external_id",
                  "value": "crm-001"
                }
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Detalhe do cliente",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customers/{{customer_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customers",
                "{{customer_id}}"
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Atualizar cliente",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customers/{{customer_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customers",
                "{{customer_id}}"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Maria S. Souza\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Elegibilidade",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customers/{{customer_id}}/eligibility?days=90",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customers",
                "{{customer_id}}",
                "eligibility"
              ],
              "query": [
                {
                  "key": "days",
                  "value": "90"
                }
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Apagar cliente (soft delete)",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customers/{{customer_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customers",
                "{{customer_id}}"
              ]
            },
            "description": ""
          }
        }
      ]
    },
    {
      "name": "Respostas",
      "item": [
        {
          "name": "Registrar nota",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/responses",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "responses"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"external_id\": \"crm-001\",\n  \"score\": 9,\n  \"comment\": \"Atendimento rapido\",\n  \"source\": \"whatsapp\",\n  \"attributes\": {\n    \"atendente\": \"Ana\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Listar notas",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/responses?from=2026-10-01&to=2026-10-31&category=detractor",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "responses"
              ],
              "query": [
                {
                  "key": "from",
                  "value": "2026-10-01"
                },
                {
                  "key": "to",
                  "value": "2026-10-31"
                },
                {
                  "key": "category",
                  "value": "detractor"
                }
              ]
            },
            "description": ""
          }
        }
      ]
    },
    {
      "name": "Links de pesquisa",
      "item": [
        {
          "name": "Gerar link de pesquisa",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/survey-links",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "survey-links"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"external_id\": \"crm-001\",\n  \"expires_in_days\": 7,\n  \"source\": \"whatsapp\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        }
      ]
    },
    {
      "name": "Metricas e uso",
      "item": [
        {
          "name": "NPS do periodo",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/metrics/nps?from=2026-10-01&to=2026-10-31&group_by=source",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "metrics",
                "nps"
              ],
              "query": [
                {
                  "key": "from",
                  "value": "2026-10-01"
                },
                {
                  "key": "to",
                  "value": "2026-10-31"
                },
                {
                  "key": "group_by",
                  "value": "source"
                }
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Uso do mes",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/usage",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "usage"
              ]
            },
            "description": ""
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "Criar endpoint",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/webhooks",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "webhooks"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"url\": \"https://seu-sistema.exemplo.com.br/profeedback\",\n  \"events\": [\n    \"response.detractor\"\n  ],\n  \"description\": \"Detratores\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Listar endpoints",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/webhooks",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "webhooks"
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Testar endpoint",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/webhooks/{{webhook_id}}/test",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "webhooks",
                "{{webhook_id}}",
                "test"
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Rotacionar segredo",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/webhooks/{{webhook_id}}/rotate-secret",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "webhooks",
                "{{webhook_id}}",
                "rotate-secret"
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Entregas",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/webhooks/deliveries",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "webhooks",
                "deliveries"
              ]
            },
            "description": ""
          }
        }
      ]
    }
  ]
}
