Getting Started with the PureStake API Service
The following is a simple walkthrough for using the PureStake API to interact with the Algorand network. While you can always run your own node, using an API service to query the network is significantly faster than downloading transaction data and configuring your own infrastructure.
Requirements
None
Background
For more information on the PureStake API, here are some helpful links:
- PureStake API site: https://developer.purestake.io/
- About the PureStake API: https://www.purestake.com/technology/algorand-api/
- The Postman documentation site: https://learning.postman.com/
- Code Samples: https://developer.purestake.io/code-samples
- API Examples: https://github.com/PureStake/api-examples
Steps
1. Create a PureStake API Account
Register for an account at https://developer.purestake.io/ . You can use the free tier with unlimited daily TestNet requests, up to 5,000 requests daily MainNet requests, and 5 requests per second for both TestNet or MainNet. More about PureStake’s pricing tiers.
Hit the Sign Up for Free option and fill out the registration form.
You will need a working email address since you’ll need to verify it as part of the signup process. Scroll to the bottom of the Terms & Conditions to enable the “I agree to the Terms and Conditions” checkbox.
You will get an email from [email protected] with a registration code that looks like this:
Make note of the code you are sent and enter that code into the following screen when prompted:
After submitting you will be logged into the API Services application.
2. Get Your Unique API Key
Once logged in, you will have access to an API key that is unique to your account.
Here you will see your API Key at the top of the screen. You will need to copy that key to be able to access the PureStake API service.
3. Verify the API Key with the Swagger UI, cURL, or Postman
Before using the API, you’ll want to verify that your key works. There are three primary ways to do that: directly in the PureStake interface using the Swagger UI, via a cURL command, or by using the Postman application.
Option A: Swagger UI
Navigate to the APIs section in the API portal. Choose the network (e.g., Algorand BetaNet, TestNet, or MainNet) in the left sidebar.
Click on /v1/status in the accordion menu to see more options.
Click the Try it out button.
Click Execute.
Scroll down to the Server response section. If the response body contains a valid entry, your API key has worked successfully.
Option B: cURL
To verify your API key, copy the cURL command from the top left sidebar of the PureStake API dashboard.
Paste the command into your terminal of choice and hit Enter.
If you receive a similar response from the server, your API key is valid. If not, double-check that copied and pasted the cURL command correctly.
Option C: Postman
If you’re new to Postman, it’s a graphical way to work with and test APIs. It’s free to download, and you can find more information on their website.
If you don’t already have an account, you’ll need to create one. Once you’ve signed up or logged in, select the New option in the left sidebar, and then Request from the dropdown menu.
Enter a name for the request and create or choose a folder.
You’ll need the URL of the endpoint for your GET Request. To find that, return to the PureStake API portal and copy the URL at the top of the APIs page (note that this URL will vary between BetaNet, TestNet, and MainNet). You can also find the URLs on the dashboard home page.
To create a URL for a specific endpoint, choose the BetaNet, TestNet, or MainNet URL and append it with the name of the endpoint (e.g., /health
).
Optional: You can also find the full URL in the Swagger UI for the endpoint you want. Click the endpoint, click “Try It Out” and then “Execute.” This actually runs the request on the live endpoint. You can then grab the URL or the cURL command for that request.
For this example, let’s check the status of the Algorand TestNet. The URL we need is https://testnet-algorand.api.purestake.io/ps1/v1/status
.
Copy the URL for the endpoint and return to Postman. In the GET field of the GET request you just created, paste the URL of the endpoint you’d like to query.
In the tabs below, click Headers. Under KEY, add x-api-key
. Under VALUE, paste the API key you received in Step 2.
Once you’ve populated both of these fields, click “Send.” You will receive a response as seen in the below screenshot. This verifies your API key is working.