# Endpoints

Welcome to the Bravo API. These endpoints are used for integrating Bravo into your own code.

{% hint style="warning" %}
We cannot code for you. Do not open a ticket about how to use an API.
{% endhint %}

{% hint style="danger" %}
Do not ever give out your API key. If you believe your API key has been compromised, regenerate it via the settings menu.
{% endhint %}

{% hint style="danger" %}
Metric staff will **NEVER** ask you for your API key. If somebody is impersonating Metric staff, please open a ticket
{% endhint %}

### API Base URL

The API's base URL is [<mark style="color:blue;">https://bravo.tomerthegreat.com/api/bravo/v1/</mark>](https://bravo.tomerthegreat.com/api/bravo/v1)

{% hint style="info" %}
If you have a custom bot setup, you MUST specify that your hub is a custom one with the query parameter `?customhub=true`
{% endhint %}

## Check if user owns product

<mark style="color:blue;">`GET`</mark> `https://bravo.tomerthegreat.com/api/bravo/v1/ownership/`

#### Query Parameters

| Name                                                 | Type   | Description                                                                |
| ---------------------------------------------------- | ------ | -------------------------------------------------------------------------- |
| identificationType<mark style="color:red;">\*</mark> | String | The platform of the ID that you specified (use "roblox" or "discord" ONLY) |
| identification<mark style="color:red;">\*</mark>     | String | The user ID of the user that you would like to check ownership of          |
| product<mark style="color:red;">\*</mark>            | String | The product that you would like to check ownership of                      |
| hubId<mark style="color:red;">\*</mark>              | String | The ID of the hub that you would like to check product ownership in        |

{% tabs %}
{% tab title="200: OK " %}

```javascript
true
```

{% endtab %}

{% tab title="404: Not Found The product is not valid." %}

```javascript
{
    "error": "The specified product was not found."
}
```

{% endtab %}

{% tab title="401: Unauthorized The hub ID is not valid." %}

```javascript
{
    "error": "The specified hubId is not valid."
}
```

{% endtab %}

{% tab title="400: Bad Request You are missing required parameters in your request." %}

```javascript
{
    "error": "You are missing required parameters in your request."
}
```

{% endtab %}

{% tab title="404: Not Found User is not linked, or doesn't exist" %}

```javascript
{
    "error": "The user isn't linked yet, or the user is not valid."
}
```

{% endtab %}
{% endtabs %}

## Gets a hub's products

<mark style="color:blue;">`GET`</mark> `https://bravo.tomerthegreat.com/api/bravo/v1/products/`

#### Query Parameters

| Name                                    | Type   | Description                                                |
| --------------------------------------- | ------ | ---------------------------------------------------------- |
| hubId<mark style="color:red;">\*</mark> | String | The ID of the hub you would like to get the products from. |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "product1": { 
        "name": "product1", 
        "service": "true", 
        "productid": "developerproductid",
        "stock": "unlimited",
        "testing_game": "12345678",
     },
     "product2": { 
        "name": "product2", 
        "service": "false", 
        "productid": "developerproductid",
        "stock": "10",
        "testing_game": "12345678",
     },
     "product3": { 
        "name": "product3", 
        "service": "true", 
        "productid": "developerproductid",
        "stock": "unlimited",
        "testing_game": "12345678",
        "image": "robloxassetid"
     },
     "product4": { 
        "name": "product4", 
        "service": "false", 
        "productid": "developerproductid",
        "stock": "10",
        "testing_game": "12345678",
        "image": "robloxassetid"
     }
}
```

{% endtab %}

{% tab title="401: Unauthorized The hub ID is not valid." %}

```javascript
{
    "error": "The specified hubId is not valid."
}
```

{% endtab %}

{% tab title="204: No Content " %}

```javascript
{
    "success": "No products found."
}
```

{% endtab %}
{% endtabs %}

## Gets information about a user

<mark style="color:blue;">`GET`</mark> `https://bravo.tomerthegreat.com/api/bravo/v1/users/getinfo/`

#### Query Parameters

| Name                                                 | Type   | Description                                                                |
| ---------------------------------------------------- | ------ | -------------------------------------------------------------------------- |
| identificationType<mark style="color:red;">\*</mark> | String | The platform of the ID that you specified (use "roblox" or "discord" ONLY) |
| identification<mark style="color:red;">\*</mark>     | String | The user ID of the user that you would like to get the information of      |
| hubId<mark style="color:red;">\*</mark>              | String | The ID of the hub that you would like to get the user's information from   |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
   "discordId": "123456789"
   "robloxId": "1234567"
   "ownedProducts": [{"product": "Product1"}, {"product": "Product2"}, {"product": "Product3"}]
}
```

{% endtab %}

{% tab title="401: Unauthorized The hub ID is not valid." %}

```javascript
{
    "error": "The specified hubId is not valid."
}
```

{% endtab %}

{% tab title="404: Not Found User is not linked, or doesn't exist" %}

```javascript
{
    "error": "The user isn't linked yet, or the user is not valid."
}
```

{% endtab %}
{% endtabs %}

## Generates a linking code

<mark style="color:green;">`POST`</mark> `https://bravo.tomerthegreat.com/api/bravo/v1/users/gencode`

#### Query Parameters

| Name                                        | Type   | Description                                                                   |
| ------------------------------------------- | ------ | ----------------------------------------------------------------------------- |
| robloxId<mark style="color:red;">\*</mark>  | string | The ROBLOX ID of the user that you would like to generate a linking code for  |
| discordId<mark style="color:red;">\*</mark> | String | The Discord ID of the user that you would like to generate a linking code for |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "code": "abcdef"
}
```

{% endtab %}
{% endtabs %}

## Grants product to the specified user

<mark style="color:green;">`POST`</mark> `https://bravo.tomerthegreat.com/api/bravo/v1/licenses/grant/`

#### Query Parameters

| Name                                                 | Type   | Description                                                                |
| ---------------------------------------------------- | ------ | -------------------------------------------------------------------------- |
| identificationType<mark style="color:red;">\*</mark> | String | The platform of the ID that you specified (use "roblox" or "discord" ONLY) |
| identification<mark style="color:red;">\*</mark>     | String | The user ID of the user that you would like to grant the product to        |
| product<mark style="color:red;">\*</mark>            |        | The product that you would like to grant to the user                       |
| apiKey<mark style="color:red;">\*</mark>             | String | The API key for your hub, used for security reasons.                       |
| hubId<mark style="color:red;">\*</mark>              | String | The hub ID of the hub that you are granting the products in.               |

{% tabs %}
{% tab title="201: Created " %}

```javascript
{
    "robloxId": "123456",
    "discordId": "123456789",
    "productName": "Product1",
    "hubId": "ciEfaASxxQ"
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid hub ID" %}

```javascript
{
    "error": "The specified hubId is not valid."
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid apiKey" %}

```javascript
{
    "error": "The specified apiKey is not valid."
}
```

{% endtab %}

{% tab title="404: Not Found Invalid product" %}

```javascript
{
    "error": "The specified product is not valid."
}
```

{% endtab %}

{% tab title="404: Not Found User isn't linked or doesn't exist" %}

```javascript
{
    "error": "The user isn't linked, or the user is not valid."
}
```

{% endtab %}
{% endtabs %}

## Grants product to the specified user

<mark style="color:red;">`DELETE`</mark> `https://bravo.tomerthegreat.com/api/bravo/v1/licenses/revoke`

#### Query Parameters

| Name                                                 | Type   | Description                                                                |
| ---------------------------------------------------- | ------ | -------------------------------------------------------------------------- |
| identificationType<mark style="color:red;">\*</mark> | String | The platform of the ID that you specified (use "roblox" or "discord" ONLY) |
| identification<mark style="color:red;">\*</mark>     | String | The user ID of the user that you would like to grant the product to        |
| product<mark style="color:red;">\*</mark>            | String | The product that you would like to grant to the user                       |
| apiKey<mark style="color:red;">\*</mark>             | String | The API key for your hub, used for security reasons.                       |
| hubId<mark style="color:red;">\*</mark>              | String | The hub ID of the hub that you are granting the products in.               |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "robloxId": "123456",
    "discordId": "123456789",
    "productName": "Product1",
    "hubId": "ciEfaASxxQ"
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid hub ID" %}

```javascript
{
    "error": "The specified hubId is not valid."
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid apiKey" %}

```javascript
{
    "error": "The specified apiKey is not valid."
}
```

{% endtab %}

{% tab title="404: Not Found Invalid product" %}

```javascript
{
    "error": "The specified product is not valid."
}
```

{% endtab %}

{% tab title="404: Not Found User isn't linked or doesn't exist" %}

```javascript
{
    "error": "The user isn't linked, or the user is not valid."
}
```

{% endtab %}
{% endtabs %}


---

# 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.tomerthegreat.com/bravo/introduction.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.
