how to set provided_id when creating user via management API?
I tried the following with no luck:
8 Replies
The provided_id field is not part of the profile object when creating a user. Instead, it should be included in the identities array. Here's the correct structure for creating a user with a provided_id:
{
"identities": [
{
"details": {
"email": "string",
"phone": "string",
"username": "string"
},
"type": "email"
}
],
"organization_code": "string",
"profile": {
"family_name": "string",
"given_name": "string"
}
}
To set the provided_id, you should include it in the request body at the top level, not within the profile object. Here's how you might modify your Python code to correctly set the provided_id:
response = api.post("/api/v1/user", json={
"profile": {
"given_name": user.first_name,
"family_name": user.last_name,
},
"organization_code": settings.KINDE_MANAGEMENT["ORGANIZATION_ID"],
"identities": identities,
"provided_id": str(user.pk) # Add this line
})
Note that the provided_id should be a string, so you may need to convert user.pk to a string if it's not already.
Remember that the provided_id is described as "External id for user" in the API documentation , which aligns with your intention to use the primary key from your system.@Andre @ Kinde it didn't work π I can't retrieve
log to get
provided_id
nor see it in Kinde admin dashboard UIlog to get
provided_id
I tried following requests:
GET /api/v1/users
GET /api/v1/user
GET /users/kp_38c012726fe243f8b0e55aaa964d19a7/properties
@Andre @ Kinde full script with config and everything, easier to debug π
ps: I made sure the M2M app has read/write to all
user
and user_properties
scopesSorry @Adil Hemache are you trying to get a property or the ID of an identity of a user?
As if you want to get the provided_id, this is the call https://kinde.com/api/docs/#get-identity
yes, but the documentation says that
provided_id
field is part of user response and not identity!
assuming I want to use get identity endpoint, what's the ID of the identity ? π€ as I only create one primary email identity in user creation request
@Andre @ Kinde got all user identities, still, provided_id
is not part of any
GET /api/v1/users/{user_id}/identities
@Andre @ Kinde to reword our needs, we want to
1. set provided_id
when creating the user using management API
2. able to get that provided_id
later when listing users using management API
note aside, the API documentations looks out dated and hard to followHi @Adil Hemache ,
I will check with our API team. The provided_id is really there to support the migration where your user data is coming from another source and being imported.
Could you let me know this usecase you're trying to solve with the provided ID when you're creating via the API?
@Daniel_Kinde so there is no way to set/get provided_id via the api?! should we just use custom property?
Hey @Adil Hemache,
I would suggest using a custom user property to store a custom ID against users for now, so you are not blocked.
We are looking into this gap in the API where you cannot get/set provided_id for a user via the Kinde Management API.
Let us know if you come across any issues using custom user properties for now.