I can create a Json file using the api in a native JS app, but can I upload it to my arcgis online account or portal account using the API? .
You can use the ArcGIS REST API to do this.