{
  "info": {
    "name": "RH7 Proxys API de revenda",
    "description": "Coleção da API de revenda da RH7 Proxys. Troque a variável resellerKey pela sua chave rh7_ (painel > Revenda > Chaves de API). Documentação: https://rh7proxys.com/docs/revenda",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://api.rh7proxys.com",
      "type": "string"
    },
    {
      "key": "resellerKey",
      "value": "rh7_REPLACE_ME",
      "type": "string"
    },
    {
      "key": "subuserId",
      "value": "",
      "type": "string"
    },
    {
      "key": "packageId",
      "value": "",
      "type": "string"
    },
    {
      "key": "orderId",
      "value": "",
      "type": "string"
    },
    {
      "key": "webhookId",
      "value": "",
      "type": "string"
    },
    {
      "key": "proxyUsername",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Conta",
      "item": [
        {
          "name": "Dados da revenda",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/auth/me",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "auth",
                "me"
              ],
              "query": []
            },
            "description": "Revenda e chave usada."
          }
        }
      ]
    },
    {
      "name": "Saldo de GB",
      "item": [
        {
          "name": "Saldo",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/quota/me",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "quota",
                "me"
              ],
              "query": []
            },
            "description": "Saldo de GB da revenda."
          }
        },
        {
          "name": "Pacotes",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pool/packages",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pool",
                "packages"
              ],
              "query": []
            },
            "description": "Pacotes de GB com o preço de revenda."
          }
        },
        {
          "name": "Comprar GB",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pool/orders",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pool",
                "orders"
              ],
              "query": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"package_id\": \"{{packageId}}\",\n  \"payment_method\": \"pix\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Pix sem taxa; cartão e cripto +3,5%. Exige Idempotency-Key."
          }
        },
        {
          "name": "Compras de GB",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pool/orders?limit=20&offset=0",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pool",
                "orders"
              ],
              "query": [
                {
                  "key": "limit",
                  "value": "20"
                },
                {
                  "key": "offset",
                  "value": "0"
                }
              ]
            },
            "description": "Histórico de compras de GB."
          }
        },
        {
          "name": "Status da compra",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pool/orders/{{orderId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pool",
                "orders",
                "{{orderId}}"
              ],
              "query": []
            },
            "description": "Confere o pagamento na hora."
          }
        }
      ]
    },
    {
      "name": "Clientes",
      "item": [
        {
          "name": "Listar clientes",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/subusers",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "subusers"
              ],
              "query": []
            },
            "description": "Clientes ativos."
          }
        },
        {
          "name": "Criar cliente",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/subusers",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "subusers"
              ],
              "query": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Cliente Loja 1\",\n  \"email\": \"cliente@exemplo.com\",\n  \"note\": \"\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Senha e client_api_key aparecem só nesta resposta."
          }
        },
        {
          "name": "Detalhes do cliente",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/subusers/{{subuserId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "subusers",
                "{{subuserId}}"
              ],
              "query": []
            },
            "description": "Cliente e configuração."
          }
        },
        {
          "name": "Mudar cliente",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/subusers/{{subuserId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "subusers",
                "{{subuserId}}"
              ],
              "query": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"country\": \"BR\",\n  \"threads\": 50\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Envie só o que quer mudar."
          }
        },
        {
          "name": "Apagar cliente",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/subusers/{{subuserId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "subusers",
                "{{subuserId}}"
              ],
              "query": []
            },
            "description": "Apaga a proxy; o GB dela é perdido."
          }
        },
        {
          "name": "Credenciais",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/subusers/{{subuserId}}/credentials",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "subusers",
                "{{subuserId}}",
                "credentials"
              ],
              "query": []
            },
            "description": "Usuário e senha da proxy do cliente."
          }
        },
        {
          "name": "Passar GB",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/subusers/{{subuserId}}/allocate-gb",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "subusers",
                "{{subuserId}}",
                "allocate-gb"
              ],
              "query": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"gb\": 10\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "GB inteiro, sai do seu saldo."
          }
        },
        {
          "name": "Consumo pelo usuário",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/usage/user/query?username={{proxyUsername}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "usage",
                "user",
                "query"
              ],
              "query": [
                {
                  "key": "username",
                  "value": "{{proxyUsername}}"
                }
              ]
            },
            "description": "Consumo da proxy pelo usuário."
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "Eventos",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/webhooks/events",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "webhooks",
                "events"
              ],
              "query": []
            },
            "description": "Eventos e assinatura."
          }
        },
        {
          "name": "Listar webhooks",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/webhooks",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "webhooks"
              ],
              "query": []
            },
            "description": "Endereços cadastrados."
          }
        },
        {
          "name": "Cadastrar webhook",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/webhooks",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "webhooks"
              ],
              "query": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"url\": \"https://seusite.com/rh7/avisos\",\n  \"events\": [\n    \"*\"\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "O secret aparece só nesta resposta."
          }
        },
        {
          "name": "Mudar webhook",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/webhooks/{{webhookId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "webhooks",
                "{{webhookId}}"
              ],
              "query": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"active\": true\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "url, events ou active."
          }
        },
        {
          "name": "Apagar webhook",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/webhooks/{{webhookId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "webhooks",
                "{{webhookId}}"
              ],
              "query": []
            },
            "description": "Remove o endereço."
          }
        },
        {
          "name": "Testar webhook",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/webhooks/{{webhookId}}/test",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "webhooks",
                "{{webhookId}}",
                "test"
              ],
              "query": []
            },
            "description": "Envia webhook.test só para este endereço."
          }
        },
        {
          "name": "Limites dos avisos",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/webhooks/settings",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "webhooks",
                "settings"
              ],
              "query": []
            },
            "description": "client_low_gb e pool_low_gb."
          }
        },
        {
          "name": "Mudar limites",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/webhooks/settings",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "webhooks",
                "settings"
              ],
              "query": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"client_low_gb\": 1,\n  \"pool_low_gb\": 10\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "De 0,1 a 1000 GB."
          }
        },
        {
          "name": "Entregas",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/webhooks/deliveries?limit=50",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "webhooks",
                "deliveries"
              ],
              "query": [
                {
                  "key": "limit",
                  "value": "50"
                }
              ]
            },
            "description": "Tentativas de entrega."
          }
        }
      ]
    },
    {
      "name": "Histórico",
      "item": [
        {
          "name": "Chamadas da API",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{resellerKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api-logs?limit=50&offset=0",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api-logs"
              ],
              "query": [
                {
                  "key": "limit",
                  "value": "50"
                },
                {
                  "key": "offset",
                  "value": "0"
                }
              ]
            },
            "description": "Chamadas feitas com a chave."
          }
        }
      ]
    }
  ]
}