Scripts
Retrieve a specific script

GET /api/script/retrieve

This API endpoint retrieves a script by its targetId.

Parameters

NameTypeDescription
targetIdstringThe unique identifier of the script to retrieve.

Response

The response is a JSON object with one of the following structures:

Success Response

{
  "success": {
    "_id": "65c7c91dd7dfa5be4dae6f22",
    "id": 5220,
    "title": "Auto Farm Level Best Script",
    "description": "- Auto Farm Level\r\n- Auto Dungeon\r\n- Mobile Script\r\n- More",
    "download": "auto-farm-level-best-script_65c6a8cef29d2.txt",
    "date": "2024-02-09 17:35:58",
    "views": 2986,
    "image": null,
    "lastupdated": null,
    "private": false,
    "likes": 1,
    "dislikes": 0,
    "patched": false,
    "keySystem": true,
    "key_link": "https://keyrblx.com/getkey/TronHub",
    "mobileReady": true,
    "paid": false,
    "slug": "auto-farm-level-best-script-5220",
    "gameThumbnail": "https://tr.rbxcdn.com/1b09c2c1cc750c2fe463ccfcc8d24544/480/270/Image/Jpeg",
    "avatar_url": "f3ddf205192e877a4723dca6ec980bb0",
    "creation": "2023-10-29",
    "userId": "65c80d546bac5d625c213404",
    "user": [
      {
        "_id": "65c80d546bac5d625c213404",
        "username": "Sahara",
        "name": "Sahara",
        "image": "65c80d546bac5d625c213404_1707609519636_4G2tIUtekW.webp",
        "discord": {
          "id": "1168146262332293131",
          "username": "darkx002"
        }
      }
    ]
  }
}
⚠️

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

Error Responses

Missing targetId

{
  "error": "Please provide a targetId"
}

Script Not Found

{
  "error": "Script not found"
}

General Error

{
  "error": "Error message"
}

Description

The GET /api/script/retrieve endpoint retrieves a script by its unique identifier (targetId). If the targetId is not provided, a 400 Bad Request error is returned with a message to provide a targetId.

If the script is found, the script object is returned in the success field of the response. If the script is not found a 400 Bad Request error is returned with a message indicating the issue.

If any other error occurs during the retrieval process, a 400 Bad Request error is returned with the error message.

Example Usage

fetch("/api/script/retrieve?targetId=65c7c91dd7dfa5be4dae6f22")
  .then((response) => response.json())
  .then((data) => {
    if (data.success) {
      console.log("Script retrieved successfully:", data.success);
    } else {
      console.error("Error retrieving script:", data.error);
    }
  })
  .catch((error) => {
    console.error("Error retrieving script:", error);
  });