# Configure TrueProxies with cURL

> Test TrueProxies with cURL over HTTP or SOCKS5. Configure authentication, country targeting, sticky sessions, timeouts and proxy environment variables.

Source: https://docs.trueproxies.com/integrations/curl/

> **Use your own endpoints**
>
> The examples below use placeholders. Copy the connection host, ports, username, and proxy password from the **Username and password** tab of your service in the dashboard. See [How to connect](https://docs.trueproxies.com/proxy-instructions/how-to-connect/#connection-host-and-ports).

## Basic usage

**HTTP**

```bash
curl -x http://YOUR_HOST:YOUR_HTTP_PORT \
  -U "your_username:your_password" \
  https://httpbin.org/ip
```

**SOCKS5**

```bash
curl --socks5-hostname YOUR_HOST:YOUR_SOCKS_PORT \
  -U "your_username:your_password" \
  https://httpbin.org/ip
```

## Residential IPv4 country targeting

Use the username parameter to target a specific country:

```bash
curl -x http://YOUR_HOST:YOUR_HTTP_PORT \
  -U "your_username-country-us:your_password" \
  https://httpbin.org/ip
```

## Residential IPv4 sticky sessions

Keep the same IP across multiple requests:

```bash
curl -x http://YOUR_HOST:YOUR_HTTP_PORT \
  -U "your_username-session-abc123:your_password" \
  https://httpbin.org/ip
```

## Common options

```bash
# Follow redirects
curl -L -x http://YOUR_HOST:YOUR_HTTP_PORT \
  -U "your_username:your_password" \
  https://example.com

# Set timeout (30 seconds)
curl --max-time 30 -x http://YOUR_HOST:YOUR_HTTP_PORT \
  -U "your_username:your_password" \
  https://httpbin.org/ip

# Save response to file
curl -o response.json -x http://YOUR_HOST:YOUR_HTTP_PORT \
  -U "your_username:your_password" \
  https://httpbin.org/ip

# Verbose output for debugging
curl -v -x http://YOUR_HOST:YOUR_HTTP_PORT \
  -U "your_username:your_password" \
  https://httpbin.org/ip
```

## Environment variables

Set proxy globally for all cURL requests in your shell:

```bash
export http_proxy="http://your_username:your_password@YOUR_HOST:YOUR_HTTP_PORT"
export https_proxy="http://your_username:your_password@YOUR_HOST:YOUR_HTTP_PORT"

# Now all cURL requests use the proxy
curl https://httpbin.org/ip
```

## Related guides

- [Connection and username format](https://docs.trueproxies.com/proxy-instructions/how-to-connect/)
- [HTTP CONNECT and SOCKS5](https://docs.trueproxies.com/proxy-instructions/proxy-protocols/)
- [Trusted IPs](https://docs.trueproxies.com/proxy-instructions/trusted-ips/)
- [Troubleshooting checklist](https://docs.trueproxies.com/support/)
