User Management API
Overview
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 } } }"
     }'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: "[email protected]", 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": "[email protected]",
         "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
Was this helpful?