Skip to main content

API One Pager

API document Log in

1、Message push

The API for sending messages to groups and individuals

If you are a go language developer ,to download the "sendmessage" SDK below:

Go-sdk download address: https://github.com/debox-pro/debox-chat-go-sdk

Gethttps://open.debox.pro/openapi/messages/group/send

Send text messages to groups
Call example:

  curl -X POST -H "Content-Type: application/json" \
-H "X-API-KEY: t2XJ........lEF6" \
-d '{"group_id":"l3ixp32y","object_name":"RCD:Graphic","title":"我是标题","content":"i am 富文本 \
{\"uitag\":\"a\",\"text\":\"点击我\",\"href\":\"https://debox.pro/\"}将跳转"}' \
"https://open.debox.pro/openapi/messages/group/send"

Parameters

Query

group_id : String Group ID of a group. Indicates the group to which the message is sent, not empty

to_user_id : String User ID of the user. Indicates the user of the @ who. The value can be blank

object_name : String Indicates the message type. must be "RC:TxtMsg"

message : String Literal message string, non-empty

X-API-KEY : String App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
{
"code":200,
"data":null,
"message":"success",
"success":false
}

Gethttps://open.debox.pro/openapi/messages/group/send

Rich text,suport text and image.
content contains texts and images
Example:

  curl -X POST -H "Content-Type: application/json" \
-H "X-API-KEY: t2XJ........lEF6" \
-d '{"group_id":"l3ixp32y","object_name":"RCD:Graphic","title":"我是标题","content":"i am 富文本 \
{\"uitag\":\"a\",\"text\":\"点击我\",\"href\":\"https://debox.pro/\"}将跳转"}' \
"https://open.debox.pro/openapi/messages/group/send"

Parameters

Query

group_id : String Group ID of a group. Indicates the group to which the message is sent, not empty

to_user_id : String User ID of the user. Indicates the user of the @ who. The value can be blank

object_name : String The message type. must be RCD:Graphic

title : String The title of the message

content : String The main part of the richtext message, which can insert hyperlinks and pictures

Header

X-API-KEY : String Api key, apply on platform https://developer.debox.pro/


1、Hyperlink
Example: {"uitag":"a","text":"USDC","href":"https://debox.pro/deswap"}
Convert the following JSON into string and put it in Content. In the Debox APP, a hyperlink will be displayed
var uiA = {
uitag: "a",
text: text,
href: href,
}
"uitag"="a", Indicates a hyperlink.
text, The hyperlink text
href, The website address of the hyperlink
2、Image
Example:{"uitag":"img","src":"https://domain.com/a.png","position":"foot","height":"500","href":""}
Convert the following JSON into string and put it in Content. In the Debox APP, a image hyperlink will be displayed
var uiImg = {
uitag: "img",
src: "<https://domain.com/a.png>",
position: "foot",
href: "<https://debox.pro>",
height: "500",
}
uitag="img" ,Indicates that it is a text image hyperlink
src:The image resource address
position:The position of the image,values are as follows:
head,It means that the picture is displayed at the top, in front of the title
foot,Indicates that the picture is displayed at the bottom
For other values, hide the picture without displaying anything
href,The hyperlink address of the image
When the white list address for DeBox, open it directly
When a non -white address, the bomb prompt warning box
When it is empty, or if there is no definition, display the enlarged picture
height: image height, values are as follows:
height> =0 ,image height is set to the value of height,
height<0、When the number is not configured or configured, the default value is used. The high default value of iOS, Android top picture is 115; the high default value of the bottom picture is 230
height=0, display nothing
3、A sample of the content:
coinName Price \n
{"uitag":"a","text":"USDT","href":"https://debox.pro/deswap"} 96.78k
{"uitag":"a","text":"USDC","href":"https://debox.pro/deswap"} 81.74k
{"uitag":"a","text":"OP_ETH","href":"https://debox.pro/deswap"} 2.55k
{"uitag":"a","text":"BNB","href":"https://debox.pro/deswap"} 3.95
{"uitag":"img","src":"https://domain.com/a.png","position":"head","height":”300”,"href":"https://www..."}
{"uitag":"img","src":"https://domain.com/b.png","position":"foot","height":"500","href":"https://www..."}
Display as follows:

pure text:
Docs Version Dropdown

image top,text bottom
Docs Version Dropdown

text top, image bottom:
Docs Version Dropdown

image top, text middle, image bottom :
Docs Version Dropdown

Responses

200: OK
{
"code":200,
"data":null,
"message":"success",
"success":false
}

Gethttps://open.debox.pro/openapi/messages/private/send

Send message to some user
Call example:


