Endpoints

Here you can view information about existing endpoints and how to make requests for them. URL for requests: https://tganalytics.xyz

POST

This request is needed to record an event in the database

Body

Required

  • user_id

    • Type: number

    • Description: unique identifier for the user.

  • event_name

    • Type: string

    • Description: the name of the event from the supported

  • session_id

    • Type: string (must be UUID)

    • Description: session identifier for tracking user sessions

  • app_name

    • Type: string

    • Description: the name of the application that you specified when creating the token

Optional

  • is_premium

    • Type: boolean

    • Description: if the user has a premium account, by default - false

  • is_success

    • Type: boolean

    • Description: indicates whether a wallet is connected or the transaction was successful, by default - false

  • error_message

    • Type: string

    • Description: error message if the wallet connection or transaction is unsuccessful

  • error_code

    • Type: number

    • Description: error code if the wallet connection or transaction is unsuccessful

  • wallet_address

    • Type: string

    • Description: wallet address involved in the event

  • wallet_type

    • Type: string

    • Description: type of the wallet

  • wallet_version

    • Type: string

    • Description: version of the wallet software

  • auth_type

    • Type: enum(0 - 'ton_addr', 1 - 'ton_proof')

    • Description: type of authorization used

  • valid_until

    • Type: string

    • Description: timestamp until when a transaction offer is valid

  • from

    • Type: string

    • Description: wallet address initiating the transaction

  • messages

    • Type: { address: string; amount: string }[]

    • Description: list of transactions {to, amount} involved in the event. Hash is a hashed payload.

  • custom_data

    • Type: object

    • Description: object to store custom event details as needed

  • client_timestamp

    • Type: string

    • Description: the time when the event occurred on the clent

  • platform

    • Type: string

    • Description: the platform from which the MiniApp was opened

  • locale

    • Type: string

    • Description: user language code

  • start_param

    • Type: string

    • Description: tgWebAppStartParam

  • url_referer

    • Type: string

    • Description: the URL of the web application from which the request was sent

  • scope

    • Type: string

    • Description:

Request Body Example:

{
    "app_name": "miniks+b",
    "user_id": 4141151515151,
    "event_name": "wallet-disconnect",
    "session_id": "5457b197-4a8a-4b0d-b862-4ac540dae738",
    "is_premium": true,
    "messages": [["gfwfw",414.141],["4141",4141],
    "is_success": true,
    "error_message": "Error",
    "error_code": 400,
    "wallet_address": "tQxW414cggy514gkfq",
    "wallet_type": "wallet",
    "wallet_version": "0.0.1",
    "auth_type": "ton_proof",
    "from": "tQxW414cggy514gkfq",
    "valid_until": "1715249051436",
    "locale": "en",
    "start_param": "appstart",
    "ton_connect_lib": "@tonconnect/[email protected]",
    "platform": "tdesktop",
    "client_timestamp": "1716362131019",
    "custom_data": {
        "somedata":{
            "ton": "10$",
            "btc": "2$"
        }
    }
}

Headers

Instead of YOUR_TOKEN, you need to specify the token received using the bot

{
    "TGA-Auth-Token": "YOUR_TOKEN",
    "Content-Type": "application/json"
}

Responses

HTTP201

  • Description: the event has been successfully recorded

  • Content:

{
    "statusCode": 201,
    "message": "Success record."
}

HTTP400

  • Description: the token was entered incorrectly or in the wrong format

  • Content:

{
    "statusCode": 400,
    "message": "The token is not specified in the headers or is specified incorrectly."
}

HTTP400

  • Description: the entered token is invalid

  • Content:

{
    "statusCode": 400,
    "message": "Token is invalid."
}

HTTP400

  • Description: the request body contains the application name that does not match the token

  • Content:

{
    "statusCode": 400,
    "message": "Invalid app_name is specified."
}

HTTP403

  • Description: an attempt to use the API on a domain name that does not match the token

  • Content:

{
    "statusCode": 403,
    "message": "The domain name does not match."
}

HTTP404

  • Description: the transferred token does not exist

  • Content:

{
    "statusCode": 404,
    "message": "This token does not exist."
}

Last updated