---
# System prepended metadata

title: API Wallet integration

---

# API Wallet integration



## Auth
###### Use the client secret to get the session token.

> [color=orange]
> **POST** {url}/auth/get-token
>
> body:

```json
{
    "secret": "{secret_hash}" //provided by operator
}
```
> [color=orange]
>
> response:

```json
{
    "session_token": "{session_token}" // bearer token to use in all request
}
```

## Methods



### Get balance

###### Provide the session token in the authorization header

> [color=blue]
> **GET** {url}/get-balance/{user_id}
>
> header:
>     authorization: "Bearer {session_token}"
>
> response:
```json
{
    "balance":  1000 
}
```
> **Posible responses:**
> 401 : Unauthorized (header without token or wrong format)
> 403 : Forbidden Access (token expired)
> 404 : User not found
> 200 : Success

### Debit
###### Provide the session token in the authorization header

> [color=orange]
> **POST** {url}/transaction/debit
>
> header:
>     authorization: "Bearer {session_token}"
>
> response:
```json
{
    "user_id": "{uuid}",
    "amount":  10,
    "message": "Place bet for game XX",
    "pow_id": "{game_session_hash}" 
}
```
> **Posible responses:**
> 401 : Unauthorized (header without token or wrong format)
> 403 : Forbidden Access (token expired)
> 404 : User not found
> 200 : Success


### Credit
###### Provide the session token in the authorization header

> [color=orange]
> **POST** {url}/transaction/credit
>
> header:
>     authorization: "Bearer {session_token}"
>
> response:
```json
{
    "user_id": "{uuid}",
    "amount":  18,
    "message": "Won credits for game XX",
    "pow_id": "{game_session_hash}" 
}
```
> **Posible responses:**
> 401 : Unauthorized (header without token or wrong format)
> 403 : Forbidden Access (token expired)
> 404 : User not found
> 200 : Success


### Get Transactions by filter (max 10000)
###### Provide the session token in the authorization header


> [color=blue]
> **GET** {url}/transactions?user_id={user_id}&date_from={date_from}&date_to={date_to}&game_session_hash={game_session_hash}
>
> header:
>     authorization: "Bearer {session_token}"
>
> response:
```json
[
    {
        "user_id": "{uuid}",
        "amount":  18,
        "message": "Won credits for game XX",
        "pow_id": "{game_session_hash}"
    },
    {
        "user_id": "{uuid}",
        "amount":  18,
        "message": "Won credits for game XX",
        "pow_id": "{game_session_hash}"
    },
    {
        "user_id": "{uuid}",
        "amount":  18,
        "message": "Won credits for game XX",
        "pow_id": "{game_session_hash}"
    }
]
```
> **Posible responses:**
> 401 : Unauthorized (header without token or wrong format)
> 403 : Forbidden Access (token expired)
> 200 : Success

