Fetch scripts

Fetch home page scripts or get filtered results

The first endpoint, and likely one of those that will be used the most in your executor/script hub, is the fetch endpoint. This endpoint handles all general querying of ScriptBlox's script catalogue, and can be used along with filters to narrow down results.

API Path

The API path for this endpoint is /api/script/fetch

Parameters

In addition to plain requests for home page scripts, this endpoint accepts additional query parameters (filters) to narrow down results and make more targetted queries.

The accepted parameters are:

ParameterDescriptionRequiredTypeDefault
pageThe page to start fetching from (useful for paginating content)number1
maxMaximum amount of scripts to fetch in a batchAny positive number up to 2020
excludeMainly internal, used to exclude a certain script from the results.Valid script ID-
modeThe script typefree or paid-
patchedWhether or not the script is patched1 (yes) or 0 (no)-
keyWhether or not the script has a key system1 (yes) or 0 (no)-
universalWhether or not the script is universal1 (yes) or 0 (no)-
verifiedWhether or not the script is verified1 (yes) or 0 (no)-
sortByUsed to control the criteria by which to sort the resultsviews | likeCount | createdAt | updatedAt | dislikeCountupdatedAt
orderThe sort orderasc (ascending) or desc (descending)desc
ownerThe username to filter bystring-
placeIdThe game ID to filter bynumber-

Response

The response, unless errored, would be of the following structure:

{
    "result": {
        "totalPages": number,
        "nextPage": number,
        "max": number,
        "scripts": [
            {
                "_id": "string",
                "title": "string",
                "game": {
                    "_id": "string",
                    "name": "string",
                    "imageUrl": "string"
                },
                "slug": "string",
                "verified": boolean,
                "key": boolean,
                "views": number,
                "scriptType": "string",
                "isUniversal": boolean,
                "isPatched": boolean,
                "image": "string",
                "createdAt": "string",
                "script": "string"
            },
            ...
        ]
    }
}

If an error occurs, the response will contain a single message field:

{
    "message": "string"
}

Usage

using System.Text.Json;
using System.Net.Http.Json;

public async Task FetchScripts() {
    HttpClient client = new HttpClient();
    try {
        JsonElement scripts = await client.GetFromJsonAsync<JsonElement>("https://scriptblox.com/api/script/fetch"); // 20 most recent scripts. Also known as home page scripts.
        foreach(JsonElement script in scripts.GetProperty("result").GetProperty("scripts")) {
            // Use the script to, for example, display it in a window/page
            Application.Current.Dispatcher.Invoke(() => {
                // Example: ScriptPanel is a StackPanel defined in your XAML
                ScriptPanel.Children.Add(new TextBlock(){
                    Text = $"Title: {script.GetProperty("title").GetString()}\nSlug: \n{script.GetProperty("slug").GetString()}"
                });
            });
        }
    }
    catch (HttpRequestException e)
    {
        // Network error or invalid URL
        Application.Current.Dispatcher.Invoke(() =>
        {
            ScriptPanel.Children.Add(new TextBlock()
            {
                Text = $"Network error while fetching scripts:\n{e.Message}",
                Margin = new Thickness(10)
            });
        });
    }
    catch (JsonException e)
    {
        // JSON parsing error
        Application.Current.Dispatcher.Invoke(() =>
        {
            ScriptPanel.Children.Add(new TextBlock()
            {
                Text = $"Error parsing JSON response:\n{e.Message}",
                Margin = new Thickness(10)
            });
        });
    }
    catch (Exception e)
    {
        // General exception
        Application.Current.Dispatcher.Invoke(() =>
        {
            ScriptPanel.Children.Add(new TextBlock()
            {
                Text = $"Unexpected error:\n{e.Message}",
                Margin = new Thickness(10)
            });
        });
    }
}

© 2025 ScriptBlox.
All rights reserved.