跳到主要内容

Binance Web3 API Specification V0.0.8 (2025-01-03)

Web3 API description

  • Binance's Partners need to follow the API specification in this doc to provide Binance with a set of endpoints in order to integrate with Binance.

General API Information

  • All endpoints return a common JSON object with "code", "message" and "data", no matter if it's a success or not.
  • Here "data" is either a customized JSON object or a simple type (int, string...). It may vary from endpoint to endpoint.
    {
    "code": "XXXXXX",
    "message": "success",
    "data": {
    "abc": "efg",
    ...
    }
    }
  • General codes in responses:
    codeDescription
    000000success
    000001too many requests
    000006invalid argument
    000007other error
  • All time and timestamp related fields are in milliseconds.
  • HTTP 5XX return codes are used for internal errors. The issue is on the partner's side. Binance will NOT treat this as a failure operation; the execution status is UNKNOWN.
  • For GET endpoints, parameters must be sent as a query string.
  • For POST, PUT , and DELETE endpoints, the parameters must be sent in the request body with content type application/x-www-form-urlencoded.
  • Parameters may be sent in any order.
  • Every partner needs to define a url prefix so that Binance can invoke the partner's endpoint using prefix + endpoint_url.
  • Each request and response should be logged in both Binance and partner's sides for further investigation.

API Specification​

Server Time

GET /v1/time
to check the partner's server time

Parameters: None

Response Body:

NameTypeMandatoryDescription
codeStringYES"000000"
messageStringYES"success"
dataLongYEStimestamp

Response examples:

{
"code": "000000",
"message": "success",
"data": 1499827319559
}

{
"code": "000002",
"message": "system busy",
"data": null
}

Task Completion

GET /v1/task/completion

Parameters:

NameTypeMandatoryDescription
walletAddressStringYESa user's unified id
taskString json arrayYEStask names. "deposit", "withdraw". if it's not empty, just return specific task completion status. Otherwise, return all tasks completion statuses.
recvWindowLongYESreceived window

Response Body:

NameTypeMandatoryDescription
codeStringYES
messageStringYES
dataJSON ObjectYEStimestamp

data:

NameTypeMandatoryDescription
walletAddressStringYESa user's unified id
taskString json arrayYEStask names. "deposit", "withdrawal"
timestampLongYESclient timestamp of the request

Examples:

GET {prefix} + /v1/task/completion?walletAddress=0xabcdefg&task=["deposit", "withdrawal"]&timestamp=1499827319559

Response:
{
"code": "000000",
"message": "success",
"data": {
"withdrawal": true, // complete
"deposit": false, // incomplete
}
}

{
"code": "000006",
"message": "invalid argument",
"data": null
}

Web3 API Performance

  • Ensure your API can support >=50 QPS.
    • In special cases, Binance will review your campaign and contact you to increase the API QPS threshold. (E.g. Marketing plan is possible to attract extra traffic to your campaign, or special task design will cause high peak verification queries)
    • API performance is vital. So please conduct a performance test on the API.
    • Before developing the API, review the campaign mechanism. Avoid mechanisms requiring all users to verify tasks at the same time. (E.g. a task user can only verify on the last day of a campaign)
    • When API encounters performance issues, please return an error (error code:000002) to the caller.

API Maintenance Periods:

  • Maintain the API till 3 days after the campaign end time.
    • E.g.: the campaign using your API ends on 1st Jan 2025 00:00(UTC), then the earliest time you can sunset the API is 4th Jan 2025 00:00(UTC)
    • Before you sunset the API, please ensure no traffic hits your API. If there is still traffic to your API, please contact the Binance team.

Other Good Practise for API Developing:

  • Use 95% of the original criteria to verify user’s task status.
    • E.g. for a task that requires the user to stake more than 10 USDT, the API should return completed (True) if the user takes more than 9.5 USDT.
  • Avoid API changes before sunsetting the API.
    • Please update stakeholders if the API has to be updated due to logic change or issue fix.
  • Monitor the API performances especially the 1st 4 hours after the campaign launch time.

Provide feedback on this document: https://forms.gle/zpBnQWCqoFMmby698