# Aliases

{% hint style="info" %}
**Use Case**

* Provides a rule to fuzzy match requests with similar paths to a common endpoint
  {% endhint %}

## Examples

Let's say we have the requests with paths `/users/1`, `/users/2`, `/users/100`, etc... and we want to group them together. To capture this behavior when creating an endpoint, mark the `:user_id` path component as an **alias**.

### Example 1

The following endpoint with `:user_id` marked as an alias will match `/users/1`, `/users/2`, `/users/100`, etc...

```
/users/:user_id
```

### Example 2

The following endpoint with `:username` and `:repository` marked as an alias will also matches requests with the paths`/users/1`, `/users/2`, `/users/100`, etc...

```
/:username/:repository
```

This creates an ambiguous situation where it is unclear whether the paths belong to the endpoint in **Example 1** or the endpoint in **Example 2**. To address the ambiguity we match requests to viable endpoints with the **least number** of aliases, which would be the endpoint from **Example 1**.

## How To Create

### Method 1

When creating an endpoint, you have the option to configure path segment(s) as an alias. To configure an alias, select the dropdown menu to the right of the designated path segment.

<figure><img src="/files/onfg2O8WaX4QB7i88wDT" alt=""><figcaption><p>Endpoints Create Modal</p></figcaption></figure>

### Method 2

After creating an endpoint, you also have the option to configure path segment(s) as an alias. To configure an alias, select the pencil icon button underneath the **Alias** column for the desired path segment.

<figure><img src="/files/s4adixvw4XswZxreW2o2" alt=""><figcaption><p>Endpoint Details Page</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stoobly.com/experimental/experimental-features/aliases.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
