--- title: "Update container assignments" source_url: https://dev.digicert.com/certcentral-apis/services-api/users/update-container-assignments.html api_method: PUT api_endpoint: "/services/v2/user/{{user_id}}/container-assignments" api_url: "https://www.digicert.com/services/v2/user/{{user_id}}/container-assignments" --- **PUT** `https://www.digicert.com/services/v2/user/{{user_id}}/container-assignments` Use this endpoint to update container (division) assignments for a user. - Users with container assignments are restricted users. Restricted users can only access the containers to which they are assigned. - Users with no container assignments are unrestricted users. Unrestricted users can access all containers within their account. This is a destructive operation. In the request body, values in the `container_id_assignments` array overwrite any existing container assignments for the given `user_id`. Passing an empty array removes all container assignments, giving the user access to all containers within their account. > **Tip** > > To get a user's existing container assignments, call the [User info](https://dev.digicert.com/md/certcentral-apis/services-api/users/user-info.md) API and check the value of the `container_assignments` array. ## Example requests and responses **cURL** ```bash curl --request PUT 'https://www.digicert.com/services/v2/user/{{user_id}}/container-assignments' \ --header 'X-DC-DEVKEY: {{api_key}}' \ --header 'Content-Type: application/json' \ --data-raw '{ "container_id_assignments": [ "577532", "577533" ] }' ``` **Python** ```python import requests import json url = "https://www.digicert.com/services/v2/user/{{user_id}}/container-assignments" payload = json.dumps({ "container_id_assignments": [ "577532", "577533" ] }) headers = { 'X-DC-DEVKEY': {{api_key}}, 'Content-Type': 'application/json' } response = requests.request("PUT", url, headers=headers, data=payload) print(response.text) ``` **Go** ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://www.digicert.com/services/v2/user/{{user_id}}/container-assignments" method := "PUT" payload := strings.NewReader(`{ "container_id_assignments": [ "577532", "577533" ] }`) client := &http.Client { } req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return } req.Header.Add("X-DC-DEVKEY", {{api_key}}) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` **NodeJS** ```javascript var request = require('request'); var options = { 'method': 'PUT', 'url': 'https://www.digicert.com/services/v2/user/{{user_id}}/container-assignments', 'headers': { 'X-DC-DEVKEY': {{api_key}}, 'Content-Type': 'application/json' }, body: JSON.stringify({ "container_id_assignments": [ "577532", "577533" ] }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); }); ``` ## 204 No Content ```json // empty ``` ## Path parameters
Name Req/Opt Type Description
user_id required string User ID.
## Request parameters
Name Req/Opt Type Description
container_id_assignments required array of strings List of container (division) IDs. To get a list of containers in your account, use the List containers API.