Overpass API - Error 406

Since yesterday I get error 406 when I access https://overpass-api.de/api/interpreter with Python.
Does anybody know the reason?

Regards
Ragnar

My code

import requests

overpass_url = “https://overpass-api.de/api/interpreter”
coord = “around:1000,53.55,10.00”  # Koordinaten
overpass_query = f’‘’[out:json][timeout:180];
(
    nwr"memorial"=“stolperstein”;
);
out body;‘’’

headers = {
    ‘Accept’: ‘application/json’,  # Explizit JSON fordern
    ‘Content-Type’: ‘text/plain’   # Query ist Plaintext
}

response = requests.post(overpass_url, data={‘data’: overpass_query}, headers=headers)

print(f"Status: {response.status_code}“)
print(f"Content-Type: {response.headers.get(‘content-type’)}”)

if response.status_code == 200:
    data = response.json()
    print(f"{len(data[‘elements’])} Stolpersteine gefunden!")
else:
    print(“Fehler”, response.text)

Could be related to the new rules implemented yesterday:

2 Likes

Thanks - setting the user-agent in the header solved the problem.

I’ve been having this same problem and tried the same thing, what user-agent did you use?

2 Likes

I use headers like

headers = {

    'Accept': 'application/json',

    'Content-Type': 'text/plain',

    'User-Agent': 'PAWS (mydomain.de)',  

    'Referer': 'http://www.mydomain.de/' 

}

achavi on overpass-api.de is getting 406 Not Acceptable HTTP error responses since around 3 days (see #64 achavi stopped working).

An example request copied from Firefox:

curl 'https://overpass-api.de/api/interpreter?data=[adiff:%222026-06-13T15:20:12Z%22,%222026-06-13T15:20:14Z%22];(node(bbox)(changed);way(bbox)(changed););out%20meta%20geom(bbox);&bbox=9.4848314,47.6649556,9.4848314,47.6649556' \
  --globoff \
  -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0' \
  -H 'Accept: */*' \
  -H 'Accept-Language: de,en-US;q=0.9,en;q=0.8' \
  -H 'Accept-Encoding: gzip, deflate, br, zstd' \
  -H 'DNT: 1' \
  -H 'Sec-GPC: 1' \
  -H 'Connection: keep-alive' \
  -H 'Referer: https://overpass-api.de/achavi/?changeset=184060676' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-origin'

Is there anything wrong or missing?

edit:
also commented at Overpass-API#791 Overpass-Api Not working. Error: 406 Not Acceptable

1 Like

Pass the Overpass request in the body of the POST request, not the URL. You can see an example in wiki Overpass API - OpenStreetMap Wiki or in the browser console when making a request on https://overpass-turbo.eu

2 Likes

Thanks, apparently same-origin GET requests don’t send an Origin header, which seems to be the issue here, I added another comment at #791.

1 Like

Achavi should be working again. Overpass had changed request checking, which is now reverted.

2 Likes

Hi, Norbert,

My joy was short-lived: the same problem again!

When I tried to check my last changeset, once again only your own “replacement page” achavi - Augmented OSM Change Viewer  [attic] worked. The Overpass page (achavi - Augmented OSM Change Viewer  [attic]) loads (too) quickly and then only shows the CS…

Should I open a new issue on GitHub instead? Or is there a way I can contribute in some way, somewhere else?

Best regards from Herborn

Andreas

Note that the main Overpass API servers are again overloaded with requests: osm db request count (Munin :: localdomain :: localhost.localdomain :: osm db request count)

This is an odd graph.

Am I reading correctly that the number of completed Overpass queries has declined substantially over the last year?

I reopened the issue (achavi#64).

For me, achavi works sometimes, then I get the usual “504 Gateway Timeout” error (“The server is probably too busy to handle your request.”), but also still these blocking “406 Not Acceptable” errors.

Gernerally, I would recommend to use OSMCha instead.

Yes, but one must be careful with conclusions.

Just imagine that there are more heavy and long queries. They start to take up time, and the number of completed queries decreases. After this, some users stop using the Overpass API, but the long queries remain and continue to consume CPU…

Let me remind that there is Achavi based on OSMCha data

Indeed. One must also be careful with hypotheses that are unsupported by data.

Ok, I tried to copy Achavi and just replaced the overpass backend (as per @TrickyFoxy s example) as the public instance seems to be quite overloaded.

Please check if https://achavi.hopapi.net is working for you, e.g. achavi - Augmented OSM Change Viewer  [attic]

The overpass backend instance used is currently only accessible via that achavi copy and computes areas once a day while otherwise it is run on minutely diffs (with global planet data).

And the main goal is not to use the overloaded public overpass instance.

2 Likes