# Why am I getting a 415 Error in Katalon when my JSON body is right there?

**URL:** <https://forum.katalon.com/t/why-am-i-getting-a-415-error-in-katalon-when-my-json-body-is-right-there/191345>\
**Category:** API Testing\
**Created:** [June 1, 2026, 3:08pm UTC](https://forum.katalon.com/t/why-am-i-getting-a-415-error-in-katalon-when-my-json-body-is-right-there/191345 "2026-06-01T15:08:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamzakhan](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@hamzakhan](https://forum.katalon.com/u/hamzakhan)\
**Post date:** [June 1, 2026, 3:08pm UTC](https://forum.katalon.com/t/why-am-i-getting-a-415-error-in-katalon-when-my-json-body-is-right-there/191345/1 "2026-06-01T15:08:25Z")

</div>

Hi everyone, I’m pretty new to API testing in Katalon Studio and I’ve been stuck on this for hours.

I’m trying to test a POST request that creates a new user. I created a new Web Service Request object, set the method to POST, and pasted my JSON data directly into the **HTTP Body** tab (I selected the ‘text’ option because it looks like a big block of text).

When I click the test button, the server keeps firing back a `415 Unsupported Media Type` status code.

I can see the data right there in the box, so I don’t understand why the server thinks the media type isn’t supported. What am I missing here?

---

<div class="post-metadata">

**Author:** ![qurzunta.kaab](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/qurzunta.kaab/32/31470_2.png) [@qurzunta.kaab](https://forum.katalon.com/u/qurzunta.kaab)\
**Post date:** [June 1, 2026, 4:54pm UTC](https://forum.katalon.com/t/why-am-i-getting-a-415-error-in-katalon-when-my-json-body-is-right-there/191345/2 "2026-06-01T16:54:07Z")

</div>

The `415 Unsupported Media Type` HTTP status code indicates that the server is refusing to accept the request because the payload format is in an unsupported format.

Even though you have pasted valid JSON into the HTTP Body tab, Katalon Studio defaults to sending requests as plain text (`text/plain`) unless you explicitly tell it otherwise. The API server expects a header called `Content-Type` with the value `application/json`. Because that header is either missing or set to plain text, the server rejects the request before it even looks at your JSON data.

### The Solution

To fix this, you need to change how Katalon handles the body text or explicitly define the `Content-Type` header.

1. Open your Web Service Request object.

2. Go to the **HTTP Body** tab.

3. Instead of selecting **text** , click the dropdown and select **string**.

4. In the content type dropdown right next to it, select **application/json**. Katalon will automatically add the correct `Content-Type` header to your request.

### Pro-Tip: Reusable Custom Keyword for Header Management

If you are building requests dynamically via scripting mode, it is highly recommended to use a robust, reusable method to handle headers. This ensures consistency across your test suites.

You can create a **Custom Keyword** in Katalon to automatically inject the correct JSON headers into a request object before it is sent.

Groovy

```auto
package com.api.helpers

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.testobject.TestObjectProperty
import com.kms.katalon.core.testobject.RequestObject

public class ApiHelper {

    /**
     * Standardizes a Request Object by ensuring the application/json Content-Type is set.
     * @param requestObject The WS request object from your Object Repository
     * @return The updated RequestObject with proper JSON headers
     */
    @Keyword
    def static RequestObject setJsonHeaders(RequestObject requestObject) {
        // Retrieve existing headers
        List<TestObjectProperty> headers = requestObject.getHttpHeaderProperties()
        
        // Remove existing Content-Type if it exists to avoid duplicates
        headers.removeIf({ property -> property.getName().equalsIgnoreCase("Content-Type") })
        
        // Add the correct application/json header
        headers.add(new TestObjectProperty("Content-Type", ConditionType.EQUALS, "application/json"))
        
        // Update the request object
        requestObject.setHttpHeaderProperties(headers)
        
        return requestObject
    }
}

```

**How to use it in your Script View:**

Groovy

```auto
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

// Load your request object
RequestObject request = findTestObject('Object Repository/MyApiRequests/CreateUser')

// Pass it through your custom keyword to fix the headers
request = CustomKeywords.'com.api.helpers.ApiHelper.setJsonHeaders'(request)

// Send the request safely
def response = WS.sendRequest(request)
WS.verifyResponseStatusCode(response, 201)

```

---

<div class="post-metadata">

**Author:** ![depapp](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/depapp/32/29178_2.png) [@depapp](https://forum.katalon.com/u/depapp)\
**Post date:** [June 2, 2026, 1:13am UTC](https://forum.katalon.com/t/why-am-i-getting-a-415-error-in-katalon-when-my-json-body-is-right-there/191345/3 "2026-06-02T01:13:47Z")

</div>

hi @hamzakhan

the “text” option sends the body with `Content-Type: text/plain`, which your API rejects. Switch the HTTP Body type dropdown from “text” to “json” (or “string” with content type set to application/json). That tells Katalon to send the proper `Content-Type: application/json` header automatically.

alternatively, you can leave the body as-is and manually add a `Content-Type: application/json` header on the HTTP Headers tab. Either way, the server needs that header to know how to parse the payload.

---

<div class="post-metadata">

**Author:** ![Monty\_Bagati](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/monty_bagati/32/33047_2.png) [@Monty\_Bagati](https://forum.katalon.com/u/Monty_Bagati)\
**Post date:** [June 2, 2026, 3:29am UTC](https://forum.katalon.com/t/why-am-i-getting-a-415-error-in-katalon-when-my-json-body-is-right-there/191345/4 "2026-06-02T03:29:06Z")

</div>

use the below instead of plain/text

**Content-Type:application/json**

---

<div class="post-metadata">

**Author:** ![dineshh](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dineshh/32/24488_2.png) [@dineshh](https://forum.katalon.com/u/dineshh)\
**Post date:** [June 2, 2026, 3:50am UTC](https://forum.katalon.com/t/why-am-i-getting-a-415-error-in-katalon-when-my-json-body-is-right-there/191345/5 "2026-06-02T03:50:43Z")

</div>

A `415 Unsupported Media Type` means the server rejected the **request format** , usually because the `Content-Type` header doesn’t match the JSON body.

## Fix

Set the request to send JSON as `application/json`, not plain text.

## In Katalon UI

- Open the Web Service Request.
- In the HTTP Body section, choose **string** if available.
- Set the body/content type to **application/json**.
- Make sure the request headers include:

```auto
Content-Type: application/json
Accept: application/json

```

## Script example

```auto
import com.kms.katalon.core.testobject.TestObjectProperty
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.RestRequestObjectBuilder
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

def builder = new RestRequestObjectBuilder()
def request = builder
    .withRestRequestMethod('POST')
    .withRestUrl('https://your-api.example.com/users')
    .withTextBodyContent('{"name":"John","email":"john@example.com"}')
    .withHttpHeaders([
        new TestObjectProperty('Content-Type', ConditionType.EQUALS, 'application/json'),
        new TestObjectProperty('Accept', ConditionType.EQUALS, 'application/json')
    ])
    .build()

def response = WS.sendRequest(request)
println response.getStatusCode()

```

## Why it happens

Even if the JSON is visible in the body editor, Katalon can still send it as `text/plain` unless the request metadata says it is JSON. The server checks the header first and may reject the request before parsing the payload

---

<div class="post-metadata">

**Author:** ![arvind.choudhary](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/arvind.choudhary/32/33165_2.png) [@arvind.choudhary](https://forum.katalon.com/u/arvind.choudhary)\
**Post date:** [June 2, 2026, 9:10am UTC](https://forum.katalon.com/t/why-am-i-getting-a-415-error-in-katalon-when-my-json-body-is-right-there/191345/6 "2026-06-02T09:10:06Z")

</div>

This is actually a very common API testing issue, especially as you are saying you are a beginner.

The key thing is that **having JSON in the request body is not enough**. The server also needs to know **what type of content you’re sending**.

In the Headers section, make sure: to have the content type  
Since you’re entering raw JSON in the HTTP Body, make sure you’ve also added the header:

```auto
Content-Type: application/json

```

Some APIs also require:

```auto
Accept: application/json

```

If those headers are already present, check the API documentation to confirm the endpoint actually expects JSON.

| |
| --- |

| |
| --- |
