Skip to content

Hi Coactive team!

This is a sample of what your docs might look like on Starport, based on your public docs.

Take a look! Ask AI, search, the MCP server, and Markdown copies all work.

Starport is a free and open-source docs framework based on Starlight and maintained by Promptless. Promptless is the AI agent that automatically updates your customer-facing docs.

Every annual Promptless plan comes with white-glove migration to Starport, where we migrate the content, tune the result with you, and you own the repository so you're never locked in.

Book a 15-minute walkthrough

Sample migration of Coactive docs to Starport, prepared by PromptlessBook 15-minute call

Update User Roles

PUT https://api.coactive.ai/api/v1/auth-management/users/{user_id}/roles
Content-Type: application/json

Replace a user’s roles.

This endpoint allows administrators to replace the roles assigned to a user.

The roles can be scoped to a specific context (e.g., dataset or system). If a context is provided, the roles will only be replaced within that context. If no context is provided, all roles (system-level and dataset-level) will be replaced.

To replace roles at the system level, use the “system” context. To replace roles at the dataset level, use the “dataset:{dataset_id}” context.

  • Authorization header (bearer token, required) — Bearer authentication of the form Bearer <token>, where token is your auth token.
  • user_id (string, required) — The ID of the user to update

This endpoint expects an object.

  • roles (list of object, required) — New list of roles to assign to the user
    • role_id (string, required) — Name of the role (e.g., ‘admin’, ‘editor’, ‘viewer’)
    • resource (string, optional, nullable) — Optional resource type the role applies to (e.g., ‘dataset’)
    • resource_instance (string, optional, nullable) — Optional resource instance ID the role applies to
  • roles_context (string, optional, nullable) — Context for the roles to update. This can either be ‘system’ for system-level roles or ‘dataset:{dataset_id}’ for dataset-level roles.

The updated user profile with new roles

  • user_id (string, required) — Unique identifier for the user
  • name (string, required) — Display name of the user
  • created_at (string, required) — Timestamp when the user was created
  • roles (list of object, required) — List of roles assigned to the user
    • role_id (string, required) — Name of the role (e.g., ‘admin’, ‘editor’, ‘viewer’)
    • resource (string, optional, nullable) — Optional resource type the role applies to (e.g., ‘dataset’)
    • resource_instance (string, optional, nullable) — Optional resource instance ID the role applies to
  • email (string, optional, nullable) — Email address of the user
  • picture (string, optional, nullable) — URL to the user’s profile picture
  • last_login (string, optional, nullable) — Timestamp of the user’s last login

Validation Error

  • detail (list of object, optional)
    • loc (list of string or integer, required)
    • msg (string, required)
    • type (string, required)

Request

{
"roles": [
{
"role_id": "admin"
}
],
"roles_context": "system"
}

Response

{
"user_id": "auth0|123",
"name": "John Doe",
"created_at": "2024-01-01T00:00:00Z",
"roles": [
{
"role_id": "admin"
}
],
"email": "john@example.com",
"picture": "https://example.com/avatar.jpg",
"last_login": "2024-01-02T00:00:00Z"
}

SDK Code

import requests
url = "https://api.coactive.ai/api/v1/auth-management/users/user_id/roles"
payload = {
"roles": [{ "role_id": "admin" }],
"roles_context": "system"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
const url = 'https://api.coactive.ai/api/v1/auth-management/users/user_id/roles';
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: '{"roles":[{"role_id":"admin"}],"roles_context":"system"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.coactive.ai/api/v1/auth-management/users/user_id/roles"
payload := strings.NewReader("{\n \"roles\": [\n {\n \"role_id\": \"admin\"\n }\n ],\n \"roles_context\": \"system\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
url = URI("https://api.coactive.ai/api/v1/auth-management/users/user_id/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"roles\": [\n {\n \"role_id\": \"admin\"\n }\n ],\n \"roles_context\": \"system\"\n}"
response = http.request(request)
puts response.read_body
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse<String> response = Unirest.put("https://api.coactive.ai/api/v1/auth-management/users/user_id/roles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"roles\": [\n {\n \"role_id\": \"admin\"\n }\n ],\n \"roles_context\": \"system\"\n}")
.asString();
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://api.coactive.ai/api/v1/auth-management/users/user_id/roles', [
'body' => '{
"roles": [
{
"role_id": "admin"
}
],
"roles_context": "system"
}',
'headers' => [
'Authorization' => 'Bearer <token>',
'Content-Type' => 'application/json',
],
]);
echo $response->getBody();
using RestSharp;
var client = new RestClient("https://api.coactive.ai/api/v1/auth-management/users/user_id/roles");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"roles\": [\n {\n \"role_id\": \"admin\"\n }\n ],\n \"roles_context\": \"system\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import Foundation
let headers = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
let parameters = [
"roles": [["role_id": "admin"]],
"roles_context": "system"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://api.coactive.ai/api/v1/auth-management/users/user_id/roles")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "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 as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()