Using Publish API in JavaScript

Are you trying to upload an image asset or something similar? If so, I found out this actually was not the right API.

There is a data API too. I learned this from someone else, but I couldn’t find it documented anywhere.

https://data.roblox.com/data/upload/json?assetTypeId=13

It doesn’t seem to have any documentation, so I used Tarmac.

I used Python for this. If you are not using Python, reply back telling me what you are using so I can see if I can help.

def sendImageToServer(sendingfile,Retry = True, Token=XCSRFTOKEN):
	API_ENDPOINT = "https://data.roblox.com/data/upload.json"
	data = {
			'uploadAssetRequest.files':sendingfile, #base64.b64encode()
			'content-length': '75174'
			}
	headers = {'Accept': 'application/json','Content-Type': 'multipart/form-data','X-CSRF-TOKEN': Token}
	cookies = {'.ROBLOSECURITY': 'put your roblo security in here'}
	r = requests.post(url = API_ENDPOINT, data = data, headers = headers, cookies=cookies)
	print(r)
	print(r.text)
	print(r.headers)
	if r.status_code == 403: # If the response is 403...
		try:
			JSON = json.loads(r.text)
			ResponseCode = JSON["errors"][0]["code"]
			if ResponseCode == 0: # And Roblox response is 0...
				if Retry == True: # If retry is enabled...
					return sendImageToServer(sendingfile,False, r.headers["x-csrf-token"]) # Re-do the request, but this time, with the `x-csrf-token` supplied as well.
		except:
			return r
	return r, Token

I got help from @Batman212369 who also made this post:

I also found GitHub - Corecii/RbxUpload: A tool to upload files to Roblox · GitHub by @Corecii

I have not tried this one, but it looks interesting.

4 Likes