Users

Работа с пользователями

Verifying and/or retrieving user

GET /api/tg/users/me

Headers

Body

Response

{
    "isNew": false,
    "user": {
        "id": 2,
        "created_at": "2024-07-13T16:36:40.334Z",
        "updated_at": "2024-07-13T16:52:48.867Z",
        "deleted_at": null,
        "telegram_id": 783973627,
        "address": "Second",
        "name": "Second",
        "score": 800,
        "invitation_number": 3,
        "referral_code": "5CW0x5TJ9",
        "wallets": [
            {
                "id": "259838ce-35d4-4ab2-9567-29cd59cf5f96",
                "created_at": "2024-07-13T16:47:27.373Z",
                "updated_at": "2024-07-13T16:47:27.403Z",
                "deleted_at": null,
                "name": "Second wallet",
                "address": "0x45ro3efn3efe300f3e0f3efe0feifffe30f2",
                "owner_id": 2
            },
            {
                "id": "ae4f77af-acc2-4aad-a343-726b7e076083",
                "created_at": "2024-07-13T16:47:16.481Z",
                "updated_at": "2024-07-13T16:47:16.517Z",
                "deleted_at": null,
                "name": "Ton Space wallet",
                "address": "0x45ro3efn3efe300f3e0f3efe0feifffe30fi",
                "owner_id": 2
            }
        ],
        "referrer": {
            "id": 1,
            "created_at": "2024-07-13T16:35:05.511Z",
            "updated_at": "2024-07-13T16:42:49.503Z",
            "deleted_at": null,
            "address": "First",
            "name": "firzt",
            "score": 200,
            "telegram_id": 75771603,
            "invitation_number": 1,
            "referral_code": "4N6f7FCXKa",
            "wallets": []
        },
        "referrals": [
            {
                "id": 3,
                "created_at": "2024-07-13T16:45:04.596Z",
                "updated_at": "2024-07-13T16:50:48.590Z",
                "deleted_at": null,
                "telegram_id": 1783973627,
                "address": "Third",
                "name": "Third",
                "score": 200,
                "referral_code": "2IGZhR"
            },
            {
                "id": 4,
                "created_at": "2024-07-13T16:51:15.995Z",
                "updated_at": "2024-07-13T16:51:59.845Z",
                "deleted_at": null,
                "telegram_id": 1883973627,
                "address": "Third",
                "name": "Third",
                "score": 200,
                "referral_code": "cOLfGH0y"
            },
            {
                "id": 5,
                "created_at": "2024-07-13T16:52:48.786Z",
                "updated_at": "2024-07-13T16:52:48.852Z",
                "deleted_at": null,
                "telegram_id": 783973628,
                "address": "Third",
                "name": "Third",
                "score": 200,
                "referral_code": "HxNFL0DY0"
            }
        ]
    }
}

Create user

POST /api/tg/users

Headers

Body

Response

{
    "result": true,
    "message": "User has been already created",
    "user": {
        "id": 2,
        "created_at": "2024-07-13T16:36:40.334Z",
        "updated_at": "2024-07-13T16:45:11.015Z",
        "deleted_at": null,
        "address": "Second",
        "name": "Second",
        "score": 400,
        "invitation_number": 1,
        "referral_code": "5CW0x5TJ9",
        "wallets": [],
        "referrer": {
            "id": 1,
            "created_at": "2024-07-13T16:35:05.511Z",
            "updated_at": "2024-07-13T16:42:49.503Z",
            "deleted_at": null,
            "address": "First",
            "name": "firzt",
            "score": 200,
            "invitation_number": 1,
            "referral_code": "4N6f7FCXKa",
            "wallets": []
        },
        "referrals": [
            {
                "id": 3,
                "created_at": "2024-07-13T16:45:04.596Z",
                "updated_at": "2024-07-13T16:45:04.648Z",
                "deleted_at": null,
                "address": "Third",
                "name": "Third",
                "score": 200,
                "referral_code": "2IGZhR"
            }
        ]
    }
}

Update user

POST /api/tg/users/profile

Headers

Body

Response

{
    "result": true,
    "message": "User profile updated",
    "user": {
        "id": 11,
        "created_at": "2024-07-06T13:36:43.213Z",
        "updated_at": "2024-07-06T13:37:01.931Z",
        "deleted_at": null,
        "address": "This is my new address",
        "name": "Ilia",
        "score": 0,
        "invitation_number": 0,
        "referral_code": "Cqyqg0av",
        "wallets": [
            {
                "id": "c9080346-dd64-4eb4-8868-48c9e190aaa9",
                "created_at": "2024-07-13T13:34:22.771Z",
                "updated_at": "2024-07-13T13:36:55.434Z",
                "deleted_at": null,
                "name": "wallet_name2",
                "address": "wallet_address222",
                "owner_id": 11
            }
        ],
        "referrer": null,
        "referrals": []
    }
}

Last updated