It appears that the error may be originating from the way parameters are being passed to the AddSite API. Sometimes the panel expects specific fields (like domainlist, ftp, or sql) in a particular format — for example, as arrays or strings rather than booleans. Another common issue is when the version or type value doesn’t match what the API is currently supporting.
A good starting point would be to log the raw $result before decoding it so that you can see the exact error message returned by the panel. That will usually point you straight to the missing or mismatched parameter. Also, double-check if the webname requires the domain to be passed differently (some panels don’t accept nested JSON in this case).
In short: inspect the raw response, verify the parameter formats against the API docs, and try simplifying the payload step by step. That should help narrow down where the mismatch is happening.