> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/proxies/residential-proxies/location-settings/geo-hash.md).

# Geo Hash

Use geo hash targeting with Residential Proxies. Learn how to select grid cells from level 1 to level 4 and check the approximate cell sizes.

To get a proxy from a specific geo hash grid cell, add the `geohash` flag to the authorization string. Supported grid cells range from level 1 (biggest) to level 4 (smallest) currently available, for example `9`, `c`, `gc`, `u09`, `drq4`.

Here are a few examples of valid `geohash` values:

* `geohash-9` – a random exit node from a large part of the US and Mexico
* `geohash-c` – northern US and Canada
* `geohash-gc` – Ireland, Northern Ireland, England and Scotland
* `geohash-u09` – Paris
* `geohash-drq4` – most of Nantucket island

The approximate cell sizes by geo hash length are:

<table><thead><tr><th width="185.1640625">Length</th><th width="304.51171875">Approximate cell size</th></tr></thead><tbody><tr><td>1</td><td>≤ 5,000 km × 5,000 km</td></tr><tr><td>2</td><td>≤ 1,250 km × 625 km</td></tr><tr><td>3</td><td>≤ 156 km × 156 km</td></tr><tr><td>4</td><td>≤ 39.1 km × 19.5 km</td></tr></tbody></table>

{% hint style="info" %}
The `geohash` parameter is mutually exclusive with other geo-location parameters, such as continent, country, city, and ZIP/postal code.
{% endhint %}

#### Credentials list example

Example represents a list of credentials that target different geo hash grid cells.

```shellscript
customer-USERNAME-geohash-9:PASSWORD
customer-USERNAME-geohash-gc:PASSWORD
customer-USERNAME-geohash-u09:PASSWORD
customer-USERNAME-geohash-drq4:PASSWORD
```

#### Code examples

In this example, a query to `ip.oxylabs.io/location` is performed from a random IP address within the `u09` geo hash grid cell (Paris):

{% tabs %}
{% tab title="cURL" %}

```shell
curl -x pr.oxylabs.io:7777 -U "customer-USERNAME-geohash-u09:PASSWORD" https://ip.oxylabs.io/location
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$geohash = 'u09';
$proxy = 'pr.oxylabs.io:7777';
$query = curl_init('https://ip.oxylabs.io/location');
curl_setopt($query, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($query, CURLOPT_PROXY, "http://$proxy");
curl_setopt($query, CURLOPT_PROXYUSERPWD, "customer-$username-geohash-$geohash:$password");
$output = curl_exec($query);
curl_close($query);
if ($output)
    echo $output;
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import urllib.request
import random
username = 'USERNAME'
password = 'PASSWORD'
geohash = 'u09'
entry = ('http://customer-%s-geohash-%s:%s@pr.oxylabs.io:7777' %
    (username, geohash, password))
query = urllib.request.ProxyHandler({
    'http': entry,
    'https': entry,
})
execute = urllib.request.build_opener(query)
print(execute.open('https://ip.oxylabs.io/location').read())
```

{% endtab %}

{% tab title="Java" %}

```java
package example;

import org.apache.http.HttpHost;
import org.apache.http.client.fluent.*;

public class Example {
    public static void main(String[] args) throws Exception {
        HttpHost entry = new HttpHost("pr.oxylabs.io", 7777);
        String query = Executor.newInstance()
            .auth(entry, "customer-USERNAME-geohash-u09", "PASS")
            .execute(Request.Get("http://ip.oxylabs.io/location").viaProxy(entry))
            .returnContent().asString();
        System.out.println(query);
    }
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net;

class Example
{
    static void Main()
    {
        var client = new WebClient();
        client.Proxy = new WebProxy("pr.oxylabs.io:7777");
        client.Proxy.Credentials = new NetworkCredential("customer-USERNAME-geohash-u09", "PASSWORD");
        Console.WriteLine(client.DownloadString("https://ip.oxylabs.io/location"));
    }
}
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'uri'
require 'net/http'

uri = URI.parse('https://ip.oxylabs.io/location')
proxy = Net::HTTP::Proxy('pr.oxylabs.io', 7777, 'customer-USERNAME-geohash-u09', 'PASSWORD')

req = Net::HTTP::Get.new(uri.path)

result = proxy.start(uri.host,uri.port) do |http|
    http.request(req)
end

puts result.body

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.oxylabs.io/products/proxies/residential-proxies/location-settings/geo-hash.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
