API /coins/earn/rates

computer

The /coins/earn/rates API is used to retrieve the earning rates for a specified coin.

Reward rates can be returned for saving, staking and yield farming products.

Requests for this API should be made to:

GEThttps://coinpublishers.com/v1/api/coins/earn/rates

Remember to pass your API key in order to authenticate.

Request Parameters

The following are the parameters that can be passed to customise the response:

activities
string
The category of products that should be returned.

Possible values: SavingStakingYield Farming

coin* required
string

The symbol for the coin that you require data.

For example: "btc"

per_page
number

The number of data items that should be returned per page.

Default: 20

sort_field
string

The field that the returned data should be sorted on.

Default: rate

sort_direction
string

The order in which the data should be returned.

Default: All

terms
string

The minimum duration for which the deposited coins must remain.
- Flexible products can be withdrawn at any time.
- Fixed products are subject to a minimum deposit period.

Possible values: FixedFlexible

Default: All

The following is a example of a Curl request to the API:

curl
-H "x-cp_api_key: b54bcf4d-1bca-4e8e-9a24-221233d462c"
-H "Accept: application/json"
-d "activities=saving&coin=btc"
-G https://coinpublishers.com/api/v1/coins/earn/rates

Responses

The following is a list of the possible responses:

The following is an example of a successful response:

{
  "data": [
    {
      "activity": "Saving",
      "deposits": [
        {
          "symbol": "BTC",
          "name": "Bitcoin"
        }
      ],
      "rewards": [
        {
          "symbol": "BTC",
          "name": "Bitcoin"
        }
      ],
      "last_updated": "2022-08-16T01:01:14",
      "organization": "OKEx",
      "model": "CeFi",
      "rate": 500,
      "terms": {
        "durationInDays": 5,
        "type": "Fixed"
      }
    }
  ],
  "status": {
    "error_code": 0,
    "error_message": "",
    "current_page": 1,
    "pages": 6,
    "result": "OK",
    "timestamp": "2022-08-16T11:32:23"
  }
}

The following is an example of a failed response:

{
  "status": {
    "error_code": 401,
    "error_message": "Unauthorized access - please check your API key",
    "result": "NOK",
    "timestamp": "2018-06-06T07:52:27.273Z"
  }
}

Response Schema

The following is a description of the fields that can be returned in a response:

activity
string

The type of earning product.

Possible values: SavingStakingYield Farming

deposits
array

An array of objects that indicate what assets have to be deposited in order to earn the reward.

namestringE.g. "Bitcoin"
symbolstringE.g. "BTC"

This is normally just one asset but some yield farming products require depositors to provide two assets.

rewards
array

An array of objects indicating how the reward will be paid.

namestringE.g. "Bitcoin"
symbolstringE.g. "BTC"

This is typically just one asset but some yield farming products may pay a reward in two assets.

last_updated
timestamp
The date/time when the response was generated
organization
object

An object related to the organization providing the product.

namestring
model
string

The classification of the product.

Possible values: CeFiDeFiHybrid

rate
number
The rate of interest.
terms
object

An object describing whether the product is a flexible (withdraw anytime) or fixed term (minimum deposit duration).

typestring possible values: FixedFlexible

durationInDays number used to indicate the minimum number of days that a fixed term product must be deposited

F
error_code
number
HTTP error code - 200 if successful
error_message
string
The reason why the request failed
current_page
number
The current page of the paginated results.
pages
number
The number of pages that the response is paginated across.
result
string
"OK" if response successful
timestamp
timestamp
Current timestamp