# What is difference between Applications and APIs? What do we use APIs?

**URL:** <https://community.auth0.com/t/what-is-difference-between-applications-and-apis-what-do-we-use-apis/102019>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [March 7, 2023, 8:47pm UTC](https://community.auth0.com/t/what-is-difference-between-applications-and-apis-what-do-we-use-apis/102019 "2023-03-07T20:47:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdruzhkov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rdruzhkov/32/45203_2.png) [@rdruzhkov](https://community.auth0.com/u/rdruzhkov)\
**Post date:** [March 7, 2023, 8:47pm UTC](https://community.auth0.com/t/what-is-difference-between-applications-and-apis-what-do-we-use-apis/102019/1 "2023-03-07T20:47:10Z")

</div>

I have a hard time figuring out the purpose of APIs (that are created in Auth0 dashboard).

![image](https://global.discourse-cdn.com/auth0/original/3X/8/f/8f5a69dff846fd293ce9a8fcce15d93f5d78a0ab.png)

What do I need the APIs for? How the APIs are different from Applications? How to use it?

---

<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:** [March 8, 2023, 1:34am UTC](https://community.auth0.com/t/what-is-difference-between-applications-and-apis-what-do-we-use-apis/102019/3 "2023-03-08T01:34:45Z")

</div>

Hi there @rdruzhkov and welcome to the community!

> [@rdruzhkov](#):
>
> What do I need the APIs for? How the APIs are different from Applications? How to use it?

The primary difference between the two is that an “API” as defined in Auth0 will logically represent your backend/API via the `API Identifier` also known as the `audience` whereas the Application as defined in Auth0 will provide the `client_id`, `secret`, etc. you’ll use to configure a client.

The following docs provide some more context on this relationship for example:

> **[React Router 6 Code Sample: Basic Authentication](https://developer.auth0.com/resources/code-samples/spa/react/basic-authentication/v17-javascript-react-router-5#connect-the-react-code-sample-with-an-api-server)**
>
> Code sample showing how to protect a simple React single-page application using React Router 6, Auth0, and JavaScript.

> **[Single-Page Applications (SPA) with API](https://auth0.com/docs/get-started/architecture-scenarios/spa-api)**
>
> Explains the architecture scenario where a single-page application (SPA) talks to an API using OpenID Connect (OIDC), and the OAuth 2.0 Implicit Grant Flow, to authenticate users with Auth0.

Hope this helps to clarify!

---

<div class="post-metadata">

**Author:** ![rdruzhkov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rdruzhkov/32/45203_2.png) [@rdruzhkov](https://community.auth0.com/u/rdruzhkov)\
**Post date:** [March 8, 2023, 9:57am UTC](https://community.auth0.com/t/what-is-difference-between-applications-and-apis-what-do-we-use-apis/102019/4 "2023-03-08T09:57:59Z")

</div>

Hi @ty.frith , thank you for the response!

So the main goal of having an API is to create `audience` value that will allow to the backend/API to understand if the `id_token`, `access_token` etc are intended to be used by the backend/API. Am I right?

If I’m right then why can’t we use application `client_id` as `audience`? I know that my backend/API is going to be used by the application. So it seems to me that on the backend/API side I can validate `audience` by checking if it’s equal to application `client_id`, since my application is allowed to interact with backend/API.

---

<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:** [April 29, 2023, 12:30am UTC](https://community.auth0.com/t/what-is-difference-between-applications-and-apis-what-do-we-use-apis/102019/5 "2023-04-29T00:30:19Z")

</div>

Hey there @rdruzhkov! I apologize for the delayed response on this one, but wanted to get back to you nonetheless.

> [@rdruzhkov](#):
>
> So the main goal of having an API is to create `audience` value that will allow to the backend/API to understand if the `id_token`, `access_token` etc are intended to be used by the backend/API. Am I right?

That is exactly right.

> [@rdruzhkov](#):
>
> If I’m right then why can’t we use application `client_id` as `audience`? I know that my backend/API is going to be used by the application. So it seems to me that on the backend/API side I can validate `audience` by checking if it’s equal to application `client_id`, since my application is allowed to interact with backend/API.

You _might_ be able to use the `client_id` as the audience as it’s just an identifier although I cannot confirm there won’t be any issues with this approach and don’t recommend 🙂

---

<div class="post-metadata">

**Author:** ![rdruzhkov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rdruzhkov/32/45203_2.png) [@rdruzhkov](https://community.auth0.com/u/rdruzhkov)\
**Post date:** [April 29, 2023, 9:30am UTC](https://community.auth0.com/t/what-is-difference-between-applications-and-apis-what-do-we-use-apis/102019/6 "2023-04-29T09:30:27Z")

</div>

Thank you for the provided information!

---

<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:** [May 13, 2023, 9:31am UTC](https://community.auth0.com/t/what-is-difference-between-applications-and-apis-what-do-we-use-apis/102019/7 "2023-05-13T09:31:00Z")

</div>

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