# Next.js 13 how to Access an External API from an API Route using App Router api route?

**URL:** <https://community.auth0.com/t/next-js-13-how-to-access-an-external-api-from-an-api-route-using-app-router-api-route/116459>\
**Category:** Get Help\
**Tags:** rotating-refresh-tokens, sessions\
**Created:** [September 18, 2023, 8:06am UTC](https://community.auth0.com/t/next-js-13-how-to-access-an-external-api-from-an-api-route-using-app-router-api-route/116459 "2023-09-18T08:06:25Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [July 26, 2024, 1:17am UTC](https://community.auth0.com/t/next-js-13-how-to-access-an-external-api-from-an-api-route-using-app-router-api-route/116459/6 "2024-07-26T01:17:15Z")

</div>

Hi @arundas.tc,

When refreshing tokens, you need to ensure that the session is updated to extend the session. You can do this by including the `refresh: true` parameter.

For example:

```auto
export default async function MyHandler(req, res) {
  const accessToken = await getAccessToken(req, res, {
    refresh: true,
    afterRefresh,
  });
};

```

(Reference: [AccessTokenRequest | @auth0/nextjs-auth0](https://auth0.github.io/nextjs-auth0/interfaces/session_get_access_token.AccessTokenRequest.html#refresh))

Let me know how this goes for you.

Thanks,  
Rueben

---

_[View the full topic](https://community.auth0.com/t/next-js-13-how-to-access-an-external-api-from-an-api-route-using-app-router-api-route/116459)._
