---
description: Raffle users related API endpoints.
---

# Users

{% hint style="info" %}
For query parameter `chain` see supported chains [here](..#supported-chains)
{% endhint %}

## Get all tickets for user in a pot

## Total number of tickets for user in the current pot

<mark style="color:blue;">`GET`</mark> `https://api.rpslabs/v1/user/{address}/pot/current`

Returns all tickets that user has in the current pot.

#### Query Parameters

| Name                                    | Type   | Description                            |
| --------------------------------------- | ------ | -------------------------------------- |
| chain<mark style="color:red;">\*</mark> | String | Blockchain hosting the raffle contract |

#### Headers

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

{% tabs %}
{% tab title="200: OK Success" %}
```json

{
    "NumOfTickets": 5,
    "wallet_address": "0xa22fe8d7b230a48de511669fefa957bdc97f2705",
    "pot_id": 4,
    "tickets": [
        {
            "ticket_id": 2224,
            "is_winner": false
        },
        {
            "ticket_id": 2225,
            "is_winner": false,
        },
        {
            "ticket_id": 2226,
            "is_winner": true,
        },
        {
            "ticket_id": 2228,
            "is_winner": false,
        },
        {
            "ticket_id": 2242,
            "is_winner": false,
        }
    ]
}
```
{% endtab %}

{% tab title="400: Bad Request Incorrect Chain" %}
```json
{
    "message": "INCORRECT_CHAIN",
    "code": 400
}
```
{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error" %}
```json
{
    "message": "INTERNAL_SERVER_ERROR",
    "code": 500
}
```
{% endtab %}
{% endtabs %}

## Total number of tickets for user in a pot

<mark style="color:blue;">`GET`</mark> `https://api.rpslabs/v1/user/{address}/pot/{pot_id}`

Returns all tickets that user has in the pot specified by `pot_id`.

#### Query Parameters

| Name                                    | Type   | Description                            |
| --------------------------------------- | ------ | -------------------------------------- |
| chain<mark style="color:red;">\*</mark> | String | Blockchain hosting the raffle contract |

#### Headers

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

{% tabs %}
{% tab title="200: OK Success" %}
```json
{
    "NumOfTickets": 5,
    "wallet_address": "0xa22fe8d7b230a48de511669fefa957bdc97f2705",
    "pot_id": 4,
    "tickets": [
        {
            "ticket_id": 2224,
            "is_winner": false
        },
        {
            "ticket_id": 2225,
            "is_winner": false
         },
        {
            "ticket_id": 2226,
            "is_winner": true
        },
        {
            "ticket_id": 2227,
            "is_winner": false
        },
        {
            "ticket_id": 2228,
            "is_winner": false
        }
    ]
}
```
{% endtab %}

{% tab title="400: Bad Request Incorrect Chain" %}
```json
{
    "message": "INCORRECT_CHAIN",
    "code": 400
}
```
{% endtab %}

{% tab title="400: Bad Request Incorrect Body" %}
```json
{
    "message": "INCORRECT_BODY",
    "code": 400
}
```
{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error" %}
```json
{
    "message": "INTERNAL_SERVER_ERROR",
    "code": 500
}
```
{% endtab %}
{% endtabs %}
