GuidesAPI Reference
DocumentationLog In

Getting started

Overview

  • All examples assume you have set BTAPIKEY to your API token (eg export BTAPIKEY=<token>).
  • All API calls must include your API token using -H "apikey:<token>" where <token> is your API token.

Since results are generally JSON objects, it’s convenient to format results with jq.

If you don't have jq installed, you should install it:

  • On Mac: brew install jq (if you do not have brew installed, you'll need to install that first)
  • On Linux: apt add jq (on Debian/Ubuntu) or similar package manager for your distribution

Getting started - discover your Clusters:

curl -s https://api.bisontrails.co/eth2/v1/clusters -X GET -H "apikey: $BTAPIKEY" | jq

Use the resourceID as the $TARGETRESOURCE variable for your next request. You must also have a valid eth2 withdrawal address to complete the next request

Request validator allocation:

curl -s https://api.bisontrails.co/eth2/v1/validators -X POST -H "apikey: $BTAPIKEY" -H "Content-Type: application/json" -d '{"count":1, "withdrawalAddress":"$WITHDRAWALADDRESS", "targetResource":"$TARGETRESOURCE",
    "resultType":"depositData"}' | jq

Get recent (2) allocations. If you already have an allocationID from the previous step, you may skip this step:

curl -s https://api.bisontrails.co/eth2/v1/allocations -X GET -H "apikey: $BTAPIKEY" -H "Content-Type: application/json" -d '{"limit":2}' | jq

Query allocation status/results using the allocationID as the $ALLOCATIONID variable for the next step:

curl -s https://api.bisontrails.co/eth2/v1/allocations/$ALLOCATIONID -X GET -H "apikey: $BTAPIKEY" | jq

If you would like to submit a sample deposit, learn more in "Submitting Deposit Data"