Users

English only

Use Cases

Get single object

Retrieves a single specific user via id, ref or email. Useful for displaying user profiles or checking permissions.

query {
  user(id: "uuid-hier") {
    id
    name
    email
    isActive
  }
}

Get list

Returns a list of all users. You can optionally filter by active status.

query {
  users(active: true) {
    id
    name
    email
  }
}

Create object

Creates a new user. An invitation is sent by default unless sendInvite: false is set.

mutation {
  createUser(
    sendInvite: true
    user: {
      email: "example@domain.com"
      name: "Jane Doe"
      roles: [MANAGER]
      language: NL
    }
  ) {
    user {
      id
      name
      email
    }
    created
  }
}

Update object

Modifies an existing user based on id or ref. You can adjust properties such as name, roles or language.

mutation {
  updateUser(
    id: "uuid-hier"
    user: {
      name: "Updated Name"
      roles: [PLANNER, TRAINER]
    }
  ) {
    user {
      id
      name
      roles
    }
  }
}

Create or update

Looks up a user based on email or ref, and creates one if it doesn't exist. Ideal for integrations where you don't know if the user already exists.

mutation {
  updateOrCreateUser(
    email: "example@domain.com"
    sendInvite: false
    user: {
      name: "Jane Doe"
      isActive: true
      roles: [TRAINER]
    }
  ) {
    user {
      id
      name
      email
    }
    created
  }
}

Archive/deactivate

Archives one or more users. These users are deactivated without permanently deleting them.

mutation {
  archiveUsers(
    archive: true
    ids: ["uuid-1", "uuid-2"]
  ) {
    response {
      succeededIds
      failedIds
    }
  }
}

GraphQL Definitions

Type

The User type describes the structure of a user in the system. Including fields such as email, name, status, language, permissions, additional fields and connections with groups.

type User {
  modelId: ID!
  email: String
  name: String!
  archivedAt: DateTime
  ref: String
  id: ID!
  isActive: Boolean
  roles: [Role]
  profileImage: File!
  language: Language!
  extraFields: JSONString
  extraFieldsProfile: JSONString
  hasPassword: Boolean
  afasPersonId: String
  afasEmployeeId: String
  afasContactId: String
  afasConnectionId: ID
  participantGroups: [Group!]
  managerGroups: [Group!]
  groupCount: Int
  invitedOn: DateTime
  lastLogin: DateTime
  userVia: [UserVia!]
}

Queries

Use user to retrieve a specific user and users for lists. paginatedUsers is available for advanced filtering.

user(id: UUID, ref: String, email: String): User
users(active: Boolean): [User!]!

Mutations

Mutations for creating, updating or archiving users. Use updateOrCreateUser where possible to prevent duplicate logic.

createUser(sendInvite: Boolean = true, user: CreateUserInput!): CreateUser
updateUser(ref: String, id: UUID, user: UpdateUserInput!): UpdateUser
updateOrCreateUser(email: String, ref: String, sendInvite: Boolean, user: UpdateOrCreateUserInput!): UpdateOrCreateUser
archiveUsers(archive: Boolean!, ids: [UUID!]!): ArchiveUsers

Notes

  • Use updateOrCreateUser as the standard mutation for new or existing users.
  • archiveUsers is the designated way to deactivate or archive users.
  • There is no deleteUser mutation — users can only be archived.
  • The groups field is deprecated. Use participantGroups and managerGroups.
Sluit melding