# Endpoint \`/api/v2/users-by-email\` returning Bad Request

**URL:** <https://community.auth0.com/t/endpoint-api-v2-users-by-email-returning-bad-request/76295>\
**Category:** Get Help\
**Created:** [January 12, 2022, 8:34pm UTC](https://community.auth0.com/t/endpoint-api-v2-users-by-email-returning-bad-request/76295 "2022-01-12T20:34:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![guilherme.fonseca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/guilherme.fonseca/32/34369_2.png) [@guilherme.fonseca](https://community.auth0.com/u/guilherme.fonseca)\
**Post date:** [January 12, 2022, 8:34pm UTC](https://community.auth0.com/t/endpoint-api-v2-users-by-email-returning-bad-request/76295/1 "2022-01-12T20:34:40Z")

</div>

I am using a token with grant\_type `client_credentials` to GET a user using the endpoint `api/v2/users-by-email`, everything looks right and this is not the first time I use this endpoint with clientID, but the API is returning a Bad Request:

{“statusCode”:400,“error”:“Bad Request”,“message”:“Bad HTTP authentication header format”,“errorCode”:“Bearer”}

I am following this doc about getting the token: [Get Management API Access Tokens for Production](https://auth0.com/docs/secure/tokens/access-tokens/get-management-api-access-tokens-for-production)  
And following this doc about the endpoint: [Retrieve Users with Get Users by Email Endpoint](https://auth0.com/docs/manage-users/user-search/retrieve-users-with-get-users-by-email-endpoint)

What else should I do to find the problem?

---

<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:** [January 12, 2022, 11:02pm UTC](https://community.auth0.com/t/endpoint-api-v2-users-by-email-returning-bad-request/76295/3 "2022-01-12T23:02:49Z")

</div>

Hi @guilherme.fonseca,

Welcome to the Auth0 Community!

The two pieces of documentation you found are correct for getting an API access token to use with the Management API.

In this case, the error is pointing at your request header parameters, specifically about your bearer token.

I was able to reproduce this issue by not providing a bearer token in my request. See below.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/7/c7adfc7d95e90d1eef44242e2221df9aca1d3a5b.jpeg)

To use the Management API, you will need to check and make sure to pass the access token with the request as an authorization header.

After doing so, you can use the Management API.

Please let me know how this goes for you.

Thanks.

---

<div class="post-metadata">

**Author:** ![guilherme.fonseca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/guilherme.fonseca/32/34369_2.png) [@guilherme.fonseca](https://community.auth0.com/u/guilherme.fonseca)\
**Post date:** [January 13, 2022, 1:13pm UTC](https://community.auth0.com/t/endpoint-api-v2-users-by-email-returning-bad-request/76295/4 "2022-01-13T13:13:02Z")

</div>

Hi @rueben.tiow! Thanks for your response!

I doubled check my requests and I am sure that the bearer token is provided. Tested either with curl and Postman, both with the same error. The latter I’ve tested using the header and the authorization tab.

Is there something I can look into the token to be sure that it is correct?

It is something like this, as the documentation examples:  
{  
“access\_token”: “eyJ…Ggg”,  
“expires\_in”: 86400,  
“scope”: “read:clients create:clients read:client\_keys”,  
“token\_type”: “Bearer”  
}

---

<div class="post-metadata">

**Author:** ![guilherme.fonseca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/guilherme.fonseca/32/34369_2.png) [@guilherme.fonseca](https://community.auth0.com/u/guilherme.fonseca)\
**Post date:** [January 13, 2022, 3:38pm UTC](https://community.auth0.com/t/endpoint-api-v2-users-by-email-returning-bad-request/76295/5 "2022-01-13T15:38:53Z")

</div>

Hi @rueben.tiow,

I’ve found the problem, you were correct!

I was using the token in the wrong way.

Thanks for your support, it has helped me.

---

<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:** [January 28, 2022, 3:39pm UTC](https://community.auth0.com/t/endpoint-api-v2-users-by-email-returning-bad-request/76295/6 "2022-01-28T15:39:40Z")

</div>

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