It is important to protect your API routes to ensure that only authenticated users can access them. You can do this by checking if the userId is present in the getAuth() response, like in the following example:
getAuth() returns getToken(), which is a method that returns the current user's session token. You can also use this function to retrieve a custom JWT template, like in the following example:
clerkClient is used to access the Backend SDK, which exposes Clerk's backend API resources. You can use getAuth() to pass authentication information that many of the Backend SDK methods require, like in the following example: