# Bad audience: https://custom-domain/api/v2/

**URL:** <https://community.auth0.com/t/bad-audience-https-custom-domain-api-v2/182423>\
**Category:** Get Help\
**Tags:** custom-domains, management-api\
**Created:** [February 19, 2025, 11:28am UTC](https://community.auth0.com/t/bad-audience-https-custom-domain-api-v2/182423 "2025-02-19T11:28:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![muhammad.ali](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/muhammad.ali/32/47285_2.png) [@muhammad.ali](https://community.auth0.com/u/muhammad.ali)\
**Post date:** [February 19, 2025, 11:28am UTC](https://community.auth0.com/t/bad-audience-https-custom-domain-api-v2/182423/1 "2025-02-19T11:28:15Z")

</div>

I created a access token with My custome API  
{  
“client\_id”: “KtIK6BuIVodFkblvt3QD5yjsZNaMsLFH”,  
“client\_secret”: “”,  
“audience”: “[https://custom-domain/api/v2/](https://custom-domain/api/v2/)”,  
“grant\_type”: “client\_credentials”  
}

AnD i got token With that token I call APIs  
[https://custom-domain/api/v2/organizations/org\_WgaeQUZIWxzKGJjy](https://custom-domain/api/v2/organizations/org_WgaeQUZIWxzKGJjy)

But it getting

{  
“statusCode”: 401,  
“error”: “Unauthorized”,  
“message”: “Bad audience: [https://custom-domain/api/v2/](https://custom-domain/api/v2/)”  
}

I already auhorized the API in M2M app KtIK6BuIVodFkblvt3QD5yjsZNaMsLFH.

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [February 19, 2025, 4:03pm UTC](https://community.auth0.com/t/bad-audience-https-custom-domain-api-v2/182423/3 "2025-02-19T16:03:15Z")

</div>

Hi @muhammad.ali,

Welcome to the Auth0 Community!

The audience should be the identifier of said API, you’ll find it in your APIs settings.

 ![Screenshot 2025-02-19 at 15.43.59](https://global.discourse-cdn.com/auth0/original/3X/b/7/b7d793f43674859cbc8a05602e2b5d72475c5768.png)

If you have any other questions feel free to let us know.

Have a good one,  
Vlad

---

<div class="post-metadata">

**Author:** ![muhammad.ali](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/muhammad.ali/32/47285_2.png) [@muhammad.ali](https://community.auth0.com/u/muhammad.ali)\
**Post date:** [February 19, 2025, 4:35pm UTC](https://community.auth0.com/t/bad-audience-https-custom-domain-api-v2/182423/4 "2025-02-19T16:35:41Z")

</div>

Thanks for the help!

So, I’m using the same identifier as the audience, but I’m running into a “bad audience” error.

My goal is to use custom APIs with limited permissions for our M2M apps, instead of the default Auth0 Management API. I’m using these custom APIs to get tokens (via the M2M app flow) and then using those tokens to access other management APIs. The “bad audience” error happens when I try to use the token to get organization details.

Basically, I want a separate custom API for each M2M app, and each M2M app would be authorized with its own organization using grant client access. This way, the tokens are only valid for that specific organization.

Any ideas why I’m getting the “bad audience” error and how to fix it? I’m starting to wonder if this approach with custom APIs will even work.  
Thanks again!

---

<div class="post-metadata">

**Author:** ![muhammad.ali](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/muhammad.ali/32/47285_2.png) [@muhammad.ali](https://community.auth0.com/u/muhammad.ali)\
**Post date:** [February 19, 2025, 4:39pm UTC](https://community.auth0.com/t/bad-audience-https-custom-domain-api-v2/182423/5 "2025-02-19T16:39:13Z")

</div>

I got a response on another ticket saying that custom APIs aren’t designed for this – they’re for authorizing machine-to-machine communication, not for making management API calls. Is that right?

Tganks again

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [February 19, 2025, 9:05pm UTC](https://community.auth0.com/t/bad-audience-https-custom-domain-api-v2/182423/6 "2025-02-19T21:05:30Z")

</div>

Yes, that is right. The Management API has all of the possible permissions already active for modifying your Auth0 account. That includes managing users and setting up connections. Any other custom API is made for limited access to everything the Management API does, but they don’t call the Management API.

---

<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:** [March 5, 2025, 9:06pm UTC](https://community.auth0.com/t/bad-audience-https-custom-domain-api-v2/182423/7 "2025-03-05T21:06:02Z")

</div>

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