     [Blog](https://scrapfly.io/blog)   /  [http](https://scrapfly.io/blog/tag/http)   /  [What is HTTP 415 Error? (Unsupported Media Type)](https://scrapfly.io/blog/posts/what-is-http-415-error-unsupported-media-type)   # What is HTTP 415 Error? (Unsupported Media Type)

 by [Mostafa](https://scrapfly.io/blog/author/mostafa) Apr 01, 2026 4 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-415-error-unsupported-media-type "Share on LinkedIn")    

 

 

   

Encountering an HTTP error can disrupt your web scraping or automation tasks, and HTTP error 415 is one such issue that indicates a problem with the type of data being sent.

In this article, we'll explore what HTTP 415 is, the common causes behind it, how to replicate it, and whether it could be used as a blocking mechanism.

## Key Takeaways

Fix HTTP 415 errors by configuring correct Content-Type headers that match server expectations, preventing data format mismatches in web scraping requests.

- Configure Content-Type headers to match server-expected media types (JSON, XML, form-data)
- Inspect browser network requests to identify correct Content-Type for POST/PUT endpoints
- Implement header validation to prevent 415 errors in automated scraping workflows
- Detect anti-scraping blocks when 415 errors occur on GET requests or inconsistently
- Use specialized tools like ScrapFly for automated header management and anti-blocking features
- Debug 415 errors by comparing successful browser requests with scraper implementations

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





## What is HTTP Error 415?

HTTP error 415 `Unsupported Media Type`, occurs when the server refuses to process a request because the format or media type of the data being sent is not supported. For example, if you try to send JSON data to an endpoint that only accepts XML, you would encounter a 415 error.

## What are HTTP 415 Error Causes?

The most common cause of a 415 error is *sending data in an unsupported format*. This can happen when the `Content-Type` header which tells the server what type of content is being sent does not match the type that the server expects.

For instance, if you're sending a POST request with `application/xml` but the server expects `application/json`, you’ll trigger a 415 error.

### Practical Example

Let's explore how to configure headers, specifically `Content-Type` headers, in common tools like python's httpx library, and cURL.

cURL

Python (httpx)

Javascript (fetch)

Rust

Go

Ruby (typhoeus)

PHP (guzzle)

bash```bash
curl -X "POST" -H "Content-Type: application/json" https://httpbin.dev/json
```





python```python
import httpx

url = "https://httpbin.dev/json"
headers = {
    "Content-Type": "application/json",
}

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





javascript```javascript
const url = "https://httpbin.dev/json";
const headers = {
    "Content-Type": "application/json",
};

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





go```go
use reqwest::header::{CONTENT_TYPE};
use std::error::Error;

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

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

    Ok(())
}
```





rust```rust
package main

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

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

    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.post(url, headers: {
    "Content-Type" => "application/json"
})

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





php```php
<?php
$url = "https://httpbin.dev/json";
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', $url, [
    'headers' => [
        'Content-Type' => 'application/json',
    ]
]);

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







In the examples above, the client is specifying that the body content is in `application/json` format. If the server expects a different media-type than the one that the client specified, a 415 error might occur.

To avoid 415 errors, ensure that your `Content-Type` header is set appropriately for the endpoint your are sending data to.

Note that many HTTP clients either do no set `Conten-Type` header or set it to `plain/text` by default which is the most common cause of the 415 status code.

## 415 in Web Scraping

Http status 415 in web scraping is usually encountered when scraping `POST` or `PUT` type endpoints like search queries or form submissions. For these cases it's important to set the correct `Content-Type` header that not only matches the sent content type but the type server expects. To verify what content type the server expects, you can use [Browser Developer Tools](https://scrapfly.io/blog/answers/browser-developer-tools-in-web-scraping) and inspect browser requests.

Another posibility is that the server is blocking your scraper requests and returns status code 415 purposefully to block your scraper. This is quite rare but here are some indicators that http code 415 is a block:

- 415 is returned on `GET` or `HEAD` requests
- 415 error cannot be replicated for the same identical requests

If you suspect that you are being blocked take a look at our [guide on web scraping blocking](https://scrapfly.io/blog/posts/how-to-bypass-anti-bot-protection-when-web-scraping) or try Scrapfly Web Scraping API.

## Power Up with Scrapfly

Learn more about [Web Scraping API](https://scrapfly.io/web-scraping-api) and how it works.



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).

## FAQ

How is HTTP 415 different from HTTP 405 Method Not Allowed?While [HTTP 405](https://scrapfly.io/blog/posts/what-is-http-405-error) occurs when you use the wrong HTTP method (e.g., GET instead of POST), HTTP 415 occurs when the request body format or `Content-Type` header does not match what the server expects. Both can appear during web scraping, especially when interacting with APIs.









## Summary

HTTP 415 errors occur when the data format or media type is not supported by the server. While this error usually results from incorrect content types, it’s important to consider the possibility of blocking. With Scrapfly’s advanced scraping tools and IP rotation, you can bypass such blocks and continue scraping without interruptions.



 

    Table of Contents- [Key Takeaways](#key-takeaways)
- [What is HTTP Error 415?](#what-is-http-error-415)
- [What are HTTP 415 Error Causes?](#what-are-http-415-error-causes)
- [Practical Example](#practical-example)
- [415 in Web Scraping](#415-in-web-scraping)
- [Power Up with Scrapfly](#power-up-with-scrapfly)
- [FAQ](#faq)
- [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-415-error-unsupported-media-type) [ 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-415-error-unsupported-media-type) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fwhat-is-http-415-error-unsupported-media-type) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fwhat-is-http-415-error-unsupported-media-type) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fwhat-is-http-415-error-unsupported-media-type) 



 ## Related Articles

 [  

 http api 

### What HTTP Error 412 Precondition Failed and How to Fix it?

Quick look at HTTP status code 412 - what does it mean, its common causes, and how it can be prevented.

 

 ](https://scrapfly.io/blog/posts/what-is-http-412-error-precondition-failed) [  

 http 

### Guide to Cloudflare's Error Code 520 and How to Fix it

Quick look at error code 520, what does it mean, its common causes, and how it can be prevented.

 

 ](https://scrapfly.io/blog/posts/guide-to-error-code-520-cloudflare-and-fixes) [  

 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) 

  ## Related Questions

- [ Q Web scraping - what is HTTP 520 status code? ](https://scrapfly.io/blog/answers/520-status-code)
- [ Q How to get file type of an URL in Python? ](https://scrapfly.io/blog/answers/how-to-get-url-filetype-in-python)
- [ 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)
 
  



   



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