How to Rotate Proxies with curl Using Ephemeral Proxies API

Looking to rotate proxies using curl for web scraping, testing, or bypassing geo-restrictions? In this guide, you’ll learn how to use Ephemeral Proxies API to get fresh, short-lived IP addresses and seamlessly send requests through them.

What Are Ephemeral Proxies?

Ephemeral Proxies are short-lived proxies (default TTL is 30 minutes) that auto-rotate. Each call to the API gives you a new proxy ready to use. Choose between residential and datacenter IPs, and optionally extend their lifetime.

Step 1: Get a Proxy from the API

First, sign up and get your API key. Then request a new proxy with:

curl -X 'GET' \
  'https://api.ephemeral-proxies.com/v2/datacenter/proxy' \
  -H 'accept: application/json' \
  -H 'X-API-Key: __YOUR_API_KEY__'

This returns a JSON response like:

{
  "success": true,
  "proxy": {
    "id": "0ec7e9a59422adff4d2954be2fb3a0b4",
    "host": "t4bns.ep-proxy.net",
    "port": 40840,
    "expires_at": "2025-06-15T20:13:03.000Z",
    "whitelisted_ips": [
      "195.20.11.92"
    ],
    "features": {
      "static": true,
      "type": "datacenter",
      "supported_protocols": {
        "socks4": false,
        "socks5": false,
        "http": true,
        "https": true
      }
    },
    "visibility": {
      "ip": "185.81.144.178",
      "country": "Brazil",
      "country_iso": "BR",
      "latitude": -23.5335,
      "longitude": -46.6359,
      "timezone": "America/Sao_Paulo",
      "asn": "AS35830",
      "asn_org": "BTT Group Finance Ltd",
      "region_name": "Sao Paulo",
      "region_code": "SP",
      "city": "São Paulo"
    }
  }
}

Step 2: Use the Proxy with cURL

Send a request through your proxy like this:

curl -x http://t4bns.ep-proxy.net:40840 https://httpbin.org/ip

The response will show the proxy's IP:

{
  "origin": "185.81.144.178"
}

To rotate, just allocate a new proxy using the same API call.

Step 3: Rotate Automatically (Optional Bash Script)

Here's a bash script to allocate and use a new proxy in one step:

#!/bin/bash

API_KEY="YOUR_API_KEY"
HOST="api.ephemeral-proxies.com"

# Allocate new proxy
response=$(curl -s -X GET "https://$HOST/v2/datacenter/proxy" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: __YOUR_API_KEY__")

ip=$(echo $response | jq -r '.proxy.host')
port=$(echo $response | jq -r '.proxy.port')


# Use proxy
curl -x http://$ip:$port https://httpbin.org/ip

Make sure jq is installed to parse the JSON response.

Conclusion

Using curl with the Ephemeral Proxies API makes rotating proxies simple and scalable. Whether you're scraping data or testing geo-blocked content, this setup gives you full control with minimal effort.

Ready to try it out? Get started for free.