# How to create a useApi Hook?

**URL:** <https://community.auth0.com/t/how-to-create-a-useapi-hook/99931>\
**Category:** Get Help\
**Tags:** regular-database-connections, connections\
**Created:** [February 7, 2023, 7:27pm UTC](https://community.auth0.com/t/how-to-create-a-useapi-hook/99931 "2023-02-07T19:27:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wspence](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/wspence/32/44210_2.png) [@wspence](https://community.auth0.com/u/wspence)\
**Post date:** [February 7, 2023, 7:27pm UTC](https://community.auth0.com/t/how-to-create-a-useapi-hook/99931/1 "2023-02-07T19:27:15Z")

</div>

I am using Auth0 with React and I desperately need some guidance on how to create a useApi hook. The funny thing is that “ **supposedly** ” you guys have one in your Github examples, but the link to view it does not work, it does not take you to any code or explanation. Here is the link to the page, just search for “useApi” and you will see that the links don’t go anywhere.

> <https://github.com/auth0/auth0-react/blob/master/EXAMPLES.md>

Does anyone know of any other resources where someone has created a useApi hook with Auth0???

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [February 8, 2023, 11:47am UTC](https://community.auth0.com/t/how-to-create-a-useapi-hook/99931/2 "2023-02-08T11:47:19Z")

</div>

Hey there!

Thanks fro raising that! Can I actually ask you to create it as a GitHub issue in the auth0-react repo so we can work on that directly with the SDK maintainers? Once you have a link to it make sure to share it here with us so we can ping them. Thank you!

---

<div class="post-metadata">

**Author:** ![wspence](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/wspence/32/44210_2.png) [@wspence](https://community.auth0.com/u/wspence)\
**Post date:** [February 8, 2023, 2:28pm UTC](https://community.auth0.com/t/how-to-create-a-useapi-hook/99931/3 "2023-02-08T14:28:51Z")

</div>

Here is the issue that I created on GitHub. Hopefully we will hear back from them soon.

> <https://github.com/auth0/auth0-react/issues/499>
>
> I am having a lot of issues successfully creating a useApi hook so I came to you…r documentation to find out more about it. In your examples at the link below, you have a specific link that says "\*\*Create a useApi hook for accessing protected APIs with an access token\*\*", but when you click on it it does not take you anywhere, does not display any code, or discuss creating a useApi hook. It is an empty link. Any chance you guys could fill in that section soon?
> 
> https://github.com/auth0/auth0-react/blob/master/EXAMPLES.md

---

<div class="post-metadata">

**Author:** ![af7777](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/af7777/32/49111_2.png) [@af7777](https://community.auth0.com/u/af7777)\
**Post date:** [September 13, 2023, 10:56pm UTC](https://community.auth0.com/t/how-to-create-a-useapi-hook/99931/4 "2023-09-13T22:56:42Z")

</div>

The issue was closed with [an answer of sorts](https://github.com/auth0/auth0-react/issues/499#issuecomment-1422710152) but the problematic link still exists here:  
[https://auth0.com/docs/quickstart/spa/react/02-calling-an-api#get-an-access-token](https://auth0.com/docs/quickstart/spa/react/02-calling-an-api#get-an-access-token)

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [September 13, 2023, 11:39pm UTC](https://community.auth0.com/t/how-to-create-a-useapi-hook/99931/5 "2023-09-13T23:39:18Z")

</div>

Hey @af7777 welcome to the community and thanks for sharing! I’ve submitted a PR to update our docs.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 8, 2024, 10:40am UTC](https://community.auth0.com/t/how-to-create-a-useapi-hook/99931/6 "2024-01-08T10:40:25Z")

</div>

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon I’m excited to let you know about our next [Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team](https://community.auth0.com/t/auth0-community-ask-me-anything-rules-hooks-and-why-actions-matter/124043) on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

[Learn more here!](https://community.auth0.com/t/auth0-community-ask-me-anything-rules-hooks-and-why-actions-matter/124043)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 20, 2024, 9:34pm UTC](https://community.auth0.com/t/how-to-create-a-useapi-hook/99931/7 "2024-11-20T21:34:35Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
