API Request body limit

Hi all,

Do you happen to know whether there is a limit to the request body of an API endpoint?
When I send a large string in the body I get “The remote server returned an error: (500) Internal Server Error.”
09:45:10 [Error] Microsoft.AspNetCore.Server.Kestrel Connection id “0HMM1CM5GQ3RA”, Request id “0HMM1CM5GQ3RA:00000001”: An unhandled exception was thrown by the application.
09:45:10 [Info] Microsoft.AspNetCore.Hosting.Internal.WebHost Request finished in 394.8437ms 500
09:45:10 [Info] Microsoft.AspNetCore.Server.Kestrel Connection id “0HMM1CM5GQ3RA”, Request id “0HMM1CM5GQ3RA:00000001”: the application completed without reading the entire request body.

Below is what my script does. If I reduce the number of characters, it works.
$Body = @{
Output = ‘LARGE STRING’ → about 11450 characters
} | ConvertTo-Json
Invoke-RestMethod -Uri ‘URL’ -Method post -UseDefaultCredentials -Body $body

I was wondering if there is some setting in the web.config that could overwrite this limit?

Thank you.