Bad Request (400) when adding metadata to create user

Hi guys, i’m trying to create users from a Java backend and this is the payload I add to my request:

   "metadata":"{“companyCode”:“Supertrans”,“companyName”:“Supertrans S.á.r.l.”,“Name”:“Administrator Administrator”}",
   "name":"Administrator Administrator"

I get a Bad Request(400) when sending this. If I remove the metadata tag, it returns 200. JSON validator finds no errors with the string. What’s the problem here?

hi @Dr_Kurt
sorry for the delay !
can you send the error message you are getting with the response code.
and also if you are trying to add role to the user please make sure that you have created the role in your cometchat dashboard first as shown in image below


Hi, the role part in the segment is not the problem, that works fine and the role is created prior to the creation of user. The problem really is the part where i add the metadata tag.

I don’t get a proper error message, all i get is Error 400 Bad request.

hey @Dr_Kurt !

i am providing you with one curl request

curl --location --request POST '' \

--header 'appId: 203800d7e06528e2' \

--header 'apiKey: a612c045e5efcdd39849ad7c67e2cf268af13f37' \

--header 'Content-Type: us' \

--header 'Accept: Accept' \

--form 'uid=56' \

--form 'metadata={“companyCode”:“Supertrans”,“companyName”:“Supertrans S.á.r.l.”,“Name”:“Administrator Administrator”}' \

--form 'role=shipper' \

--form 'name="\Administrator Administrator\"'

please try to import and run this request on your postman by changing appid, apiKey and Content-Type with your application credentials in Header section

After doing that, if you don’t get any error while making request then there might be some issue with the code and if you are getting any error in a postman while making request then please let us know


In the meantime i was able to track down the root cause of the error.It was the accent character á in my json that caused the error. I was able to find a solution, so the problem was at my side.

Thx for your help!


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