addUserRelationship
Requires permission users:user:update.
Adds a reporting relationship between two users in your organization. Needs users:user:update.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation AddUserRelationship($input: CreateUserRelationshipInput!) {
addUserRelationship(input: $input) {
id
createdAt
isActive
notes
organizationId
relatedUserId
relatedUser {
id
postalCode
name
firstName
lastName
status
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation AddUserRelationship($input: CreateUserRelationshipInput!) {\n addUserRelationship(input: $input) {\n id\n createdAt\n isActive\n notes\n organizationId\n relatedUserId\n relatedUser {\n id\n postalCode\n name\n firstName\n lastName\n status\n }\n }\n}",
"variables": {
"input": {
"relatedUserId": "string",
"relationshipType": "DOTTED_LINE",
"userId": "string"
}
}
}
EOF
Variables:
{
"input": {
"relatedUserId": "string",
"relationshipType": "DOTTED_LINE",
"userId": "string"
}
}
Response:
{
"data": {
"addUserRelationship": {
"id": "id",
"createdAt": "2025-01-15T00:00:00Z",
"isActive": true,
"notes": "string",
"organizationId": "string",
"relatedUserId": "string",
"relatedUser": {
"id": "id",
"postalCode": "string",
"name": "string",
"firstName": "string",
"lastName": "string",
"status": "ACTIVE"
}
}
}
}
addUserRelationship(
input: CreateUserRelationshipInput!
): UserRelationship!
Arguments
addUserRelationship.input ● CreateUserRelationshipInput! non-null input
The users and the type of relationship to add.
Type
UserRelationship object
A relationship between two users, such as who reports to whom.