> For a complete page index, fetch https://developer.close.com/llms.txt # Bulk update memberships PUT https://api.close.com/api/v1/membership/ Content-Type: application/json Any field that can be updated on a membership individually can also be used to bulk update multiple memberships. Pass the comma-separated ids of the memberships to update into `id__in` in `_params`. For example: ```json {"_params": {"id__in": "memb_A,memb_B"}, "role_id": "role_y6eLquXvRUdmwqi61tsmgCJUU7uGfxaRbDuLoONZL9p"} ``` Reference: https://developer.close.com/api/resources/memberships/bulk-update ## Authentication - `Authorization` header (basic auth, required) — Use your API key as the username and leave the password empty. - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Body (application/json) This endpoint expects a Membership. - `auto_record_calls` (enum, optional) — Whether this member's calls are automatically recorded. Starts as `unset` and can be set to `enabled` or `disabled`. - Allowed values: `enabled`, `disabled`, `unset` - `default_caller_id` (string, optional, nullable) — ID of the phone number to use as this member's default outbound caller ID. Close keeps this value while `default_caller_id_mode` is `auto`, but outbound calls do not use it. - `default_caller_id_mode` (enum, optional) — How this member's outbound caller ID is chosen. In `fixed` mode, outbound calls use `default_caller_id`. In `auto` mode, Close derives the number for each call and ignores `default_caller_id`. - Allowed values: `fixed`, `auto` - `hangup_recording_url` (string, optional, nullable) — URL of the audio file used as this member's voicemail drop recording. - `may_workflows_impersonate` (boolean, optional) — Whether Workflows may send emails on this member's behalf. - `role_id` (string, optional) — One of `admin`, `superuser`, `user`, or `restricteduser` for the corresponding predefined role, or the ID of a custom [Role](https://developer.close.com/api/resources/roles). - `track_email_opens` (boolean, optional) — Whether email opens are tracked for emails this member sends. ## Response ### 200 Successful response ## Errors ### 400 Bad Request Error Bad request - `any` ### 401 Unauthorized Error Unauthorized - `any` ### 404 Not Found Error Not found - `any` ## Examples **Request** ```json { "role_id": "role_y6eLquXvRUdmwqi61tsmgCJUU7uGfxaRbDuLoONZL9p" } ``` **Response** ```json { "count": 2 } ``` **SDK Code** ```python memberships_bulkUpdate_example import requests url = "https://api.close.com/api/v1/membership/" payload = { "role_id": "role_y6eLquXvRUdmwqi61tsmgCJUU7uGfxaRbDuLoONZL9p" } headers = { "Content-Type": "application/json" } response = requests.put(url, json=payload, headers=headers, auth=("", "")) print(response.json()) ``` ```javascript memberships_bulkUpdate_example const url = 'https://api.close.com/api/v1/membership/'; const credentials = btoa(":"); const options = { method: 'PUT', headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'}, body: '{"role_id":"role_y6eLquXvRUdmwqi61tsmgCJUU7uGfxaRbDuLoONZL9p"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go memberships_bulkUpdate_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.close.com/api/v1/membership/" payload := strings.NewReader("{\n \"role_id\": \"role_y6eLquXvRUdmwqi61tsmgCJUU7uGfxaRbDuLoONZL9p\"\n}") req, _ := http.NewRequest("PUT", url, payload) req.SetBasicAuth("", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby memberships_bulkUpdate_example require 'uri' require 'net/http' url = URI("https://api.close.com/api/v1/membership/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request.basic_auth("", "") request["Content-Type"] = 'application/json' request.body = "{\n \"role_id\": \"role_y6eLquXvRUdmwqi61tsmgCJUU7uGfxaRbDuLoONZL9p\"\n}" response = http.request(request) puts response.read_body ``` ```java memberships_bulkUpdate_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.put("https://api.close.com/api/v1/membership/") .basicAuth("", "") .header("Content-Type", "application/json") .body("{\n \"role_id\": \"role_y6eLquXvRUdmwqi61tsmgCJUU7uGfxaRbDuLoONZL9p\"\n}") .asString(); ``` ```php memberships_bulkUpdate_example request('PUT', 'https://api.close.com/api/v1/membership/', [ 'body' => '{ "role_id": "role_y6eLquXvRUdmwqi61tsmgCJUU7uGfxaRbDuLoONZL9p" }', 'headers' => [ 'Content-Type' => 'application/json', ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp memberships_bulkUpdate_example using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://api.close.com/api/v1/membership/"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.PUT); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"role_id\": \"role_y6eLquXvRUdmwqi61tsmgCJUU7uGfxaRbDuLoONZL9p\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ```