The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December.
Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
Hello, all, I am trying to create a new user using the "Create User" API. I'm sending the following and getting a 400 Bad Request error back. Does anyone have any ideas why? I already tried including the authentication_provider_id but that gave the same error. I'm doing this with c# code. I specify TLS 1.2 in the code. I have been successful doing a "GET" this way, but this "POST" isn't working for me.
Thank you in advance for any helpful information.
{
"pseudonym":
{
"sis_user_id":"1234567",
"unique_id":"personsname123"
},
"user":
{
"name":"Sample Person"
}
}
Solved! Go to Solution.
I called support and the person helping me said I needed to send the parameters as url variables, not in the body of the request, which seems strange to me but it worked.
I tried this payload in postman to the /accounts/1/users endpoint and it worked for me:
{
"user":
{
"name": "Testing User",
"skip_registration" : true
},
"pseudonym":
{
"unique_id": "2345677d76456789",
"send_confirmation": true
}
}
I'm running into a similar issue with the canvasapi Python wrapper.
user = account.create_user(
{"user":{
'name': 'test'
},
"pseudonym":{
'unique_id': 'user@email.com',
'send_confirmation': True
}}
)
This gives me the error
> Dictionary with key 'unique_id' is required.
So I try this instead:
user = account.create_user(
user={
'name': 'test'
},
pseudonym={
'unique_id': 'user@email.com',
'send_confirmation': True
}
)
While this second try is in line with the API documentation (as far as I can tell), it gives me this cryptic error:
> {"errors":{"user":{"terms_of_use":[{"attribute":"terms_of_use","type":"accepted","message":"accepted"}]},"pseudonym":{},"observee":{},"pairing_code":{},"recaptcha":null}}
@MattHanes , since you say you normally use Python, I hope you can help me figure this out. I had a similar issue with the update_score_and_comments() function, and even though I got that figured out, my knowledge of that isn't helping here.
I also tried your payload in Postman and that worked so I don't think the payload is the problem.
Thank you, can you think of what else could be wrong to give me a 400 error?
Unfortunately, I can't think of any other issue. I mostly deal with Python.
Could you share what headers you are setting?
I called support and the person helping me said I needed to send the parameters as url variables, not in the body of the request, which seems strange to me but it worked.
My header is just the normal Authorization: Bearer token header. I don't think that would have been the issue because you said the GET call was working. You can add parameters to the URL, but that doesn't seem to work well for all use cases. My guess is there is some issue with how your payload was encoded or perhaps you needed to specify the content-type is application/json in your header?
I did specify json. The only thing I changed was to send the parameters as url variables instead of in the body of the request (and changing the type to x-www-form-urlencoded), and it now works. No idea why, and it seems to me the documentation says to send the parameters in the body of the request. Anyway I'm just glad it's working.
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in