• Discover
  • Partner with us
  • Chapters
  • Blog

Learn everything about Circle and USDC

Course Intro
Blockchain in a Nutshell
Introduction to Circle
Stablecoins
USDC
Wallets

Section Overview
Getting API Key
Introduction to Wallets
Getting App Id
Create a User
Acquire Session Token
Initialize User
Create Wallet
Submit Your Homework 1
Section Summary

Section Overview
Check Wallet Status
Getting Test USDC
Check Wallet Balance
Getting Native Test Token
Initiate Transaction
Validating Transaction
Submit Your Homework 2
Section Summary
Bonus: Complete a Challenge with WebSDK

Section Overview
Account Types
Create SCA
Transfer and Verify
Submit Your Homework 3
Section Summary

Section Overview
Working With Dev Controlled Wallets
Submit Your Homework 4
Section Summary

Section Overview
CCTP in a Nutshell
CCTP
Section Summary

Submit Your Final Project

Getting USDC Using ZKP2P and Turkish Lira
Resources

What Are Session Token And Encryption Key?

A Session Token is a temporary credential that is generated by the Circle API for authenticating the user for subsequent requests to the API endpoints. A session token expires after a certain period of time or when the user logs out.

The Encryption Key is an encryption and decryption key that is randomly generated to ensure the security of the session.

Let's look at the code.

Acquiring Session Token Javascript Code

import axios from "axios";

export const acquire_session_token = async () => {

  const options = {

    method: "POST",

    url: "<https://api.circle.com/v1/w3s/users/token>",

    headers: {

      "Content-Type": "application/json",

      Authorization: `Bearer ${process.env.NEXT_PUBLIC_API_KEY}`,

    },

    data: { userId: [process.env.NEXT](http://process.env.NEXT)\_PUBLIC_USER_ID },

  };

  return axios

    .request(options)

    .then(function (response) {

      console.log("user token:", [response.data.data](http://response.data.data).userToken);

      console.log("encryption key:", [response.data.data](http://response.data.data).encryptionKey);

      return {

        userToken: [response.data.data](http://response.data.data).userToken,

        encryptionKey: [response.data.data](http://response.data.data).encryptionKey,

      };

    })

    .catch(function (error) {

      console.error(error);

    });

};

Here the code starts with an axios import like the previous ones.

import axios from "axios";

Let's continue with the options object.

const options = {

  method: "POST",

  url: "<https://api.circle.com/v1/w3s/users/token>",

  headers: {

    "Content-Type": "application/json",

    Authorization: `Bearer ${process.env.NEXT_PUBLIC_API_KEY}`,

  },

  data: { userId: [process.env.NEXT](http://process.env.NEXT)\_PUBLIC_USER_ID },

};
  • method: "POST": This specifies that the HTTP method to be used is POST. POST is used to send data to a server to create/update a resource.
  • url: "https://api.circle.com/v1/w3s/users/token": This is the URL where the HTTP request will be sent.
  • headers: This is an object that holds HTTP headers that will be sent along with the request. In this case, two headers are being sent:
  • "Content-Type": "application/json": This tells the server that the data being sent is in JSON format.
  • Authorization: Bearer ${process.env.NEXT_PUBLIC_API_KEY}: This is used for authorization. It sends a bearer token, which is stored in the environment variable NEXT_PUBLIC_API_KEY, to the server to authenticate the request.
  • data: { userId: process.env.NEXT_PUBLIC_USER_ID }: This is the data that will be sent to the server in the body of the POST request. It's an object with a single property userId, the value of which is taken from the environment variable NEXT_PUBLIC_USER_ID.
return axios

  .request(options)

  .then(function (response) {

    console.log("user token:", [response.data.data](http://response.data.data).userToken);

    console.log("encryption key:", [response.data.data](http://response.data.data).encryptionKey);

    return {

      userToken: [response.data.data](http://response.data.data).userToken,

      encryptionKey: [response.data.data](http://response.data.data).encryptionKey,

    };

  })

  .catch(function (error) {

    console.error(error);

  });
  • axios.request(options): This sends an HTTP request using the options object defined earlier. The options object includes details like the HTTP method to use (POST), the URL to send the request to, the headers, and the data to send.
  • .then(function (response) {...}): This is a Promise that gets resolved when the HTTP request is successful. The response object contains the server's response to our request. Inside this function:
  • return { userToken: response.data.data.userToken, encryptionKey: response.data.data.encryptionKey, }; returns an object with userToken and encryptionKey from the response data.
  • .catch(function (error) {...}): This is another Promise that gets resolved if the HTTP request fails for any reason. The error object contains details about the error. Inside this function, console.error(error); logs the error to the console.

Now that you have a user(session) token and an encryption key, you are ready to initialize the user.

Summary

In summary, in this section:

  • You have retrieved a user token
  • You have retrieved an encryption key
Previous
Next

Lesson discussion

Swap insights and ask questions about “Learn everything about Circle and USDC”.

Enroll to participate
Start the course to unlock the discussion. Enrolling helps us keep conversations relevant to learners.
WebsiteDiscoverPartner with UsBlogEvents
Discover
CoursesCircleRustSoliditySolanaWeb3 FundamentalsBlockchain Basics
CompanyAbout UsBrand GuidelineFAQsTerms of UsePrivacy PolicyGDPR NoticeCookies
Don't miss any update!

Disclaimer: The information, programs, and events provided on https://risein.com is strictly for upskilling and networking purposes related to the technical infrastructure of blockchain platforms. We do not provide financial or investment advice, nor do we make any representations regarding the value, profitability, or future price of any blockchain or cryptocurrency. Users are encouraged to conduct their own research and consult with licensed financial professionals before engaging in any investment activities. https://risein.com disclaims any responsibility for financial decisions made by users based on the information provided here.

© 2026 Rise In, All rights reserved