$ACE Token and Discounts

The Ace Data Cloud platform supports a discount mechanism for $ACE token staking. Users can bind their wallet address and enjoy discounts on API call fees by holding $ACE tokens.

This document describes the API interfaces related to tokens, all of which require authentication. For details, please refer to Platform Token.

Bind Wallet Address

Bind your blockchain wallet address to your Ace Data Cloud account.

  • Request Method: POST
  • Request URL: https://platform.acedata.cloud/api/v1/coin-infos/
  • Request Headers:
    • accept: application/json
    • content-type: application/json
    • authorization: Bearer {token}

Request Parameters

Parameter Type Required Description
address string Yes Blockchain wallet address

CURL Request Example

curl -X POST \
  -H "accept: application/json" \
  -H "content-type: application/json" \
  -H "authorization: Bearer {token}" \
  -d '{"address": "0x1234567890abcdef..."}' \
  "https://platform.acedata.cloud/api/v1/coin-infos/"

Response Example

{
  "id": "coin-uuid",
  "user_id": "b87f67c1-b04f-4332-99a1-7a5e651331c6",
  "address": "0x1234567890abcdef...",
  "balance": 0,
  "tags": null,
  "metadata": null,
  "created_at": "2024-08-01T10:00:00.000000Z",
  "updated_at": "2024-08-01T10:00:00.000000Z"
}

Query Token Balance

Get the token balance information of the bound wallet.

  • Request Method: GET
  • Request URL: https://platform.acedata.cloud/api/v1/coin-infos/
curl -X GET \
  -H "accept: application/json" \
  -H "authorization: Bearer {token}" \
  "https://platform.acedata.cloud/api/v1/coin-infos/"

Response Example

{
  "count": 1,
  "results": [
    {
      "id": "coin-uuid",
      "user_id": "b87f67c1-b04f-4332-99a1-7a5e651331c6",
      "address": "0x1234567890abcdef...",
      "balance": 10000,
      "created_at": "2024-08-01T10:00:00.000000Z",
      "updated_at": "2024-08-16T07:51:15.603207Z"
    }
  ]
}

Update On-chain Balance

Manually trigger an update of the on-chain $ACE token balance.

  • Request Method: POST
  • Request URL: https://platform.acedata.cloud/api/v1/coin-infos/{id}/update-balance/
curl -X POST \
  -H "accept: application/json" \
  -H "authorization: Bearer {token}" \
  "https://platform.acedata.cloud/api/v1/coin-infos/{id}/update-balance/"

Query Discount Policies

Get the list of token staking discount policies to understand the discount rates corresponding to different holdings.

  • Request Method: GET
  • Request URL: https://platform.acedata.cloud/api/v1/coin-policies/
curl -X GET \
  -H "accept: application/json" \
  -H "authorization: Bearer {token}" \
  "https://platform.acedata.cloud/api/v1/coin-policies/"

Response Example

{
  "count": 3,
  "results": [
    {
      "id": "policy-uuid-1",
      "service_id": "service-uuid",
      "level": 1,
      "threshold": 1000,
      "percentage": 0.95,
      "service": {
        "id": "service-uuid",
        "alias": "midjourney",
        "name": "Midjourney"
      }
    },
    {
      "id": "policy-uuid-2",
      "service_id": "service-uuid",
      "level": 2,
      "threshold": 10000,
      "percentage": 0.9
    },
    {
      "id": "policy-uuid-3",
      "service_id": "service-uuid",
      "level": 3,
      "threshold": 100000,
      "percentage": 0.8
    }
  ]
}

Response Field Description

Field Type Description
service_id string Applicable service ID
level integer Discount level
threshold number Required amount of $ACE tokens threshold
percentage number Discount coefficient (e.g., 0.9 means 10% off)

Discount Mechanism Description

When the number of $ACE tokens held by the user reaches a certain threshold, discounts will automatically apply when calling the corresponding service's API:

  1. The system checks the $ACE token balance in the user's bound wallet.
  2. The highest discount level is matched based on the balance.
  3. The API call will automatically deduct fees according to the discount rate.

For example, holding 10,000 $ACE tokens, when calling the Midjourney service, a 10% discount ( percentage: 0.9) is applied, originally consuming 4.95 credits, but only 4.455 credits are deducted.

Code Example

Python:

import requests

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}"
}

# Query token information
response = requests.get("https://platform.acedata.cloud/api/v1/coin-infos/", headers=headers)
data = response.json()
if data["results"]:
    coin = data["results"][0]
    print(f"Wallet Address: {coin['address']}")
    print(f"Token Balance: {coin['balance']}")

# Query discount policies
response = requests.get("https://platform.acedata.cloud/api/v1/coin-policies/", headers=headers)
for policy in response.json()["results"]:
    print(f"Holding {policy['threshold']} $ACE → {policy['percentage'] * 100}% discount")