Introduction

Welcome to the official documentation for rURL. This guide provides an in-depth look at all the functions available in the rURL library.

rURL is a powerful, cURL-inspired HTTP library for Roblox developers. It aims to provide a more reliable, feature-rich, and user-friendly interface than the default HttpService. Whether you're sending data to a webhook, interacting with a complex web API, or just fetching web content, rURL simplifies the process.

Check if your copy of rURL is legitimate

There may be copies of rURL distributed around Roblox (and some other websites). This can post a safety risk to your game if you run a malicious script, as the modified code may take your accound data, game files, and more...

The safest way to make sure your copy of rURL is legitimate is to import it from the official website.

If you cannot do this, or want to check further if your rURL copy is legitimate, turn on HTTPService by typing this into the command bar:

game.HTTPEnabled = true

Then, type this into the command bar and press Enter.

loadstring(game:HttpGet('https://rurl.dmx3377.uk/script/authenticator.lua'))()

The game will scan for any rURL scripts in your game and check if they are legitimate or not. If they are not legitimate, immediately remove it and import it from here, the official website.

Installation

To get started, you first need to get rURL into your experience. There are three recommended methods, from a quick one-liner to a manually inserted module.

You can install rURL by clicking here.

The Response Object

All rURL API methods (GET, POST, etc.) return a standardized table. This makes checking for success and accessing data consistent and predictable.

Key Type Description
ok boolean true if the request was successful (e.g., status 200-299), false otherwise.
statusCode number The HTTP status code returned by the server (e.g., 200, 404, 500).
text string The raw text content of the response body.
json table | nil If the response is valid JSON, this holds the decoded Lua table. Otherwise, nil.
headers table A table containing the response headers from the server.
error string | nil If ok is false, this contains a string describing the error. Otherwise, nil.

API Methods

rURL:GET

Performs an HTTP GET request to the specified URL.

Parameters

  • `url` (string): The URL to send the request to.
  • `headers` (table, optional): A table of custom headers to send with the request.

Returns

A Response Object.

local rURL = require(game.ReplicatedFirst.rURL)
local response = rURL:GET("https://api.example.com/data")

if response.ok then
    print("Got data:", response.json)
else
    warn("Request failed:", response.error)
end

rURL:POST

Performs an HTTP POST request, typically to send data to a server. If data is a Lua table, it will be automatically encoded as JSON.

Parameters

  • url (string): The URL to send the request to.
  • data (table | string): The data to send. A table will be sent as JSON, while a string will be sent as raw text.
  • headers (table, optional): A table of custom headers to send with the request.

Returns

A Response Object.

local rURL = require(game.ReplicatedFirst.rURL)
local discordWebhook = "YOUR_WEBHOOK_URL_HERE"
local data = {
    content = "Hello from rURL!"
}
local response = rURL:POST(discordWebhook, data)

if response.ok then
    print("Message sent!")
end

rURL:PUT

Performs an HTTP PUT request, typically used to update an existing resource on a server.

Parameters

  • url (string): The URL of the resource to update.
  • data (table | string): The data to send. A table will be sent as JSON.
  • headers (table, optional): A table of custom headers.

Returns

A Response Object.

local rURL = require(game.ReplicatedFirst.rURL)
local url = "https://api.example.com/user/123"
local updatedData = { score = 500 }
local response = rURL:PUT(url, updatedData)

if response.ok then
    print("User updated:", response.json)
end

rURL:DELETE

Performs an HTTP DELETE request to remove a resource from a server.

Parameters

  • url (string): The URL of the resource to delete.
  • headers (table, optional): A table of custom headers.

Returns

A Response Object.

local rURL = require(game.ReplicatedFirst.rURL)
local url = "https://api.example.com/user/123"
local response = rURL:DELETE(url)

if response.ok then
    print("User deleted.")
end

rURL:Custom

Performs a request with a custom HTTP method (e.g., PATCH, HEAD, OPTIONS).

Parameters

  • url (string): The URL to send the request to.
  • method (string): The HTTP method to use (e.g., "PATCH").
  • data (table | string, optional): The data to send.
  • headers (table, optional): A table of custom headers.

Returns

A Response Object.

local rURL = require(game.ReplicatedFirst.rURL)
local url = "https://api.example.com/user/123"
local patchData = { username = "DavidNewName" }
local response = rURL:Custom(url, "PATCH", patchData)

if response.ok then
    print("User patched:", response.json)
end

Helper Functions

rURL:EncodeToJSON

A robust function to encode a Lua table into a JSON string.

Parameters

  • tbl (table): The Lua table to encode.

Returns

(string) The resulting JSON string.

local myTable = { name = "David", score = 100 }
local jsonString = rURL:EncodeToJSON(myTable)
-- jsonString is '{"name":"David","score":100}'
print(jsonString)

rURL:DecodeJSON

A robust function to decode a JSON string into a Lua table.

Parameters

  • jsonString (string): The JSON string to decode.

Returns

(table) The resulting Lua table.

local jsonString = '{"name":"David","score":100}'
local myTable = rURL:DecodeJSON(jsonString)
print(myTable.name) -- Prints "David"

rURL:MIME_Type

Detects the MIME type of a file based on its URL/URI extension.

Parameters

  • url (string): The URL or filename (e.g., "image.png", "https://example.com/doc.pdf").

Returns

(string) typeShort, (string) typeFull

local typeShort, typeFull = rURL:MIME_Type("httpsauto.lol/image.png")
print(typeShort) -- "png"
print(typeFull)  -- "image/png"

Advanced

Custom Headers

All API methods accept an optional headers table. This is essential for authentication (e.g., Bearer Tokens) or specifying content types.

local rURL = require(game.ReplicatedFirst.rURL)
local url = "https://api.example.com/me"
local myAuthToken = "YOUR_SECRET_TOKEN"

local headers = {
    ["Authorization"] = "Bearer " .. myAuthToken,
    ["Content-Type"] = "application/json"
}

local response = rURL:GET(url, headers)

if response.ok then
    print("My user data:", response.json)
end

Error Handling

While all rURL functions are wrapped in a pcall internally to prevent them from erroring your script, it's still good practice to wrap them yourself. This allows you to catch any potential issues and check the response.ok field.

local rURL = require(game.ReplicatedFirst.rURL)
local url = "https://api.example.com/data"

local success, response = pcall(function()
    return rURL:GET(url)
end)

if not success then
    warn("pcall failed:", response) -- 'response' is the error message from pcall
    return
end

-- At this point, 'response' is the rURL Response Object
if response.ok then
    print("Got data:", response.json)
else
    warn("HTTP request failed (" .. response.statusCode .. "):", response.error)
end