curl -X POST -H "Content-Type: application/json" \
-H "X-API-KEY: t2XAlEF6......" \
-d '{"to_user_id":"uvg2p6ho","object_name":"RCD:Command","message":"i am message"}' \
"https://open.debox.pro/openapi/messages/private/send"

Parameters

Query

to_user_id : String Userid of the user. Indicates the recipient of the message. The value is not empty

object_name : String Private message ,must be RCD:Command

message : String The message content

Header

X-API-KEY : String App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
{
"code":200,
"data":null,
"message":"success",
"success":false
}

2、Get user information such as user nickname, avatar and wallet address

Get the user's nickname, avatar, and wallet address

API about user information If you want to query information about a user, you can use the following interfaces.

Gethttps://open.debox.pro/openapi/user/info

Obtain user base information Usage Example:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/user/info?user_id=uvg2p6ho"

Parameters

Query

user_id : String Userid of the user. The userid of the authorized user, can be obtained during login authorization

X-API-KEY : String App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
{
"code": 1,
"data": {
"name": "ltx", // user name
"wallet_address": "0xsadf......34df", // wallet address
"avatar": "https://data.debox.space/nfts/0x67a7f09c/699-1.png",// user header image
"uid": "fxidfef4" // the same to user_id
},
"message": "success",
"success": true
}

Gethttps://open.debox.pro/openapi/user/is_follow

Verify whether a user is following another user
Usage Example:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/user/is_follow?\
walletAddress=0x2267......&chain_id=1&followAddress=0xB63219a8E0D367d87BA1c8B0736CbfDbf2cD459F"

Parameters

Query

walletAddress : The follower's wallet address

followAddress : The wallet address of the person being followed

Header

X-API-KEY App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
{"case3702":false}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}
401: Unauthorized
{"error":"Bad Request","code":401,"message":"Param error"}

3、Community (group) information

This is a community-related API, such as you can query the basic information of a community, Luckybox sent data and so on.

Gethttps://open.debox.pro/openapi/group/info

Obtain the current group information
Usage Example:

curl -X GET -H "X-API-KEY: t2XAlEF6......"  \
"https://open.debox.pro/openapi/group/info?\
group_invite_url=https://m.debox.pro/group?id=fxi3hqo5"

Parameters

Query

group_invite_url : Group sharing URL, on the App side, click group sharing, copy the link to get it

