# User Matches

> `GET /api/user/matches`: User endpoint of the Rone Arena API.

**Deprecated:** still answers, but will not receive further work. Prefer another endpoint.

**Sign-in required:** send `Authorization: Bearer <jwt>`. Get the JWT from `POST /api/user/auth/send-vc` then `POST /api/user/auth/login`.

Retrieve the authenticated player's recent matches information using a valid JWT. Supports query parameters for season filtering, pagination, and localization. Requires an Authorization header with the JWT from login.

Headers:
- **Authorization**: `Bearer <jwt>` (JWT obtained during login).

Query parameters:
- **sid**: Season ID for filtering matches (must be a valid season ID from `/api/user/season`).
- **limit**: Maximum number of matches to retrieve (minimum: 1).
- **last_cursor**: Cursor for pagination. Use the value from `pageInfo.nextCursor` in the current response. If `pageInfo.hasNext` is `false` or `pageInfo.nextCursor` is empty, there is no next page.
- **lang**: Language code for localized content (default: `en`).

The response includes match details:
- **sid**: Season ID.
- **bid**: Battle ID (unique match reference).
- **hid**: Hero ID used in the match.
- **k**: Kills.
- **d**: Deaths.
- **a**: Assists.
- **lid**: Lane ID (1 EXP, 2 Mid, 3 Roam, 4 Jungle, 5 Gold).
- **s**: Score (performance rating for the match, s/100).
- **mvp**: MVP flag (1 if MVP, 0 otherwise).
- **res**: Result (1 = Win, 0 = Loss).
- **ts**: Timestamp of the match.
- **hid_e**: Hero entity metadata (hero ID, name, images).
- **bid_s**: String battle ID representation.

Pagination example:
    First request: `/api/user/matches?sid=40&limit=10&lang=en` → response includes `pageInfo.nextCursor = 4139649383291049463`.
    Second request: `/api/user/matches?sid=40&limit=10&last_cursor=4139649383291049463&lang=en` → retrieves the next page, using `pageInfo.nextCursor` from the current response.
    Stop pagination when `pageInfo.hasNext = false` or `pageInfo.nextCursor` is empty.

The response also includes pagination metadata:
- **pageInfo.nextCursor**: Cursor value for the next page.
- **pageInfo.hasNext**: Boolean flag indicating if more results are available.
- **pageInfo.count**: Number of results returned in the current page.

This endpoint is useful for:
- Reconstructing match history.
- Analyzing player performance.
- Enabling clients to paginate reliably through a player's matches.

## Request

`GET https://arena.rone.dev/api/user/matches`

### Parameters

| Name | In | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `sid` | query | integer | yes |  | The season ID for filtering recent matches. |
| `limit` | query | integer | no | `10` | The maximum number of recent matches to retrieve. Range: 1... |
| `last_cursor` | query | string | no |  | Pagination cursor from `pageInfo.nextCursor` of the current response. |
| `lang` | query | string | no | `en` | Language code for localized content. One of: `en`, `id`, `ru`, `es`, `pt`, `tr`, `ar`, `de`, `fr`, `it`, `ja`, `ko`, `th`, `vi`, `zh-CN`, `zh-TW`, `km`. |

### Example

```bash
curl -X GET 'https://arena.rone.dev/api/user/matches?sid=<sid>' \
  -H 'Authorization: Bearer <jwt>'
```

## Example response

```json
{
  "code": 0,
  "message": "Success",
  "traceID": "53cd62802d24dc512ffd908e1d6d06bc",
  "data": {
    "pageInfo": {
      "nextCursor": "4143043017340290910",
      "hasNext": true,
      "count": 1
    },
    "result": [
      {
        "sid": 40,
        "bid": 4132717739868068400,
        "hid": 17,
        "k": 14,
        "d": 1,
        "a": 11,
        "lid": 4,
        "s": 1180,
        "mvp": 0,
        "res": 1,
        "ts": 1774857999,
        "hid_e": {
          "id": 17,
          "n": "Fanny",
          "ix": "https://wsrv.nl/?url=https%3A%2F%2Fakmweb.youngjoygame.com%2Fweb%2Fsvnres%2Fimg%2Fmlbb%2Fcommunity%2F100_ae8ca46da01da69619a6c03dc7069921.png",
          "i2x": "https://wsrv.nl/?url=https%3A%2F%2Fakmweb.youngjoygame.com%2Fweb%2Fsvnres%2Ffile%2Fmlbb%2Fhomepage%2F100_74fabc6c0d5db065fbb836b6879f36ca.jpg"
        },
        "bid_s": "4132717739868068534"
      }
    ]
  }
}
```

## Links

- Try it in the playground: https://arena.rone.dev/web/user/matches
- User endpoints: https://arena.rone.dev/web/user.md
- OpenAPI schema: https://arena.rone.dev/api/openapi.json
