# Dbconnection/signup api Invalid Json response

**URL:** <https://community.auth0.com/t/dbconnection-signup-api-invalid-json-response/86134>\
**Category:** Get Help\
**Tags:** api-authorization\
**Created:** [June 29, 2022, 9:33am UTC](https://community.auth0.com/t/dbconnection-signup-api-invalid-json-response/86134 "2022-06-29T09:33:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![authneumoney](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/authneumoney/32/34077_2.png) [@authneumoney](https://community.auth0.com/u/authneumoney)\
**Post date:** [June 29, 2022, 9:33am UTC](https://community.auth0.com/t/dbconnection-signup-api-invalid-json-response/86134/1 "2022-06-29T09:33:16Z")

</div>

Team,  
I am trying to call /dbconnection/signup api to create a user using python code

I user the following JSON  
create\_user\_body = {  
‘client\_id’: ‘MY\_CLIENT\_ID’,  
‘email’: ‘ganesh.kumar@reflectionsinfos.com’,  
‘password’: ‘S3cr3t@nopass’,  
‘connection’: ‘register-user-test-conn’  
}  
My request headers include  
request\_headers = {  
‘Content-Type’: ‘application/json’,  
‘Authorization’: f’Bearer {token}’  
}  
Url I try is  
"https://\<MY\_DOMAIN\>/dbconnections/signup

I am using python requests.post like below  
response = requests.post(url, data=create\_user\_body, headers=request\_headers)

But when I post the request I get 400 response code with b"invalid Json" text. I checked password strength, db connection name e t c and they are correct. I cannot figure out what is invalid with the json. Also the token i use in the request is obtained using the /ouath/token endpoint (Client credentials Flow). Can you please help?

Regards,  
Ganesh

---

<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:** [June 30, 2022, 3:02am UTC](https://community.auth0.com/t/dbconnection-signup-api-invalid-json-response/86134/3 "2022-06-30T03:02:08Z")

</div>

Hi @authneumoney,

Welcome to the Auth0 Community!

I understand that you have been having trouble making a request to create a user with Python.

After my tests, I did not find the same observations as you. Instead, I was able to create a user successfully. In this case, could you please try the following code snippet for creating a user?

```auto
import http.client

conn = http.client.HTTPSConnection("YOUR_DOMAIN.REGION.auth0.com")
payload = 'client_id=YOUR_CLIENT_ID&email=sampleuser@test.com&password=Secret&connection=YOUR_CONNECTION'
headers = {
  'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/dbconnections/signup", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

```

Having tested this myself, I can confirm that this works.

Please let me know how this works for you.

Thank you.

---

<div class="post-metadata">

**Author:** ![authneumoney](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/authneumoney/32/34077_2.png) [@authneumoney](https://community.auth0.com/u/authneumoney)\
**Post date:** [June 30, 2022, 6:13am UTC](https://community.auth0.com/t/dbconnection-signup-api-invalid-json-response/86134/4 "2022-06-30T06:13:02Z")

</div>

Hi Rueben,  
Thanks this works… 👍

Regards,  
Ganesh

---

<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:** [December 21, 2022, 6:10pm UTC](https://community.auth0.com/t/dbconnection-signup-api-invalid-json-response/86134/5 "2022-12-21T18:10:10Z")

</div>


