Management API
Update a Collaborator Roles and Permissions
This endpoint is used for updating a collaborator. You can set some of the fields available in the collaborator object.
https://mapi.storyblok.com/v1/spaces/:space_id/collaborators/:collaborator_id
Path Parameters
-
:space_id
required numberNumeric ID of a space
-
:collaborator_id
required numberThe collaborator id
Request Body Properties
-
collaborator
The Collaborator Object-
role
stringRole of the collaborator, could be admin, editor or custom roles
-
user_id
numberNumeric ID of the user
-
permissions
enum[]Allow specific actions for collaborator in interface and add the permission as array of strings
Permission Description read_stories View stories without editing save_stories Edit and save stories publish_stories Publish stories to the live environment unpublish_stories Unpublish stories from the live environment publish_folders Publish entire folders and their contents unpublish_folders Unpublish folders and their contents deploy_stories Deploy pipeline stories delete_stories Permanently delete stories edit_image Edit images in the asset manager view_composer View the Visual Editor change_alternate_group Change alternate content groupings (for i18n or variants) move_story Move stories between folders edit_story_slug Edit the URL slug of a story view_content Controls visibility of content entries. Without this, all content is hidden unless explicitly granted. To give read-only access to others, enable allow reading content permission. view_folders Controls visibility of folders. Without this, all folders are hidden unless explicitly granted. To give read-only access to others, enable allow reading content permission. view_draft_json View the draft JSON payload of stories view_published_json View the published JSON payload of stories manage_tags Create, edit, or delete tags edit_datasources Edit datasources edit_datasource_keys Edit keys inside datasources access_commerce Access commerce-related features manage_block_library Manage components in the Block Library hide_asset_folders Hides assets and folders (including subfolders) that the role doesn't have upload permission for. In the UI, you can specify which folders are accessible. -
space_role_id
numberNumeric ID of the space role
-
space_role_ids
number[]Array of space role ids
-
Request
curl "https://mapi.storyblok.com/v1/spaces/656/collaborators/2362" \
-X PUT \
-H "Authorization: YOUR_OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"collaborator\": {\"role\": 49707,\"space_role_id\": 49707}}"
Request
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.put('cdn/spaces/656/collaborators/2362', {
"collaborator": {
"role": 49707,
"space_role_id": 49707
}
})
.then(response => {
console.log(response)
}).catch(error => {
console.log(error)
})
Request
$client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');
$payload = [
"collaborator" => [
"role" => 49707,
"space_role_id" => 49707
]
];
$client->put('/spaces/656/collaborators/2362', $payload)->getBody();
Request
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
payload = {
"collaborator" => {
"role" => 49707,
"space_role_id" => 49707
}
}
client.put('/spaces/656/collaborators/2362', payload)
Request
HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/656/collaborators/2362")
.header("Content-Type", "application/json")
.header("Authorization", "YOUR_OAUTH_TOKEN")
.body("{\"collaborator\": {\"role\": 49707,\"space_role_id\": 49707}}")
.asString();
Request
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/656/collaborators/2362");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "{\"collaborator\": {\"role\": 49707,\"space_role_id\": 49707}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Request
import Foundation
let headers = [
"Content-Type": "application/json",
"Authorization": "YOUR_OAUTH_TOKEN"
]
let postData = NSData(data: "{\"collaborator\": {\"role\": 49707,\"space_role_id\": 49707}}".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/656/collaborators/2362")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)
request.method = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
Request
import requests
url = "https://mapi.storyblok.com/v1/spaces/656/collaborators/2362"
querystring = {}
payload = "{\"collaborator\": {\"role\": 49707,\"space_role_id\": 49707}}"
headers = {
'Content-Type': "application/json",
'Authorization': "YOUR_OAUTH_TOKEN"
}
response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)
print(response.text)