# Friend

## Friend List

## Get Friend List

<mark style="color:blue;">`GET`</mark> `[endpoint]/v3/friend/list`

`online_only` will show friends that make API activity on last 30 seconds. Currently this feature is not reliable if no game send user's activity via REST API. This will have better reliability after development of WebSocket as we will ping-pong the user every 5 seconds.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |
| X-Api-Key<mark style="color:red;">\*</mark>     | String | API Key      |

#### Request Body

| Name           | Type    | Description                                                                                                                |
| -------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- |
| favorite\_only | Boolean | Only show favorite friends. Default <mark style="color:red;">false</mark>                                                  |
| online\_only   | Boolean | Only show online friends (<mark style="color:red;">read notes above</mark>). Default <mark style="color:red;">false</mark> |
| limit          | Integer | Limit amount of data shows. Default <mark style="color:red;">no limit</mark>                                               |
| offset         | Integer | Start showing data from number of offset. Default <mark style="color:red;">no offset</mark>                                |

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

```json
{
    "status": "success",
    "data": [
        {
            "komo_username": "kokomo",
            "in_game_display_name": "[PBR] Komodo",
            "profile_picture_url": "https://komo.s3.ap-southeast-1.amazonaws.com/profile-account/kokomo-XYXJ.jpg",
            "is_favorite": 0,
            "last_online": "2023-06-27 07:38:17"
        },
        ....
        {
            "komo_username": "dasdsa",
            "in_game_display_name": "dasdsa",
            "profile_picture_url": null,
            "is_favorite": 0,
            "last_online": "2023-06-27 07:37:51"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Friend Request

## Make a Friend Request

<mark style="color:green;">`POST`</mark> `[endpoint]/v3/friend/request`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |
| X-Api-Key<mark style="color:red;">\*</mark>     | String | API Key      |

#### Request Body

| Name                                                     | Type   | Description                          |
| -------------------------------------------------------- | ------ | ------------------------------------ |
| target\_komo\_username<mark style="color:red;">\*</mark> | String | KOMO username to make friend request |

{% tabs %}
{% tab title="400: Bad Request Friend request to itself" %}

```json
{
    "status": "error",
    "messages": "Can not make friend request to itself"
}
```

{% endtab %}

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

```json
{
    "status": "success",
    "messages": "Friend request sent"
}
```

{% endtab %}

{% tab title="400: Bad Request Request already made" %}

```json
{
    "status": "error",
    "messages": "Friend request to this user already made"
}
```

{% endtab %}
{% endtabs %}

## Get Incoming Friend Request

<mark style="color:blue;">`GET`</mark> `[endpoint]/v3/friend/request/incoming`

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

```json
{
    "status": "success",
    "data": [
        {
            "relation_id": 1,
            "requester": "Aviabee",
            "requestee": "kokomo",
            "is_accepted": 0,
            "request_time": "2023-06-27 03:51:15",
            "accept_time": null
        },
        {
            "relation_id": 4,
            "requester": "polycrest",
            "requestee": "kokomo",
            "is_accepted": 0,
            "request_time": "2023-06-27 04:04:55",
            "accept_time": null
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get Outgoing Friend Request

<mark style="color:blue;">`GET`</mark> `[endpoint]/v3/friend/request/outgoing`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |
| X-Api-Key<mark style="color:red;">\*</mark>     | String | API Key      |

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

```json
{
    "status": "success",
    "data": [
        {
            "relation_id": 1,
            "requester": "Aviabee",
            "requestee": "kokomo",
            "is_accepted": 0,
            "request_time": "2023-06-27 03:51:15",
            "accept_time": null
        },
        {
            "relation_id": 2,
            "requester": "Aviabee",
            "requestee": "dasdsa",
            "is_accepted": 0,
            "request_time": "2023-06-27 03:59:38",
            "accept_time": null
        },
        {
            "relation_id": 3,
            "requester": "Aviabee",
            "requestee": "polycrest",
            "is_accepted": 0,
            "request_time": "2023-06-27 03:59:44",
            "accept_time": null
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Accepting Friend Request

## Accepting a Friend Request

<mark style="color:green;">`POST`</mark> `[endpoint]/v3/friend/request/accept`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |
| X-Api-Key<mark style="color:red;">\*</mark>     | String | API Key      |

#### Request Body

| Name                                           | Type    | Description |
| ---------------------------------------------- | ------- | ----------- |
| relation\_id<mark style="color:red;">\*</mark> | Integer | Relation ID |

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

```json
{
    "status": "success",
    "messages": "Friend request accepted"
}
```

{% endtab %}

{% tab title="400: Bad Request relation\_id is not for this user" %}

```json
{
    "status": "error",
    "messages": "You are not authorized to accept this relation"
}
```

{% endtab %}
{% endtabs %}

## Accepting All Pending Friend Request

<mark style="color:blue;">`GET`</mark> `[endpoint]/v3/friend/request/accept-all`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |
| X-Api-Key<mark style="color:red;">\*</mark>     | String | API Key      |

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

```json
{
    "status": "success",
    "messages": "All pending friend request accepted"
}
```

{% endtab %}

{% tab title="400: Bad Request No pending request" %}

```json
{
    "status": "error",
    "messages": "No pending friend request"
}
```

{% endtab %}
{% endtabs %}

## Favorite Friends

## Adding Friend to Favorites

<mark style="color:green;">`POST`</mark> `[endpoint]/v3/friend/favorites/add`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |
| X-Api-Key<mark style="color:red;">\*</mark>     | String | API Key      |

#### Request Body

| Name                                                     | Type   | Description                    |
| -------------------------------------------------------- | ------ | ------------------------------ |
| target\_komo\_username<mark style="color:red;">\*</mark> | String | KOMO username to add favorites |

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

```json
{
    "status": "success",
    "messages": "Friend added to favorites"
}
```

{% endtab %}

{% tab title="400: Bad Request already favorited" %}

```json
{
    "status": "error",
    "messages": "Already added to favorites"
}
```

{% endtab %}
{% endtabs %}

## Removing Friend from Favorites

<mark style="color:green;">`POST`</mark> `[endpoint]/v3/friend/favorites/remove`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |
| X-Api-Key<mark style="color:red;">\*</mark>     | String | API Key      |

#### Request Body

| Name                                                     | Type   | Description                       |
| -------------------------------------------------------- | ------ | --------------------------------- |
| target\_komo\_username<mark style="color:red;">\*</mark> | String | KOMO username to remove favorites |

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

```json
{
    "status": "success",
    "messages": "Friend removed from favorites"
}
```

{% endtab %}

{% tab title="400: Bad Request friend not in fav list" %}

```json
{
    "status": "error",
    "messages": "Friend is not on favorite list"
}
```

{% endtab %}
{% endtabs %}

## Removing Friend

## Removing a Friend from Friend List

<mark style="color:green;">`POST`</mark> `[endpoint]/v3/friend/remove`

<mark style="color:red;">**WARNING!!! This will remove friend relation from both friend list**</mark>

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |
| X-Api-Key<mark style="color:red;">\*</mark>     | String | API Key      |

#### Request Body

| Name                                                     | Type   | Description                        |
| -------------------------------------------------------- | ------ | ---------------------------------- |
| target\_komo\_username<mark style="color:red;">\*</mark> | String | KOMO username of friends to remove |

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

```json
{
    "status": "success",
    "messages": "Friend removed successfully"
}
```

{% endtab %}

{% tab title="400: Bad Request User not friend with target" %}

```json
{
    "status": "error",
    "messages": "Friend relation not found"
}
```

{% 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.komoverse.io/player-api-reference/friend.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.
