"Upgrade Required" (response code 426) when using Data API on a fresh M0 cluster

I’ve been using the Data API for a while now with a microcontroller (Raspberry Pi Pico W) and have this procedure embedded into various tutorials (e.g., 5. Logging Data — ac-microcourses 0.0.post1.dev51+gf0a96a7 documentation), videos, and a manuscript. However, recently the response has changed to (426) “Upgrade Required”. I spent a while trying to figure out if I needed to upgrade the Data API or upgrade the MongoDB Atlas version, and then settled on debugging by creating a new organization, new project, new cluster, etc. Finally, I realized I could run it in regular Python, but not in MicroPython. This appears to be due to the use of HTTP 1.0 protocol instead of HTTP 1.1 or higher [1] [2]. I found the MongoDB docs (Service Limitations), which states:

Data API and HTTPS Endpoints require HTTP/1.1 or greater when making requests.

I’m guessing this changed recently? (Since this has worked fine for me for at least a year)

import requests
import json
url = "https://us-east-2.aws.data.mongodb-api.com/app/data-<APP_ID>/endpoint/data/v1/action/insertOne"

payload = json.dumps({
    "collection": "write-to-me",
    "database": "test-db",
    "dataSource": "Cluster0",
    "projection": {
        "_id": 1
headers = {
  'Content-Type': 'application/json',
  'Access-Control-Request-Headers': '*',
  'api-key': '<API_KEY>,

response = urequests.request("POST", url, headers=headers, data=payload)


I’ve been looking into HTTP 1.1 support from the microcontroller side, but it’s not looking so promising. Open to any thoughts or suggestions here.

I just got the same problem with an ESP32-S3. Your message helped me to understand its cause, thanks!

I could find a workaround…
I created my own requests.py module using the code at:

Then I modified some lines:

  • line 99 : “HTTP/1.1” instead of “HTTP/1.0” to get the requested protocol
    and then I had to replace the tls module (not available in my micropython) by the ssl one
  • line 69 : import ssl
  • lines 96 and 97: ssl instead of tls

My tests where limited to the “insertOne” and “find” functions of the MongoDB data API, which worked fine.

Hope it will help,