# llGetFreeURLs

*LSL function*

```lsl
integer integer llGetFreeURLs();
```

- Returns: `integer`
- Energy: 10

Returns an [integer](https://wiki.secondlife.com/wiki/integer) that is the number of available URLs. If attached, return the URLs remaining for the owner. Otherwise, return the available URLs for the region.

```lsl title="How to use" frame="terminal"
integer result = llGetFreeURLs();
```

## Specification

There is a separate URL limit for the region, and a limit for each agent. The URL limit is the same as the [Land Impact](https://wiki.secondlife.com/wiki/Land_Impact) limit:

- Agent: 38
- Openspace Sim: 1,250
- Homestead Sim: 5,000
- Full Sim: 20,000
- Mainland Sim: 22,500
- 30k Sim: 30,000

## Caveats

- If called from an attachment, there is no way to get the number of free URLs in the region; it will always return the URL count remaining for the agent.

## Examples

<details open>
<summary>This script will say the number of currently available HTTP-In URLs left in the region.</summary>

```lsl collapse={8-16}
default
{
    touch_start(integer num_detected)
    {
        integer numberOfFreeURLs = llGetFreeURLs();

        if (numberOfFreeURLs)
        {
            llSay(0, "There are " + (string)numberOfFreeURLs + " available HTTP-In URLs left in this region.");
        }
        else
        {
            llSay(0, "WARNING: There are no HTTP-In URLs available anymore.");
        }
    }
}
```

</details>

<details>
<summary>Example 2</summary>

```lsl collapse={1-25, 31-36}
// WARNING:
//
//      This script is only for proof-of-concept (demo purposes).
//      DO NOT use it if you don't have the sim owners and/or
//      estate managers OK to test this script.
//      This script can possibly block HTTP communication from and to the sim.
//      ...bringing down all networked vendors and/or similar machines.
//
//      This script allocates all available URLs.
//      Deleting the script and/or derezzing the object containing the script,
//      will release all previously taken URLs.

default
{
    state_entry()
    {
        llRequestURL();
    }

    http_request(key request_id, string method, string body)
    {
        if (method == URL_REQUEST_DENIED)
        {
            llSetText("No free URLs!", <1.0, 0.0, 0.0>, 1.0);
        }
        else if (method == URL_REQUEST_GRANTED)
        {
            llSetText((string)llGetFreeURLs() + " URLs left\n" + body, <1.0, 1.0, 1.0>, 1.0);
            llRequestURL();
        }
        else if (method == "GET")
        {
            llHTTPResponse(id, 200, "Hello there!");
        }
    }
}
```

</details>

## Notes

URLs are a finite region resource and should be released when no longer needed.

## History

- SVN:1836 r112899 Trunk

## See also

### Functions

- [llRequestURL](/functions/llRequestURL/)
- [llRequestSecureURL](/functions/llRequestSecureURL/)
- [llReleaseURL](/functions/llReleaseURL/)
- [llHTTPResponse](/functions/llHTTPResponse/)
- [llGetHTTPHeader](/functions/llGetHTTPHeader/)

### Articles

- [LSL http server](https://wiki.secondlife.com/wiki/LSL_http_server)

---

*Source: [LlGetFreeURLs](https://wiki.secondlife.com/wiki/LlGetFreeURLs) on the Second Life Wiki. Content from the Second Life Wiki article LlGetFreeURLs (revision 1214063, 2023-06-11), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llGetFreeURLs/
