---
title: "Manage the associations of a User"
method: POST
path: "/users/{user_id}/associations"
tags: ["Graph", "Users"]
---

# Manage the associations of a User

`POST /users/{user_id}/associations`

## Request

- Base URL: `https://console.jumpcloud.com/api/v2`
- URL: `https://console.jumpcloud.com/api/v2/users/{user_id}/associations`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/jumpcloud/apis/jumpcloud-api-2/docs/users/:user_id/associations/post.ts> (a function with typed inputs; its response is checked against the schema)

This endpoint allows you to manage the _direct_ associations of a User.

A direct association can be a non-homogeneous relationship between 2 different objects, for example Users and Systems.


#### Sample Request
```
curl -X POST https://console.jumpcloud.com/api/v2/users/{UserID}/associations \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: {API_KEY}' \
  -d '{
    "attributes": {
      "sudo": {
      "enabled": true,
        "withoutPassword": false
      }
    },
    "op": "add",
    "type": "system_group",
    "id": "{GroupID}"
  }'
```

## Headers

- `x-org-id` string

## Request body

- GraphOperationUser
  - `id` string, required: The ObjectID of graph object being added or removed as an association.
  - `op` 'add' | 'remove' | 'update', required: How to modify the graph connection.
  - `attributes` object, nullable: Setting user access controls in order to grant administrator permissions
    - `sudo` object, nullable
      - `enabled` boolean, required: Enables sudo
      - `withoutPassword` boolean, required: Enable sudo without password (requires 'enabled' to be true)
  - `type` 'active_directory' | 'application' | 'g_suite' | 'idp_routing_policy' | 'ldap_server' | 'office_365' | 'password_manager_item' | 'policy' | 'policy_group' | 'radius_server' | 'system' | 'system_group', required: Targets which a "user" can be associated to.

## Response `204`

OK

---

[API](https://skmtc.dev/jumpcloud/apis/jumpcloud-api-2.md) - [All operations](https://skmtc.dev/jumpcloud/apis/jumpcloud-api-2/llms.txt) - [OpenAPI document](https://skmtc.dev/jumpcloud/apis/jumpcloud-api-2/revisions/3f09fe63caaa?raw)
