User Management API
Overview
This feature is available with the Paradime Enterprise pack.
Your API keys must have either User Management Admin or User Metadata Viewer capabilities.
The User Management API enables you to efficiently administer and regulate user access within your workspace.
List Users
This endpoint will return a list of all the current active and invited users in your workspace.
Example Request
import requests
import os
# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"
graphql_query = """
query ListUsers {
listUsers {
ok
activeUsers {
uid
email
name
accountType
}
invitedUsers {
email
accountType
inviteStatus
}
}
}
"""
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
"Content-Type": "application/json",
"X-API-KEY": api_key,
"X-API-SECRET": api_secret,
})
print(response.json())
curl -X POST "<YOUR_API_ENDPOINT>" \
-H "Content-Type: application/json" \
-H "X-API-KEY: <YOUR_API_KEY>" \
-H "X-API-SECRET: <YOUR_API_SECRET>" \
-d '{
"query": "query ListUsers { listUsers { ok activeUsers { uid email name accountType } invitedUsers { email accountType inviteStatus } } }"
}'
Example response
{
"data": {
"listUsers": {
"ok": true,
"activeUsers": [
{
"uid": "1b051b1e1aaf70773789c250cd0cc40a5bf27c104d1ca2c6b765767eb53c4772",
"email": "alexandra@acme.io",
"name": "Alexandra James",
"accountType": "ADMIN"
},
{
"uid": "0b02bde0691e9a220f8fdbff93d992a7826c7ce7b0ea33ffc4709c6a2d219a49",
"email": "jonny@acme.io",
"name": "Jonathan Maxwell",
"accountType": "ADMIN"
},
{
"uid": "07673b48d2206dad7a150dd258ea1e049df036356f1730e30304e38ca648b175",
"email": "matt@acme.io",
"name": "Matt McDonald",
"accountType": "DEVELOPER"
}
],
"invitedUsers": [
{
"email": "max@acme.io",
"accountType": "ADMIN",
"inviteStatus": "EXPIRED"
},
{
"email": "john@acme.io",
"accountType": "ADMIN",
"inviteStatus": "ACTIVE"
}
]
}
}
}
Invite Users
This endpoint will enable you to invite users to your workspace.
Example Request
import requests
import os
# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"
graphql_query = """
mutation InviteUser {
inviteUser(email: "alice@acme.io", accountType: DEVELOPER) {
ok
}
}
"""
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
"Content-Type": "application/json",
"X-API-KEY": api_key,
"X-API-SECRET": api_secret,
})
print(response.json())
curl -X POST "<YOUR_API_ENDPOINT>" \
-H "Content-Type: application/json" \
-H "X-API-KEY: <YOUR_API_KEY>" \
-H "X-API-SECRET: <YOUR_API_SECRET>" \
-d '{
"query": "mutation InviteUser($email: String!, $accountType: UserAccountType!) { inviteUser(email: $email, accountType: $accountType) { ok } }",
"variables": {
"email": "alice@acme.io",
"accountType": "DEVELOPER"
}
}'
Update User Role
This endpoint will enable you to update the role of a current signed up user in your workspace.
Example Request
import requests
import os
# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"
graphql_query = """
mutation UpdateUserAccountType {
updateUserAccountType(
uid: "b6982657f4f7f796945a5c9ca8980e5a2ddf9f94fd7a54fb98b7740fdd54821b"
accountType: DEVELOPER
) {
ok
}
}
"""
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
"Content-Type": "application/json",
"X-API-KEY": api_key,
"X-API-SECRET": api_secret,
})
print(response.json())
curl -X POST "<YOUR_API_ENDPOINT>" \
-H "Content-Type: application/json" \
-H "X-API-KEY: <YOUR_API_KEY>" \
-H "X-API-SECRET: <YOUR_API_SECRET>" \
-d '{
"query": "mutation UpdateUserAccountType($uid: String!, $accountType: UserAccountType!) { updateUserAccountType(uid: $uid, accountType: $accountType) { ok } }",
"variables": {
"uid": "b6982657f4f7f796945a5c9ca8980e5a2ddf9f94fd7a54fb98b7740fdd54821b",
"accountType": "DEVELOPER"
}
}'
Disable User
This endpoint will enable you to disable a user from your workspace.
Example Request
import requests
import os
# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"
graphql_query = """
mutation DisableUser {
disableUser(uid: "c24d93ba3f6e743bf97a7b5b48c2b7931f6d57d022501cdb2fb983264efc0c29") {
ok
}
}
"""
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
"Content-Type": "application/json",
"X-API-KEY": api_key,
"X-API-SECRET": api_secret,
})
print(response.json())
curl -X POST "<YOUR_API_ENDPOINT>" \
-H "Content-Type: application/json" \
-H "X-API-KEY: <YOUR_API_KEY>" \
-H "X-API-SECRET: <YOUR_API_SECRET>" \
-d '{
"query": "mutation DisableUser($uid: String!) { disableUser(uid: $uid) { ok } }",
"variables": {
"uid": "c24d93ba3f6e743bf97a7b5b48c2b7931f6d57d022501cdb2fb983264efc0c29"
}
}'
Last updated