Why doesn't this HTTP translation script work?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to translate the word “Hello” to spanish

  1. What is the issue? Include screenshots / videos if possible!

The issue is I keep on getting issues saying "The request failed 403"

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I looked in the developer hub and looked on youtube but it didn’t really help

local HttpService = game:GetService("HttpService")

local function request()
	local response = HttpService:RequestAsync(
		{
			Url = "https://libretranslate.com/translate", 
			Method = "POST",
			Headers = {
				["Content-Type"] = "application/json" 
			},
			Body = HttpService:JSONEncode({
				
				["q"] = "Hello",
				["source"] = "en",
				["target"] = "es"
			})
		}
	)
	if response.Success then
		print("Status code:", response.StatusCode, response.StatusMessage)
		print("Response body:\n", response.Body)	
	else
		print("The request failed:", response.StatusCode, response.StatusMessage)
	end
end

local success, message = pcall(request)
if not success then
	print("Http Request failed:", message)
end 



The API you’re trying to access may require an API token. Please take a thorough look at their documentation page or terms of conditions and reply back.

I just took a look at the docs page myself for the translate endpoint and it does need an API key.

ok thank you very much, Im going to try

1 Like

ok I got the api key now I need to put it in roblox. I see an error that says: image
I never used an API key before so can you tell me how I would put it in roblox?