Scripts
Retrieve a list of scripts

GET /api/scripts

This API endpoint retrieves a list of scripts based on various filters and sorting options.

Parameters

The following parameters can be included in the query string:

NameTypeDescription
pagenumberThe page number to retrieve (default: 1).
noKeySystembooleanWhether to filter for scripts without a key system (default: null).
mobileOnlybooleanWhether to filter for mobile-ready scripts only (default: null).
notPaidbooleanWhether to filter for free scripts only (default: null).
unpatchedbooleanWhether to filter for unpatched scripts only (default: null).
verifiedOnlybooleanWhether to filter for scripts by verified users only (default: null).
orderBystringThe field to order the results by (e.g., "date", "id", "views", "likes", "dislikes"...).
sortstringThe sort order ("asc" for ascending, "desc" for descending).
qstringThe search term to filter scripts by title and description.

Headers

The following header can be included in the request in case you want to find scripts by username:

NameTypeDescription
UsernamestringThe username of the authenticated user.

Response

The response is a JSON object with the following structure:

{
 "info": {
   "currentPage": 1,
   "maxPages": 10
 },
 "scripts": [
   {
      "_id": "65c7c91dd7dfa5be4dae6f23",
      "id": 5221,
      "title": "[NEW] Jailbreaker Reborn (Jailbreak AutoRob)",
      "description": "This is a COMPLETELY FREE Jailbreak AutoRob\r\n(you have to do a keysystem to get the script which lasts 24h OR you can buy the paid version for 5$ paypal, 800 robux, or crypto :p)\r\n\r\nDeveloped by brizzy, norb and min.",
      "download": "new-jailbreaker-reborn-jailbreak-autorob_65c6c7bf7f97a.txt",
      "date": "2024-02-09 19:47:59",
      "views": 2731,
      "image": null,
      "lastupdated": null,
      "private": false,
      "likes": 1,
      "dislikes": 1,
      "patched": false,
      "keySystem": true,
      "key_link": "https://work.ink/3sz/JailbreakerReborn",
      "mobileReady": true,
      "paid": false,
      "slug": "new-jailbreaker-reborn-jailbreak-autorob-5221",
      "gameThumbnail": "https://tr.rbxcdn.com/00ead62981e79ebc3b8f96dd810ec38d/480/270/Image/Jpeg",
      "avatar_url": "853c7bd90a2963cd4e4bce9419fac83b",
      "creation": "2023-11-02",
      "userId": "65c7ce3c504a30b6b4c241f8",
      "user": [
        {
          "_id": "65c7ce3c504a30b6b4c241f8",
          "username": "norb",
          "name": "norb",
          "image": "65c7ce3c504a30b6b4c241f8_1707613630750_fgbOiWcTfn.webp",
          "discord": {
            "id": "773306136685183006",
            "username": "norb_"
          },
          "verified": true
        }
      ]
    },
 ]
}
⚠️

Please read about possible API Response Edge cases and handle them accordingly.

Description

The GET /api/scripts endpoint retrieves a list of scripts based on various filters and sorting options. The Username header can be included in the request if you only want to receive scripts created by a specific user.

The response includes an info object with the current page number and the maximum number of pages based on the applied filters. Additionally, it includes an array of scripts objects containing the script details, including the associated user information (excluding sensitive fields like password and email).

The scripts are sorted by pinned status first, followed by the specified orderBy field and sort order. If a search term (q) is provided, the scripts are also filtered by the search term.

If the script post has a custom thumbnail, the image field will not be null. If the image field is null, always look for a gameThumbnail field, which may contain a default thumbnail image for the game the script is associated with.

Example Usage

// retrieve the latest scripts for the game "arsenal" created by user 3itx
fetch('https://rscripts.net/api/scripts?page=1&orderBy=date&sort=desc&q=blade-ball', {
    headers: {
      'Username': '3itx' // optional to filter by specific user
    }
  })
    .then(response => response.json())
    .then(data => {
      console.log('Current Page:', data.info.currentPage);
      console.log('Max Pages:', data.info.maxPages);
      console.log('Scripts:', data.scripts);
    })
    .catch(error => {
      console.error('Error fetching scripts:', error);
    });