     [Blog](https://scrapfly.io/blog)   /  [http](https://scrapfly.io/blog/tag/http)   /  [What is HTTP 406 Error? (Not Acceptable)](https://scrapfly.io/blog/posts/what-is-http-error-406-not-acceptable)   # What is HTTP 406 Error? (Not Acceptable)

 by [Mostafa](https://scrapfly.io/blog/author/mostafa) Apr 01, 2026 5 min read [\#http](https://scrapfly.io/blog/tag/http) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fwhat-is-http-error-406-not-acceptable "Share on LinkedIn")    

 

 

   

When working on web scraping or automation, encountering HTTP errors can be frustrating, and HTTP error 406 is one that indicates a mismatch in the type of content being requested.

In this article, we'll explore what HTTP 406 means, the common causes behind it, and whether it could be used as a blocking strategy. We'll also dive into how Scrapfly can help you bypass this error effectively.

## Key Takeaways

Fix 406 not acceptable errors by configuring proper Accept headers (text/html, application/xhtml+xml), language headers (en-US,en;q=0.9), and encoding support (gzip, deflate, br) to successfully access web content.

- HTTP 406 "Not Acceptable" occurs when server cannot deliver content matching the client's Accept- headers
- Common causes include misconfigured Accept, Accept-Language, or Accept-Encoding headers in requests
- Header configuration is crucial - use realistic browser headers like text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
- Language headers should match target region (e.g., en-US,en;q=0.9 for US English content)
- Encoding support should include gzip, deflate, br to match modern browser capabilities
- Content negotiation allows servers to return different formats based on client preferences
- Anti-blocking strategy - 406 errors can sometimes be used as a blocking mechanism by websites
- Scrapfly integration provides built-in header management and proxy rotation to avoid 406 blocks

**Get web scraping tips in your inbox**Trusted by 100K+ developers and 30K+ enterprises. Unsubscribe anytime.





## What is HTTP Error 406?

`406 Not Acceptable` error occurs when the server is unable to deliver a response in a format that matches the criteria defined by the client's `Accept-` headers. Essentially, the server understands the request, but it cannot find a response that fits the content types or formats that the client is willing to accept.

## What are HTTP 406 Error Causes?

The most common cause of a 406 error is misconfigured `Accept-` headers. These headers tell the server what content types the client expects in the response, such as:

- **Accept**: Specifies the expected media type, like `application/json` or `text/html`.
- **Accept-Language**: Indicates the preferred languages for the response, e.g., `en-US`.
- **Accept-Encoding**: Defines the compression formats that the client can handle, like `gzip` or `deflate`.

If the server cannot provide a response that matches the specified `Accept-` headers, it will return a 406 status code.

### Practical Example

Let's explore how to configure headers, specifically `Accept-` headers, in common tools like python's [httpx](https://www.python-httpx.org/) library, and [cURL](https://curl.se/).

cURL

Python (httpx)

Javascript (fetch)

Rust

Go

Ruby (typhoeus)

PHP (guzzle)

bash```bash
curl -H "Accept: application/json" -H "Accept-Language: en-US" https://httpbin.dev/json
```





python```python
import httpx

url = "https://httpbin.dev/json"
headers = {
    "Accept": "application/json",  # Expecting JSON response
    "Accept-Language": "en-US",     # Preferring English
}

response = httpx.get(url, headers=headers)
print(response.status_code)
print(response.text)
```





javascript```javascript
const url = "https://httpbin.dev/json";
const headers = {
    "Accept": "application/json",  // Expecting JSON response
    "Accept-Language": "en-US",    // Preferring English
};

fetch(url, { headers })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
```





rust```rust
use reqwest::header::{ACCEPT, ACCEPT_LANGUAGE};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let client = reqwest::Client::new();
    let response = client
        .get("https://httpbin.dev/json")
        .header(ACCEPT, "application/json")
        .header(ACCEPT_LANGUAGE, "en-US")
        .send()
        .await?;

    println!("Status: {}", response.status());
    println!("Body: {}", response.text().await?);

    Ok(())
}
```





go```go
package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://httpbin.dev/json", nil)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
    req.Header.Add("Accept", "application/json")
    req.Header.Add("Accept-Language", "en-US")

    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println("Status:", resp.Status)
    fmt.Println("Body:", string(body))
}
```





ruby```ruby
require 'typhoeus'

url = "https://httpbin.dev/json"
response = Typhoeus.get(url, headers: {
    "Accept" => "application/json",     # Expecting JSON response
    "Accept-Language" => "en-US"        # Preferring English
})

puts "Status: #{response.code}"
puts "Body: #{response.body}"
```





php```php
<?php
$url = "https://httpbin.dev/json";
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', $url, [
    'headers' => [
        'Accept' => 'application/json',     // Expecting JSON response
        'Accept-Language' => 'en-US',       // Preferring English
    ]
]);

echo "Status: " . $response->getStatusCode() . "\n";
echo "Body: " . $response->getBody();
```







In both examples, the client is requesting a response in `application/json` format and prefers the response language in `en-US`. If the server cannot match these criteria, a 406 error might occur.

To avoid 406 errors, ensure that your `Accept-` headers are set appropriately for the resource you're trying to access.

## 406 in Web Scraping

When it comes to web scraping 406 status code is most commonly encountered when `Accept-` family headers are not provided or misconfigured.

Most HTTP clients do no add default `Accept-` headers, so you need to set them manually. To verify what headers need take a look at how the website behaves in your web browser using [Browser Developer Tools](https://scrapfly.io/blog/answers/browser-developer-tools-in-web-scraping). Using the Network tab, you can see the exact `Accept` \[tref how-to-scrape-hidden-apis "headers your browser is sending" %\] and replicate them in your scrapers.

Alternatively, there's a small possibility that 406 error is returned deliberately by the server to block web scraping and deceive the scraper in thinking there's a technical issue. If that's the case see our guide on [fortifying web scrapers against blocking](https://scrapfly.io/blog/posts/how-to-bypass-anti-bot-protection-when-web-scraping).



## FAQ

How can I debug which Accept headers are causing a 406 error in my web scraper?Use [Browser Developer Tools](https://scrapfly.io/blog/answers/browser-developer-tools-in-web-scraping) to inspect the exact headers your browser sends when accessing the page successfully. Compare those with your scraper's headers to find the mismatch.









## Power Up with Scrapfly



ScrapFly provides [web scraping](https://scrapfly.io/docs/scrape-api/getting-started), [screenshot](https://scrapfly.io/docs/screenshot-api/getting-started), and [extraction](https://scrapfly.io/docs/extraction-api/getting-started) APIs for data collection at scale.

- [Anti-bot protection bypass](https://scrapfly.io/docs/scrape-api/anti-scraping-protection) - scrape web pages without blocking!
- [Rotating residential proxies](https://scrapfly.io/docs/scrape-api/proxy) - prevent IP address and geographic blocks.
- [JavaScript rendering](https://scrapfly.io/docs/scrape-api/javascript-rendering) - scrape dynamic web pages through cloud browsers.
- [Full browser automation](https://scrapfly.io/docs/scrape-api/javascript-scenario) - control browsers to scroll, input and click on objects.
- [Format conversion](https://scrapfly.io/docs/scrape-api/getting-started#api_param_format) - scrape as HTML, JSON, Text, or Markdown.
- [Full screenshot customization](https://scrapfly.io/docs/screenshot-api/getting-started#api_param_capture) - scroll and capture exact areas.
- [Comprehensive options](https://scrapfly.io/docs/screenshot-api/getting-started) - block banners, use dark mode, and more.
- [LLM prompts](https://scrapfly.io/docs/extraction-api/llm-prompt) - extract data or ask questions using LLMs
- [Extraction models](https://scrapfly.io/docs/extraction-api/automatic-ai) - automatically find objects like products, articles, jobs, and more.
- [Extraction templates](https://scrapfly.io/docs/extraction-api/rules-and-template) - extract data using your own specification.
- [Python](https://scrapfly.io/docs/sdk/python) and [Typescript](https://scrapfly.io/docs/sdk/typescript) SDKs, as well as [Scrapy](https://scrapfly.io/docs/sdk/scrapy) and [no-code tool integrations](https://scrapfly.io/docs/integration/getting-started).

## Summary

HTTP 406 errors are caused by a mismatch between the `Accept-` headers sent by the client and the formats the server can deliver. While unlikely, these errors can sometimes be used as a blocking mechanism. Using Scrapfly's advanced tools, including proxy rotation and customizable requests, you can bypass 406 blocks and keep your web scraping running smoothly.



 

   Table of Contents















 

  Table of Contents- [Key Takeaways](#key-takeaways)
- [What is HTTP Error 406?](#what-is-http-error-406)
- [What are HTTP 406 Error Causes?](#what-are-http-406-error-causes)
- [Practical Example](#practical-example)
- [406 in Web Scraping](#406-in-web-scraping)
- [FAQ](#faq)
- [Power Up with Scrapfly](#power-up-with-scrapfly)
- [Summary](#summary)
 
    Join the Newsletter  Get monthly web scraping insights 

 

  



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? Get our newsletter instead. 

 

## Explore this Article with AI

 [ ChatGPT ](https://chat.openai.com/?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fwhat-is-http-error-406-not-acceptable) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fwhat-is-http-error-406-not-acceptable) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fwhat-is-http-error-406-not-acceptable) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fwhat-is-http-error-406-not-acceptable) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fwhat-is-http-error-406-not-acceptable) 



 ## Related Articles

 [  

 http 

### What is HTTP 409 Error? (Conflict)

HTTP status code 409 generally means a conflict or mismatch with the server state. Learn why it happens and how to avoid...

 

 ](https://scrapfly.io/blog/posts/what-is-http-409-status-code-conflict) [  

 http python 

### How to Fix 403 Forbidden Errors When Web Scraping

Learn why web scrapers get 403 Forbidden errors and how to fix them with 7 Python solutions, from headers to TLS fingerp...

 

 ](https://scrapfly.io/blog/posts/403-forbidden-web-scraping) [  

 http 

### What is HTTP 413 Error? (Payload Too Large)

HTTP status code 413 generally means that POST or PUT data is too large. Let's take a look at how to handle this.

 

 ](https://scrapfly.io/blog/posts/http-error-413-payload-too-large) 

  ## Related Questions

- [ Q Web scraping - what is HTTP 520 status code? ](https://scrapfly.io/blog/answers/520-status-code)
- [ Q Web scraping - what is HTTP 403 status code? ](https://scrapfly.io/blog/answers/403-status-code)
- [ Q Web scraping - what is HTTP 499 status code? ](https://scrapfly.io/blog/answers/499-status-code)
- [ Q Web scraping - what is HTTP 503 status code? ](https://scrapfly.io/blog/answers/503-status-code)
 
  



   



 Scale your web scraping effortlessly, **1,000 free credits** [Start Free](https://scrapfly.io/register)