How to Use an API

Overall flow

  • To use the API, users must register on the landing page and register a subscription plan (only for the first time).

  • After that, please obtain a refresh token and ID token (to be performed each time you use the API).

  • After obtaining the ID token, please use each API with the obtained ID token.

Quick Start Guide

We have a quick start guide for J-Quants API using Google Colaboratory. Please try it from the "Open in Colab" link below.

Step 1: Steps to start using the API (only for the first time)

  1. Temporarily register your email address with the J-Quants API service from the User Registration page.

  2. Click on the URL sent to your temporarily registered email address to complete user registration.

  3. After logging in to the menu screen from the sign-in page, you will be able to register your subscription plan.

To use the API, you need to register for one of the subscription plans, including the Free plan. Please refer to the FAQ for the difference between user registration and subscription plans.

Step 2: Steps for obtaining a refresh token (to be performed each time you use the API)

  1. After logging in to the menu page, copy the refresh token. In addition to the web screen, it is also possible to obtain a refresh token using the following API.

pageRefresh Token (/token/auth_user)
  • The refresh token expires in one week. After it expires, please log in to the menu page and copy the refresh token, or use the refresh token acquisition API to acquire the refresh token again.

  • Please note that the domain name to which you connect via API differs between the official version and the beta version. Following is an example for Refresh Token API;

     Official Version: https://api.jquants.com/v1/token/auth_user  Beta Version: https://api.jpx-jquants.com/v1/token/auth_user

Step 3: Steps for obtaining ID token (to be performed each time you use the API)

An ID token is required to obtain each data with the API. Set the refresh token obtained above to the ID token acquisition API below to obtain an ID token.

pageID Token (/token/auth_refresh)

ID tokens expire in 24 hours.

After it expires, please use the ID token acquisition API to acquire it again.

Step4: Please use each API with the obtained ID token.

Please refer to the following page for the detailed specifications of each API.

pageAPI Specifications

最終更新