Getting Started with YH Finance API

Set up your credentials to receive the API key to access the YH Finance API.

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.

Generate an API key

Follow these steps to get the API key:

  1. Go to the YH Finance API registration page and switch to the "Create Account" tab.

  2. 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.

  3. Enter the code you received in the email and click the "Confirm" button. This will redirect you to your dashboard.

  4. 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 using some hidden code to call a YH Finance API endpoint to validate the API key. Click the "Run" button after saving the API key to execute that code.

Press + to interact
checkValidation('{{API_KEY}}') //A function that helps us validate the API key

Now that we've validated the acquired API key via an API call, we can use it to test the endpoints that YH Finance API provides.

API key regeneration

The API key provided by YH Finance API might expire 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.