---
title: Add a User with SSO
description: Add a user with SSO using the `sso_id` property. Use this unique identifier of the user from your system in Storyblok
url: https://storyblok.com/docs/api/management/collaborators/add-a-user-with-sso
---

# Add a User with SSO

POST

```html
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

-   `:space_id` (required) (number)
    
    Numeric ID of a space
    

## 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 `id` or `multi` if you have more than one role).
    
-   `space_role_id` (required) (number)
    
    Numeric ID of the space role associated with collaborators. Usually `null` with more than one collaborator.
    

## Examples

-   cURL
    
    ```shellscript
    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\"}}"
    ```
    
-   JS
    
    ```javascript
    // storyblok-js-client@>=7, node@>=18
    import Storyblok from "storyblok-js-client";
    
    const storyblok = new Storyblok({
      oauthToken: "YOUR_PERSONAL_ACCESS_TOKEN",
    });
    
    try {
      const response = await storyblok.post('spaces/288868932106293/collaborators/', {
        "collaborator": {
          "email": "api@storyblok.com",
          "role": "editor",
          "space_role_id": 18,
          "sso_id": "123456789"
        }
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $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();
    ```
    
-   Java
    
    ```java
    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();
    ```
    
-   C#
    
    ```csharp
    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);
    ```
    
-   Python
    
    ```python
    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)
    ```
    
-   Ruby
    
    ```ruby
    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)
    ```
    
-   Swift
    
    ```swift
    let storyblok = URLSession(storyblok: .mapi(accessToken: .oauth("YOUR_OAUTH_TOKEN")))
    var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/collaborators/")
    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 storyblok.data(for: request)
    print(try JSONSerialization.jsonObject(with: data))
    ```
    
-   Kotlin
    
    ```kotlin
    val client = HttpClient {
        install(Storyblok(MAPI)) {
            accessToken = OAuth("YOUR_OAUTH_TOKEN")
        }
    }
    
    val response = client.post("spaces/288868932106293/collaborators/") {
        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>())
    ```

Example Object

```json
{
 "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
 }
}
```

## Pagination

-   [Previous: Add a Collaborator](/docs/api/management/collaborators/add-a-collaborator)
-   [Next: Delete a Collaborator](/docs/api/management/collaborators/delete-a-collaborator)
