Change a user's role
curl --request PATCH \
--url https://api.dualmindlab.tech/api/admin/users/{id}/role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": "admin"
}
'import requests
url = "https://api.dualmindlab.tech/api/admin/users/{id}/role"
payload = { "role": "admin" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({role: 'admin'})
};
fetch('https://api.dualmindlab.tech/api/admin/users/{id}/role', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({role: 'admin'})
};
fetch('https://api.dualmindlab.tech/api/admin/users/{id}/role', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dualmindlab.tech/api/admin/users/{id}/role"
payload := strings.NewReader("{\n \"role\": \"admin\"\n}")
req, _ := http.NewRequest("PATCH", 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(string(body))
}using RestSharp;
var options = new RestClientOptions("https://api.dualmindlab.tech/api/admin/users/{id}/role");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"role\": \"admin\"\n}", false);
var response = await client.PatchAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.patch("https://api.dualmindlab.tech/api/admin/users/{id}/role")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"admin\"\n}")
.asString();{
"success": true,
"data": {
"user_id": "8b1f3c2a-4d5e-4f60-8a7b-9c0d1e2f3a4b",
"full_name": "Asha Patel",
"email": "asha@example.com",
"role": "user",
"created_at": "2023-11-07T05:31:56Z",
"last_login_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"error": "Role must be one of: admin, user"
}{
"success": false,
"error": "Role must be one of: admin, user"
}Change a user's role
Sets role to admin or user without touching other fields. Takes effect on the user’s next request, because the API reads the role on every authenticated call.
PATCH
/
api
/
admin
/
users
/
{id}
/
role
Change a user's role
curl --request PATCH \
--url https://api.dualmindlab.tech/api/admin/users/{id}/role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": "admin"
}
'import requests
url = "https://api.dualmindlab.tech/api/admin/users/{id}/role"
payload = { "role": "admin" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({role: 'admin'})
};
fetch('https://api.dualmindlab.tech/api/admin/users/{id}/role', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({role: 'admin'})
};
fetch('https://api.dualmindlab.tech/api/admin/users/{id}/role', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dualmindlab.tech/api/admin/users/{id}/role"
payload := strings.NewReader("{\n \"role\": \"admin\"\n}")
req, _ := http.NewRequest("PATCH", 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(string(body))
}using RestSharp;
var options = new RestClientOptions("https://api.dualmindlab.tech/api/admin/users/{id}/role");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"role\": \"admin\"\n}", false);
var response = await client.PatchAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.patch("https://api.dualmindlab.tech/api/admin/users/{id}/role")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"admin\"\n}")
.asString();{
"success": true,
"data": {
"user_id": "8b1f3c2a-4d5e-4f60-8a7b-9c0d1e2f3a4b",
"full_name": "Asha Patel",
"email": "asha@example.com",
"role": "user",
"created_at": "2023-11-07T05:31:56Z",
"last_login_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"error": "Role must be one of: admin, user"
}{
"success": false,
"error": "Role must be one of: admin, user"
}AdminOnly
Bearer token, role admin
Authorizations
Supabase access token of an account with role = 'admin' in public.users.
Path Parameters
User ID.
Body
application/json
Available options:
admin, user Last modified on October 18, 2026
Was this page helpful?
⌘I