X-API-KEY : App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
# is_charge          Whether charge or not
# subchannel_number Number of subchannels
# group_name The name of the group
# group_number The number of the group
# group_pic The cover of the group
# create_time the Create time of the group
# maximum the max Number of the group
# mod The array of mod
{
"code": 200,
"data": {
"is_charge": true,
"subchannel_number": 3,
"group_name": "aaa",
"group_number": 29,
"group_pic": "https://data.debox.pro/static/2022/09/19/static/2022/09/19/100009_1435000131.jpg",
"create_time": "2022-04-30 16:03:24",
"maximum": "500",
"mod": [
"MOD1",
"MOD2"
]
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

Gethttps://open.debox.pro/openapi/group/is_join

Verify whether the user is in the group
Usage Example:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/group/is_join?\
walletAddress=0x2267......&url=https://m.debox.pro/group?id=fxi3hqo5"

Parameters

Query

walletAddress : The wallet address, which represents the user to be authenticated

url : The URL of the group , represent a group

chain_id : Blockchain network ID, default 1, Ethereum Mainnet

Header

X-API-KEY : App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
{"case3701":false}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}
401: Unauthorized
{"error":"Bad Request","code":401,"message":"Param error"}

4、Moment, likes, followers between users

The API related to moment

Gethttps://open.debox.pro/openapi/moment/praise_info

Get the like information of all moments posted by the user corresponding to the current address

Usage Example:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/moment/praise_info?\
wallet_address=0x2267......&chain_id=1"

Parameters

Path

moment/praise_info

Query

wallet_address : Wallet address, representing a user

chain_id : Blockchain network ID, default value 1, Ethereum mainnet

X-API-KEY : App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
# receive_praise_total  The total number of likes some one has received
# send_praise_total The total number of likes that some one gives to others
{
"code": 1,
"data": {
"receive_praise_total": 46,
"send_praise_total": 208
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

Gethttps://open.debox.pro/openapi/moment/give_praise

Whether a user likes a moment
Usage Example:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/moment/give_praise?\
wallet_address=0x2267......&chain_id=1&moment_id=oo0epx1p"

Parameters

Query

wallet_address : Wallet address, representing a user

chain_id : Blockchain network ID, default value 1, Ethereum mainnet

moment_id : Moment ID: representing a moment

Header

X-API-KEY :App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
# is_praise  Whether liked
{
"code": 1,
"data": {
"is_praise": false
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

Gethttps://open.debox.pro/openapi/moment/receive_praise

Gets the total number of likes for a Moment
Usage Example:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/moment/receive_praise?moment_id=oo0epx1p"

Parameters

Query

wallet_address : Wallet address, representing a user

chain_id : Blockchain network ID, default value 1, Ethereum mainnet

moment_id : Moment ID: representing a Moment

Header

X-API-KEY App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
# receive_praise_total  Number of likes
{
"code": 1,
"data": {
"receive_praise_total": 5
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

5、Voting、Giveaway

The API related to voting and Giveaway information.

Gethttps://open.debox.pro/openapi/vote/info

Obtain the number of votes cast by the current address user in the current group

Parameters

Query

wallet_address : Wallet address, which represents a user

chain_id : Blockchain network ID, default 1, Ethereum Mainnet

group_invite_url : Group share URL, which represents a group

X-API-KEY App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
# vote_number   Number of votes
{
"code": 200,
"data": {
"vote_number": 6//Number of votes
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

Gethttps://open.debox.pro/openapi/lucky_draw/info

GET https://open.debox.pro/openapi/group/is_join Get the number of Luckydraws of the current address user in the current group

Parameters

Query

wallet_address : Wallet address, which represents a user

chain_id : Blockchain network ID, default value 1, Ethereum mainnet

group_invite_url : Group share URL, which represents a group

Header

X-API-KEY App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
# initiate_luckDraw_total Total number of draws initiated
# luckDraw_total Total number of entries to the draw
# luckDraw_win_total Total number of wins
{
"code": 1,
"data": {
"initiate_luckDraw_total": 3,
"luckDraw_total": 3,
"luckDraw_win_total": 3
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

6、LuckyBox

The API related to LuckyBox

Gethttps://open.debox.pro/openapi/lucky_box/user222

Get Luckybox information sent/received by address user

Parameters

Path

moment/praise_info

Query

wallet_address : Wallet address, which represents a user

chain_id : Blockchain network ID, default 1, Ethereum Mainnet

X-API-KEY App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
# receive_luckyBox_number   Number of LuckyBox received
# receive_luckyBox_total Number of LuckyBox received (amount)
# send_luckyBox_number Number of LuckyBox sent
# send_luckyBox_total Number of LuckyBox sent (amount)
{
"code": 1,
"data": {
"receive_luckyBox_number": 12,
"receive_luckyBox_total": 1235.9,
"send_luckyBox_number": 18,
"send_luckyBox_total": 3199.58
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

Gethttps://open.debox.pro/openapi/lucky_box/user/group

The number of LuckyBox received by a user in a particular group

Parameters

Query

wallet_address : Wallet address, which represents a user

chain_id : Select The blockchain network from which you want to obtain data

group_invite_url : Group share URL, which represents a group

Header

X-API-KEY App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
# receive_luckyBox_number  Number of LuckyBox received
{
"code": 1,
"data": {
"receive_luckyBox_number": 8 Number of LuckyBox received
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

Gethttps://open.debox.pro/openapi/lucky_box/group

Get the total amount of LuckyBox sent by the current group
Usage Example:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/lucky_box/group?\
group_invite_url=https://m.debox.pro/group?id=fxi3hqo5"

Parameters

Query

group_invite_url : Group share URL, which represents a group

Header

X-API-KEY : App Key, apply on platform https://developer.debox.pro/

Responses

200: OK
# sum_amount The total vDBX sended
# total_num The total number sended
{
"code": 200,
"data": {
"sum_amount": 3896,
"total_num": 30
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

7、Authorized Login

DeBox Authorized Login is a login system based on OAuth2.0 protocol standards.Details

Gethttps://app.debox.pro/oauth/authorize

In DeBox App,Click the link to jump to the authorization interface, and the user clicks or cancels at the interface. After the user allows authorization, the page will jump to the redirect url and bring Code & Userid & Source

  https://app.debox.pro/oauth/authorize/?
app_id=ohpdAP9W55gyXeJ0&grant_type=authorization_code&scope=payment&response_type=code&
pay_info=loginTest&redirect_uri=https://docs.debox.pro/demo/a.html

Parameters

Query

redirect_uri : String Callback url after the authorization is successful. When the user clicks authorization, the App will return the code as a parameter to the url

app_id : String App ID on Developer plateform

scope : String Authorization field : payment represents payment authorization and moment represents moment message authorization

grant_type : String Indicates that the authorization mode is the authorization code:authorization_code

Posthttps://open.debox.pro/openapi/oauth2/access_token

Once you have the code from Step 1, request the following link to get it access_token:

  curl --location --request GET
https://open.debox.pro/openapi/oauth2/access_token?
grant_type=authorization_code&code=ZDY5ZTA......FRE5
&app_id=xxxxxx&app_secret=xxxxxx&user_id=xxxxxx

Parameters

Query

grant_type : String Indicates that the authorization mode is:authorization_code


code : String code from Step 1

app_id : String App ID on Developer plateform

app_secret : String App Secret on Developer plateform

user_id : String user_id from Step 1

Responses

200: OK
  {
"code": 1,
"data": {
"access_token":
"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODgzOTQ4MDMsInN1YiI6IjEwMzA1O
CJ9.hbEt8JthQvo85iGkhUiPpTlcII4n3hgOYDErUDS9X2kkOnsNM27pAO_x9WP4KEE_33uFEd6GOgS
A51MlYZakb1",
"expires_in": 1,
"refresh_token": "MDBMOWYZYWYTZMRLYS01ODRHLWJKYTUTZGFIMMU1ZDEZNWM3",
"token_type": ""
},
"message": "success",
"success": true
}
401: Failed
  { 
"code": 401,
"message": "Bad Request",
"success": false
}

Posthttps://open.debox.pro/openapi/oauth2/refresh_token

Refresh access_token

curl --location --request GET
https://open.debox.pro/openapi/oauth2/refresh_token?
grant_type=refresh_token&refresh_token=YTNMYMZJZMY......ZTAH
&app_id=xxxxxx&app_secret=xxxxxx&user_id=xxxxxx

Parameters

Query

grant_type : String Indicates that the authorization mode is:refresh_token


refresh_token : String refresh_token from Step 2

app_id : String App ID on Developer plateform

app_secret : String App Secret on Developer plateform

user_id : String user_id from Step 1

Responses

200: OK
  {
"code": 1,
"data": {
"access_token":
"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODgzOTQ4MDMsInN1YiI6IjEwMzA1O
CJ9.hbEt8JthQvo85iGkhUiPpTlcII4n3hgOYDErUDS9X2kkOnsNM27pAO_x9WP4KEE_33uFEd6GOgS
A51MlYZakbg",
"expires_in": 1,
"refresh_token": "MDBMOWYZYWYTZMRLYS01ODRHLWJKYTUTZGFIMMU1ZDEZNWM3",
"token_type": ""
},
"message": "success",
"success": true
}
401: Failed
 {
"code": 401,
"message": "Bad Request",
"success": false
}

8、Authorized Payment

DeBox provides a payment authorization API based on vDBX to provide a broader application scenario for vDBX.

Gethttps://app.debox.pro/oauth/authorize

The onetime token API is used to generate the order number and token of integral payment, and is combined with the following /payment/transfer API to complete the integral payment function.

Parameters

Query

redirect_uri : String Authorization succeeded callback address, need encodeURIComponent

app_id : String Application unique identification, DeBox developer community application

scope : String Scope of authority(payment)

grant_type : String Type of authority(onetime_token)

amount : Number Amount, two decimal places at most

payer_user_id : String The payer. when pay_type is "send", this param is the user_id of authority; when pay_type is "receive", this param is the user_id of developer

receiver_user_id : String The receiver. when pay_type is "send", this param is user_id of developer; when pay_type is "receive", this param is the user_id of authority

pay_type : String The role of authority. pay_type is "send" means authority is payer, pay_type is "receive" means authority is receiver

pay_info : String Pay information

Responses

200: OK
{ 
"code": "xxx", //Authorize token, Valid for 5 minutes
"serial_id": "xxx", // Serial number
"source ": "debox" // From where
}

Posthttps://open.debox.pro/openapi/payment/transfer

Transfer API

Parameters

Query

app_id : App ID, apply on platform https://developer.debox.pro/

app_secret : App Secret, apply on platform https://developer.debox.pro/

Body

access_token : The code from /onetime_token

serial_id : Serial number

Responses

200: OK
{ 
"code": "", // error code, 1 means success
"msg": "",
"source ": "debox" // from where
}
Payment authorization error code

-2001 User login validity problem, you can try to log in again
-2004 Parameter invalid
-2006 The transaction parameters are not valid
-2010 Code expired when access token
-2011 Invalidate code when get access token
-2012 Refresh access token failed
-2013 Access token expired
-2014 System exception, please try again
-2015 Access token Check failure
-2016 Make repeated transfer requests
-2028 System exception, please try again
-2030 System exception, please try again
-7048 The balance is insufficient, the transfer failed
-7052 System exception, please try again