When storing a document with API, you receive the following error; 

500 Internal Server Error (Value was either too large or too small for an Int32)

This error occurs when a value being stored exceeds the allowed limit for Int32 data types.
The limits for Int32 are 2,147,483,647 and -2,147,483,648.

Any value exceeding these limits will result in this error.

KBA applicable for both Cloud and On-premise Organizations.