Premip

Place an order and get your proxies

Read the catalog, quote a package, buy it with your wallet balance or a crypto payment, then create your proxy under the new plan. Includes cancel and refund.

10 min readGET /catalog/productsGET /catalog/locationsPOST /orders/quotePOST /ordersGET /orders/{id}POST /proxiesGET /proxies
On this page

Before you start

  • An API key. See the quickstart.
  • Wallet balance for instant orders, or a crypto wallet to pay a pending order.

1. Read products and locations

Products list their package sizes in plans[].quantity (GB). Locations give the label and country code you pass when ordering. Both routes are public.

curl https://api.premip.com/catalog/products
curl https://api.premip.com/catalog/locations

Example output

mobile [5, 25, 100, 1000]
residential [5, 50, 1000]

2. Quote the order

A quote prices the items and applies a promo code if you send one. Nothing is charged. trafficAmount must be one of the listed package sizes, otherwise you get 400 INVALID_QUANTITY.

curl -X POST https://api.premip.com/orders/quote \
  -H "X-Api-Key: $PREMIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"productId":"mobile","location":"United States","countryCode":"US","trafficAmount":5}]}'

Example output

{ "subtotal": 17.5, "discount": 0, "total": 17.5 }

3. Create the order

If your balance covers the total, the response has status paid and your plan is active. If not, status is pending and payment contains a crypto payment. Pay it, and the order turns paid on confirmation. A paid order creates the plan, not the proxy: you create the proxy in the next steps.

curl -X POST https://api.premip.com/orders \
  -H "X-Api-Key: $PREMIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"productId":"mobile","location":"United States","countryCode":"US","trafficAmount":5}]}'

Example output

PM-482193 paid

4. Wait for a pending order

Poll the payment with ?sync=1 every 30 seconds or slower, then re-read the order. ?sync=1 calls are limited to 30 per 10 minutes per account (429 RATE_LIMITED). Only continue when the order status is paid.

curl "https://api.premip.com/billing/payment-intents/INTENT_ID?sync=1" \
  -H "X-Api-Key: $PREMIP_API_KEY"

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

5. Create your proxy and read its login

Once the order is paid, POST /proxies allocates a proxy under the plan. Pass a country code or a location label. A pay-as-you-go plan includes one proxy, so a second call returns 409 PROXY_LIMIT_REACHED; delete the first with DELETE /proxies/{id} to replace it. GET /proxies lists what you have with host, port and credentials.

curl -X POST https://api.premip.com/proxies \
  -H "X-Api-Key: $PREMIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"location":"US"}'

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

6. Cancel or refund

A pending order can be cancelled, which closes its payment. Your most recent paid order can be refunded to your wallet within 14 days of purchase; the refund revokes the plan and releases its proxies. Older orders cannot be refunded online.

# Pending order
curl -X POST https://api.premip.com/orders/ORDER_ID/cancel \
  -H "X-Api-Key: $PREMIP_API_KEY"

# Latest paid order, within 14 days
curl -X POST https://api.premip.com/orders/ORDER_ID/refund \
  -H "X-Api-Key: $PREMIP_API_KEY"

Complete script

Usage: script <productId> <countryCode> <sizeGB>, for example mobile US 5. It validates the package against the catalog, shows the quote and your balance, places the order, waits if payment is needed, creates the proxy if you have none and lists it.

#!/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"

product=${1:-mobile}; country=${2:-US}; size=${3:-5}

location=$(curl -fsS $API/catalog/locations | jq -r --arg c "$country" '.[] | select(.countryCode == $c) | .label' | head -n1)
[ -n "$location" ] || { echo "Unknown country code $country"; exit 1; }

items=$(jq -n --arg p "$product" --arg l "$location" --arg c "$country" --argjson s "$size" \
  '[{productId: $p, location: $l, countryCode: $c, trafficAmount: $s}]')

echo "Quote: $(curl -fsS -X POST $API/orders/quote -H "$H" -H "Content-Type: application/json" -d "{\"items\": $items}" | jq .total) USD"
echo "Wallet: $(curl -fsS $API/billing/wallet -H "$H" | jq .balance) USD"

order=$(curl -fsS -X POST $API/orders -H "$H" -H "Content-Type: application/json" -d "{\"items\": $items}")
oid=$(echo "$order" | jq -r .id)
status=$(echo "$order" | jq -r .status)
echo "Order $(echo "$order" | jq -r .orderNumber): $status"

if [ "$status" = "pending" ]; then
  pid=$(echo "$order" | jq -r .payment.id)
  echo "Pay in crypto at: $(echo "$order" | jq -r '.payment.checkoutUrl // .payment.address')"
  for i in $(seq 1 180); do
    sleep 30
    curl -fsS "$API/billing/payment-intents/$pid?sync=1" -H "$H" > /dev/null
    status=$(curl -fsS $API/orders/$oid -H "$H" | jq -r .status)
    echo "order: $status"
    [ "$status" = "pending" ] || break
  done
fi
[ "$status" = "paid" ] || { echo "Order ended as $status"; exit 1; }

if [ "$(curl -fsS $API/proxies -H "$H" | jq length)" = "0" ]; then
  curl -fsS -X POST $API/proxies -H "$H" -H "Content-Type: application/json" -d "{\"location\": \"$country\"}" > /dev/null
fi
curl -fsS $API/proxies -H "$H" | jq -r '.[] | [.id, .typeLabel, .location, (.host + ":" + (.port|tostring))] | @tsv'

Troubleshooting

ProblemWhat to do
400 INVALID_QUANTITYtrafficAmount must equal one of the plans[].quantity values of that product.
400 PRODUCT_UNAVAILABLEThe product is listed but not for sale yet. Pick another product from the catalog.
The order stays pendingYour balance did not cover the total, so a crypto payment was created. Pay it using order.payment.checkoutUrl, or top up the wallet and place the order again after cancelling.
409 ORDER_NOT_REFUNDABLEOnly your most recent paid order can be refunded from the API, and only within 14 days. Contact support for anything else.
GET /proxies is empty after the order is paidThat is expected: the order creates the plan, not the proxy. Call POST /proxies with a country code.
400 NO_ACTIVE_PLAN on POST /proxiesThe order is not paid yet, or the plan expired. Check GET /orders/{id} and GET /billing/plan.
409 PROXY_LIMIT_REACHEDYour plan already holds its proxy. Use it, or DELETE /proxies/{id} and create a new one.
409 NO_INVENTORYNo endpoint is free in that location right now. Try another country code or retry later.
429 RATE_LIMITED while waitingYou polled with ?sync=1 more than 30 times in 10 minutes. Poll every 30 to 60 seconds, or without sync.

Keep going

All guides

Order proxies with the API — Premip