Premip

Quickstart: from API key to a rotated IP

Create an API key, check your wallet, list your proxies, send a request through one and rotate its exit IP. Takes about five minutes.

5 min readGET /auth/api-key/verifyGET /billing/walletGET /proxiesPOST /api/v1/proxies/{id}/rotate
On this page

Before you start

  • A Premip account with at least one proxy. If you have none yet, follow the orders guide first.
  • curl, or Python 3.9+ with requests, or Node.js 18+.

1. Create an API key

Open Dashboard → Settings → API keys and create a key. The secret starts with premip_ and is shown once. Store it in an environment variable, never in source control.

export PREMIP_API_KEY="premip_YOUR_KEY"

2. Verify the key

This call confirms the key is active and tells you which account it belongs to. A 401 means the key is wrong, revoked or expired.

curl https://api.premip.com/auth/api-key/verify \
  -H "X-Api-Key: $PREMIP_API_KEY"

Example output

{ "valid": true, "email": "[email protected]" }

3. Check your wallet

Orders are paid from your wallet balance. If the balance is low, top it up first.

curl https://api.premip.com/billing/wallet \
  -H "X-Api-Key: $PREMIP_API_KEY"

Example output

{ "balance": 32.5, "currency": "USD" }

4. List your proxies

Each proxy comes with host, port, username and password. Treat the response as a secret because it contains full credentials.

curl https://api.premip.com/proxies \
  -H "X-Api-Key: $PREMIP_API_KEY"

Example output

clx9k2m0a0001 Mobile (shared) United States 203.0.113.24

5. Send a request through a proxy

Build the proxy URL from the fields above and fetch an IP echo service. The address you get back is the proxy exit IP, not yours.

curl -x http://USERNAME:[email protected]:8080 https://api.ipify.org

Example output

203.0.113.24

6. Rotate the exit IP

Rotation gives the same proxy a new exit IP. Host, port and login do not change. One rotation per proxy every 60 seconds by default: a 429 PROXY_ROTATE_COOLDOWN response tells you how long to wait in retryAfterSec.

curl -X POST https://api.premip.com/api/v1/proxies/PROXY_ID/rotate \
  -H "X-Api-Key: $PREMIP_API_KEY"

Example output

{ "id": "clx9k2m0a0001", "currentIp": "198.51.100.77", "cooldownEndsAt": "2026-11-04T09:31:02.000Z" }

Complete script

Runs every step above: lists your proxies, prints the exit IP, rotates it (waiting out any cooldown once) and prints the new IP.

#!/usr/bin/env bash
# Needs curl, jq and awk. Run: PREMIP_API_KEY=premip_... bash script.sh
set -euo pipefail
API=https://api.premip.com
H="X-Api-Key: $PREMIP_API_KEY"

proxy=$(curl -fsS $API/proxies -H "$H" | jq '.[0]')
[ "$proxy" != "null" ] || { echo "No proxies yet. Place an order first."; exit 1; }

id=$(echo "$proxy" | jq -r .id)
url="http://$(echo "$proxy" | jq -r '.username + ":" + .password + "@" + .host + ":" + (.port|tostring)')"

echo "Exit IP: $(curl -fsS -x "$url" https://api.ipify.org)"

rotate() { curl -sS -X POST "$API/api/v1/proxies/$id/rotate" -H "$H" -w '\n%{http_code}'; }
out=$(rotate)
if [ "$(echo "$out" | tail -n1)" = "429" ]; then
  wait=$(echo "$out" | head -n1 | jq -r '.retryAfterSec // 60')
  echo "Cooling down for $wait s"; sleep "$wait"; out=$(rotate)
fi
echo "New exit IP: $(echo "$out" | head -n1 | jq -r .currentIp)"

Troubleshooting

ProblemWhat to do
401 UNAUTHORIZED on every callThe header must be X-Api-Key: premip_… or Authorization: Bearer premip_…. Check for a trailing newline in the variable and that the key was not revoked.
The proxy request hangs or times outHTTP proxies use port 8080 and SOCKS5 uses port 1080 on gw.premip.com. Check that the proxy status is active and, if you use an IP whitelist, that your current IP is on it.
The exit IP did not change after rotatingSticky sessions hold their IP until the TTL ends. Send a new -session-ID value or rotate again after the cooldown. Compare currentIp in the rotate response with your echo service.
429 PROXY_ROTATE_COOLDOWNWait retryAfterSec seconds, or the number in the Retry-After header, then call again.

Keep going

All guides

API quickstart — Premip