Storyblok
Search Storyblok's Documentation
  1. Update a Collaborator Roles and Permissions

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 number

    Numeric ID of a space

  • :collaborator_id

    required number

    The collaborator id

Request Body Properties

  • collaborator

    The Collaborator Object
    • role

      string

      Role of the collaborator, could be admin, editor or custom roles

    • user_id

      number

      Numeric ID of the user

    • permissions

      enum[]

      Allow specific actions for collaborator in interface and add the permission as array of strings

      PermissionDescription
      read_storiesView stories without editing
      save_storiesEdit and save stories
      publish_storiesPublish stories to the live environment
      unpublish_storiesUnpublish stories from the live environment
      publish_foldersPublish entire folders and their contents
      unpublish_foldersUnpublish folders and their contents
      deploy_storiesDeploy pipeline stories
      delete_storiesPermanently delete stories
      edit_imageEdit images in the asset manager
      view_composerView the Visual Editor
      change_alternate_groupChange alternate content groupings (for i18n or variants)
      move_storyMove stories between folders
      edit_story_slugEdit the URL slug of a story
      view_contentControls 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_foldersControls 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_jsonView the draft JSON payload of stories
      view_published_jsonView the published JSON payload of stories
      manage_tagsCreate, edit, or delete tags
      edit_datasourcesEdit datasources
      edit_datasource_keys Edit keys inside datasources
      access_commerceAccess commerce-related features
      manage_block_libraryManage components in the Block Library
      hide_asset_foldersHides 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

      number

      Numeric 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)