> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pingnetwork.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Making Requests

This guide covers how to make requests through the Ping Residential Proxy Gateway, including parameter configuration and code examples.

## Basic Request Structure

All requests follow standard HTTP/HTTPS proxy protocols. You'll need to:

1. Specify the proxy endpoint
2. Provide authentication credentials
3. Make your request to the target URL

## Authentication

Authentication is handled through proxy user credentials in the format:

```
USERNAME:PASSWORD
```

To obtain credentials, please contact our support team ([support@pingnetwork.io](mailto:support@pingnetwork.io)).

## Request Parameters

You can customize your proxy requests by adding parameters to the username string. Parameters are separated by hyphens (`-`).

### Username Format

```
USERNAME[-parameter-value]...:PASSWORD
```

### Available Parameters

#### Country Code (`cc`)

Select a specific country for your proxy request.

* **Parameter**: `cc`
* **Format**: ISO Alpha-2 country code (case-insensitive)
* **Example**: `cc-US` for United States, `cc-GB` for United Kingdom

Example username with country selection:

```
USERNAME-cc-US:PASSWORD
```

#### City (`city`)

Target a specific city within a country.

* **Parameter**: `city`
* **Format**: City name in English (case-insensitive)
* **Example**: `city-London`, `city-NewYork`

#### Region (`region`)

Target a specific region or state within a country.

* **Parameter**: `region`
* **Format**: Region/state name in English (case-insensitive, use dots for spaces: new\.hampshire)
* **Example**: `region-california`, `region-new.hampshire`

#### Continent (`continent`)

Target a specific continent for your proxy request.

* **Parameter**: `continent`
* **Format**: Continent name (use dots for spaces: north.america)
* **Example**: `continent-europe`, `continent-north.america`

#### Session ID (`session`)

Maintain the same IP address across multiple requests.

* **Parameter**: `session`
* **Format**: A unique alphanumeric string, 6 to 15 characters long.
* **Session Duration**: from 1 up to 120 minutes
* **Example**: `session-abc123`

#### Session Lifetime (`lifetime`)

Specify the duration for a session in minutes.

* **Parameter**: `lifetime`
* **Format**: Number of minutes (1-120)
* **Default**: 40 minutes if not specified
* **Example**: `lifetime-60`

### Complete Parameter Example

Once all parameters are available, you'll be able to combine them:

```
USERNAME-cc-US-region-California-city-LosAngeles-session-abc123-lifetime-60:PASSWORD
```

## Code Examples

### Random Proxy (Default)

Make a request through a random residential proxy:

#### cURL

```bash theme={null}
curl -x USERNAME:PASSWORD@proxy.pingnetwork.io:7776 https://ipecho.net/plain
```

#### Python (requests)

```python theme={null}
import requests

proxies = {
    'http': 'http://USERNAME:PASSWORD@proxy.pingnetwork.io:7776',
    'https': 'https://USERNAME:PASSWORD@proxy.pingnetwork.io:7777'
}

response = requests.get('https://ipecho.net/plain', proxies=proxies)
print(response.json())
```

#### Node.js (axios)

```javascript theme={null}
const axios = require('axios');
const HttpsProxyAgent = require('https-proxy-agent');

const proxyUrl = 'http://USERNAME:PASSWORD@proxy.pingnetwork.io:7776';
const agent = new HttpsProxyAgent(proxyUrl);

axios.get('https://ipecho.net/plain', { 
    httpsAgent: agent 
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error('Error:', error);
});
```

### Country-Specific Proxy

Route your request through a specific country:

#### cURL

```bash theme={null}
curl -x USERNAME-cc-GB:PASSWORD@proxy.pingnetwork.io:7776 https://ipecho.net/plain
```

#### Python (requests)

```python theme={null}
import requests

# Request through UK proxy
proxies = {
    'http': 'http://USERNAME-cc-GB:PASSWORD@proxy.pingnetwork.io:7776',
    'https': 'https://USERNAME-cc-GB:PASSWORD@proxy.pingnetwork.io:7777'
}

response = requests.get('https://ipecho.net/plain', proxies=proxies)
print(response.json())
```

#### Node.js (axios)

```javascript theme={null}
const axios = require('axios');
const HttpsProxyAgent = require('https-proxy-agent');

// Request through German proxy
const proxyUrl = 'http://USERNAME-cc-DE:PASSWORD@proxy.pingnetwork.io:7776';
const agent = new HttpsProxyAgent(proxyUrl);

axios.get('https://ipecho.net/plain', { 
    httpsAgent: agent 
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error('Error:', error);
});
```

## Response Handling

The proxy gateway returns the response from your target URL unchanged. Handle responses according to your target API's documentation.

### Error Codes

Common proxy-related errors:

* **407 Proxy Authentication Required** - Invalid credentials
* **429 Too Many Requests** - Rate limit exceeded
* **503 Service Unavailable** - No proxies available for the specified parameters

## Best Practices

1. **Use HTTPS endpoint** when possible for better security
2. **Handle errors gracefully** - Implement retry logic for temporary failures
3. **Respect rate limits** - Avoid overwhelming the proxy service
4. **Keep credentials secure** - Never commit credentials to version control

## Need Help?

Contact our support team [support@pingnetwork.io](mailto:support@pingnetwork.io) for:

* Credential requests
* Technical assistance
* Feature requests
