Get Started
Set up your credentials to receive the API key to access the YH Finance API.
We'll cover the following
We'll need an API key for accessing the YH Finance API for any data. An API key is a token that a client provides when making API calls. In this lesson, we'll learn how to get an API key for our requests.
Create an account
We'll need an API key for accessing the YH Finance API and its data. Follow these steps to get the API key:
Go to the YH Finance API registration page and switch to the "Create Account" tab.
Enter your credentials, and click the "Create Account" button to create the account. A verification code will be sent to your email address, and you will be redirected to the verification page.
Enter the code you received in the email here and click on the "Confirm" button. This will redirect you to your dashboard.
Copy the API key from the top left side of your dashboard and paste it into the code widget below to be used throughout the course.
Click the "Edit" button below. Enter your API key and click "Save" to save it.
We're also using some hidden code to send a request to the YH Finance API to verify that the API key works correctly. Click the "Run" button after saving the API key to execute that code.
validate_key() #A function that helps us validate the API key
Now that we've verified the acquired API key via an API call, we can use it to test the endpoints that YH Finance API provides.
API key renewal
The API key provided by YH Finance API expires after a few hours. The API response for requests made with an expired API key is as below:
If you encounter this error, follow the steps in this lesson to get a new API key.