Response 413- Base64 image put request causing 413 error “payload too large” python

I am trying to put request a base64 encoded image, to the represented api below.

#base64 content
base_content = "/y4AAQSkZJRgABAQEAYABgAAD/2wBDA........."
# input parameters
data = {'mailId':'samplemail@gmail.com','Name':"example",'imageBaseCode':base_content}
# api
api='https://api.com/example'
#headers
headers = { "appapi": "appapi"}
# put request
response = requests.put(api, data=data, headers=headers)

When I try to input the parameters and run the script, I get the following error

<Response [413]>
<!DOCTYPE html><html><head><title></title><link rel="stylesheet" href="/stylesheets/style.css"></head><body><h1>request entity too large</h1><h2>413</h2><pre>PayloadTooLargeError: request entity too large

The maximum size limit of the API is 50 MB, so put requesting any base64 image shouldn’t be a problem.

But here is something I observed. When I tried sending an empty string in place of base64 value or entering a few characters for the purpose of achieving a minimum character length,

base_content = "werwkjfkjdflkjfkasndffkjasdkjfnakljnfkasndlkjn"
data = {'mailId':'samplemail@gmail.com','Name':"example",'imageBaseCode':base_content}
url='https://api.com/example'

headers = { "appapi": "appapi"}
response = requests.put(url, data=data, headers=headers)

I get a perfect Response <200> and the request is successful.

Now I tried requesting the API directly without involving python3 and it accepts base64 content no matter what the size was.

I can’t really reduce the char size of any base64 image content for the sake for put request. Is this a problem from the python side or the API?? Any help is really appreciated. Thanks