> For the complete documentation index, see [llms.txt](https://docs.talordata.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.talordata.com/proxy/integrations/use-talordata-proxies-with-axios.md).

# Use Talordata Proxies with Axios

Axios is a Promise-based HTTP client widely used for data scraping, API calls, and more. Axios supports setting up a proxy server through its built-in proxy configuration option. Please follow the steps below to configure a proxy (this tutorial applies to the Node.js environment)

{% hint style="success" icon="lightbulb-exclamation-on" %}
Before configuring the proxy, you need to obtain proxies credentials. [Click here](/proxy/rotating-residential-proxies/rotating-residential-proxies-quick-start.md) to learn how to obtain proxies credentials.
{% endhint %}

***

{% stepper %}
{% step %}

### **Install Axios**

Axios can be installed via various package managers depending on your project environment. Please visit the [Axios official documentation](https://axios-http.com/docs/intro) for detailed installation instructions. For example, using npm:

```http
npm install axios
```

{% endstep %}

{% step %}

### **Configure the Proxy**

In your code, you need to create a configuration object containing the proxy information. Replace the placeholders in the template below with your actual credentials:

```javascript
const proxyConfig = {
  host: 'your-proxy-host',  
  port: your-proxy-port,       
  protocol: 'http',       
  auth: {
    username: 'your-username', 
    password: 'your-password'
  }
};      
```

{% endstep %}

{% step %}

### **Use the Proxy in a Request**

Below is a complete example that sends a request to ipinfo.io (which returns the IP information of the request origin) using the configured proxy. Save this code in a file, for example `test-proxy.js`**.**

```javascript
const axios = require('axios');

// Your target URL, here we use http://ipinfo.io/
const targetUrl = 'http://ipinfo.io/';

const proxyConfig = {
  host: 'your-proxy-host',
  port: your-proxy-port,
  protocol: 'http',
  auth: {
    username: 'your-username',
    password: 'your-password'
  }
};

async function fetchData() {
  try {
    // Pass proxyConfig as an option to axios.get
    const response = await axios.get(targetUrl, { proxy: proxyConfig });
    console.log('Success:', response.data);
  } catch (error) {
    console.error('Fail:', error.message);
  }
}

fetchData();
```

{% endstep %}

{% step %}

### Verify the Proxy

In your terminal, navigate to the directory containing your JavaScript file (e.g., `test-proxy.js`) and run the following command (replace `test-proxy.js` with your actual filename if different):

```http
node test-proxy.js
```

If the proxy is configured correctly, you should see output similar to the following:

```javascript
Success: {
  ip: '203.0.113.45',
  city: 'Houston',
  region: 'Texas',
  country: 'US',
  loc: '29.7633,-95.3633',
  org: 'AS174 Cogent Communications, LLC',
  postal: '77002',
  timezone: 'America/Chicago',
  readme: 'https://ipinfo.io/missingauth'
}
```

{% endstep %}
{% endstepper %}

***
