Creating new tree using git database api returns 404

Hello! i am new to using github and all of it’s api. i am using the git database api to commit files to github.

the part i am having trouble with is sending a POST to https://api.github.com/repos/account/Repo/git/trees. every time i do so it returns a 404 (not found). is there anything i’m doing wrong? here’s the body of what im sending:

local body = {
    ["base_tree"] = sha.object.sha,
    ["tree"] = {
        ["path"] = "TestFile.lua",
        ["mode"] = 100644,
        ["type"] = "blob",
        ["content"] = "print('e')"
    }
}

Also if there are any other ways to commit a file to a repository that would also be very useful to me.