API fails to create new Thing

I have created a backend API which parses an uploaded file in order to create and populate a new Thing with the parsed data using Javascript. It is not working. When I examine the server log, at all points until the API is called I can see that the user is correctly logged, yet when the API workflow is actioned, the log says that the user is anonymous and no_user.
How can the API create a new Thing if the current user is not logged?