Add a User with SSO
https://mapi.storyblok.com/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://mapi.storyblok.com/v1/spaces/288868932106293/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://github.com/storyblok/storyblok-js-clientStoryblok.post('spaces/288868932106293/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/288868932106293/collaborators/', $payload)->getBody();HttpResponse<String> response = Unirest.post("https://mapi.storyblok.com/v1/spaces/288868932106293/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://mapi.storyblok.com/v1/spaces/288868932106293/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://mapi.storyblok.com/v1/spaces/288868932106293/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/288868932106293/collaborators/', payload)var request = URLRequest(url: URL(string: "https://mapi.storyblok.com/v1/spaces/288868932106293/collaborators/")!)request.setValue("YOUR_OAUTH_TOKEN", forHTTPHeaderField: "Authorization")request.httpMethod = "POST"request.httpBody = try JSONSerialization.data(withJSONObject: [ "collaborator": [ "email": "api@storyblok.com", "role": "editor", "space_role_id": 18, "sso_id": "123456789", ],])let (data, _) = try await URLSession.shared.data(for: request)print(try JSONSerialization.jsonObject(with: data))val client = HttpClient { install(ContentNegotiation) { json() } install(DefaultRequest) { url { takeFrom("https://mapi.storyblok.com/v1/") headers.append("Authorization", "YOUR_OAUTH_TOKEN") } }}
val response = client.post("spaces/288868932106293/collaborators/") { contentType(ContentType.Application.Json) setBody(buildJsonObject { putJsonObject("collaborator") { put("email", "api@storyblok.com") put("role", "editor") put("space_role_id", 18) put("sso_id", "123456789") } })}
println(response.body<JsonElement>()){ "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