ERPNext Not Allowing New User To Create Sales Invoice Through API But Allows Through GUI

I’m trying to create a sales invoice as a new user. It works fine from the GUI but when I try it from the API I get a 417 error response. It works fine as the administrator. I’m using the cookies returned after login for the Sales Invoice post request

can you share the error log here?

Okay it turned out to be a permission issue. Someone added a restriction to a certain company. How do I specify company when adding a sales invoice in the API? Adding a “company” field does not seem to work

Okay it seems I am only able to specify the default company from the API for some reason. Works in the GUI