Create a new role
Creates a role for the account. A role is a named set of permissions that can be assigned to users, service accounts and access tokens.
A role may inherit the permissions of other roles by listing their identifiers in
roles. Permissions are defined by resource in permissions. See the
permissions endpoint for the available resources.
Permissions
| Resource | Permission | Usage |
|---|---|---|
role | write | Creates the role |
curl --request POST \
--url https://api.mezmo.com/v3/auth/role \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Support",
"roles": [
"5b8fa85cb59ba49d588942b3"
],
"permissions": {
"view": {
"read": true,
"write": true,
"manage": false
}
},
"context_filter": [
"namespace:(default OR support) level:-debug",
"app:-secret"
]
}
'import requests
url = "https://api.mezmo.com/v3/auth/role"
payload = {
"name": "Support",
"roles": ["5b8fa85cb59ba49d588942b3"],
"permissions": { "view": {
"read": True,
"write": True,
"manage": False
} },
"context_filter": ["namespace:(default OR support) level:-debug", "app:-secret"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Support',
roles: ['5b8fa85cb59ba49d588942b3'],
permissions: {view: {read: true, write: true, manage: false}},
context_filter: ['namespace:(default OR support) level:-debug', 'app:-secret']
})
};
fetch('https://api.mezmo.com/v3/auth/role', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mezmo.com/v3/auth/role",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Support',
'roles' => [
'5b8fa85cb59ba49d588942b3'
],
'permissions' => [
'view' => [
'read' => true,
'write' => true,
'manage' => false
]
],
'context_filter' => [
'namespace:(default OR support) level:-debug',
'app:-secret'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mezmo.com/v3/auth/role"
payload := strings.NewReader("{\n \"name\": \"Support\",\n \"roles\": [\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n },\n \"context_filter\": [\n \"namespace:(default OR support) level:-debug\",\n \"app:-secret\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.mezmo.com/v3/auth/role")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Support\",\n \"roles\": [\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n },\n \"context_filter\": [\n \"namespace:(default OR support) level:-debug\",\n \"app:-secret\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mezmo.com/v3/auth/role")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Support\",\n \"roles\": [\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n },\n \"context_filter\": [\n \"namespace:(default OR support) level:-debug\",\n \"app:-secret\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"meta": {
"type": "<string>",
"page": {
"next": "<string>",
"previous": "<string>"
},
"pk": "<string>",
"links": {
"self": {
"list": {
"method": "get",
"uri": "https://api.mezmo.com/v3/auth/resource"
},
"detail": {
"method": "get",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"update": {
"method": "patch",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"replace": {
"method": "put",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"create": {
"method": "post",
"uri": "https://api.mezmo.com/v3/auth/resource"
}
},
"related": {}
}
},
"data": {
"role_id": "5b7ca8b2b59ba49d58cc79ac",
"name": "Support",
"slug": "support",
"roles": [
"5b8fa85cb59ba49d588942b3"
],
"created_at": "2026-01-15T12:00:00.000Z",
"modified_at": "2026-01-15T12:00:00.000Z",
"account_id": "5b7180e8b59ba49d5883e7bd",
"system": false,
"internal": false,
"permissions": {
"view": {
"read": true,
"write": true,
"manage": false
}
},
"context_filter": [
"namespace:(default OR support) level:-debug",
"app:-secret"
]
}
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}Authorizations
The primary authentication method for the Mezmo API.
Pass the key in the Authorization header in the format Token <ACCESS TOKEN>.
For example:
curl -H 'Authorization: Token <ACCESS TOKEN>'
This key is used for all APIs with the exception of ingest.
Body
Roles represent a set of permissions to resources which applying to a user or an access token
Roles represent a set of permissions to resources which applying to a user or an access token
A user friendly name for a specific role.
2 - 128"Support"
25A parent role id which permissions will be inherited
24["5b8fa85cb59ba49d588942b3"]
Permissions represent the set of resources a particular entity has access to.
Show child attributes
Show child attributes
{
"view": {
"read": true,
"write": true,
"manage": false
}
}
Users belonging to this role will have the queries found in this field applied as additional filters to search queries they perform to constrain the data they have access to.
25Search query to be applied as additional pre-filters when searching logs
500[
"namespace:(default OR support) level:-debug",
"app:-secret"
]
Response
Response format containing the newly created role, in addition to the standard metadata object.
Response format containing the newly created role, in addition to the standard metadata object.
Was this page helpful?
curl --request POST \
--url https://api.mezmo.com/v3/auth/role \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Support",
"roles": [
"5b8fa85cb59ba49d588942b3"
],
"permissions": {
"view": {
"read": true,
"write": true,
"manage": false
}
},
"context_filter": [
"namespace:(default OR support) level:-debug",
"app:-secret"
]
}
'import requests
url = "https://api.mezmo.com/v3/auth/role"
payload = {
"name": "Support",
"roles": ["5b8fa85cb59ba49d588942b3"],
"permissions": { "view": {
"read": True,
"write": True,
"manage": False
} },
"context_filter": ["namespace:(default OR support) level:-debug", "app:-secret"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Support',
roles: ['5b8fa85cb59ba49d588942b3'],
permissions: {view: {read: true, write: true, manage: false}},
context_filter: ['namespace:(default OR support) level:-debug', 'app:-secret']
})
};
fetch('https://api.mezmo.com/v3/auth/role', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mezmo.com/v3/auth/role",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Support',
'roles' => [
'5b8fa85cb59ba49d588942b3'
],
'permissions' => [
'view' => [
'read' => true,
'write' => true,
'manage' => false
]
],
'context_filter' => [
'namespace:(default OR support) level:-debug',
'app:-secret'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mezmo.com/v3/auth/role"
payload := strings.NewReader("{\n \"name\": \"Support\",\n \"roles\": [\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n },\n \"context_filter\": [\n \"namespace:(default OR support) level:-debug\",\n \"app:-secret\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.mezmo.com/v3/auth/role")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Support\",\n \"roles\": [\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n },\n \"context_filter\": [\n \"namespace:(default OR support) level:-debug\",\n \"app:-secret\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mezmo.com/v3/auth/role")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Support\",\n \"roles\": [\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n },\n \"context_filter\": [\n \"namespace:(default OR support) level:-debug\",\n \"app:-secret\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"meta": {
"type": "<string>",
"page": {
"next": "<string>",
"previous": "<string>"
},
"pk": "<string>",
"links": {
"self": {
"list": {
"method": "get",
"uri": "https://api.mezmo.com/v3/auth/resource"
},
"detail": {
"method": "get",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"update": {
"method": "patch",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"replace": {
"method": "put",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"create": {
"method": "post",
"uri": "https://api.mezmo.com/v3/auth/resource"
}
},
"related": {}
}
},
"data": {
"role_id": "5b7ca8b2b59ba49d58cc79ac",
"name": "Support",
"slug": "support",
"roles": [
"5b8fa85cb59ba49d588942b3"
],
"created_at": "2026-01-15T12:00:00.000Z",
"modified_at": "2026-01-15T12:00:00.000Z",
"account_id": "5b7180e8b59ba49d5883e7bd",
"system": false,
"internal": false,
"permissions": {
"view": {
"read": true,
"write": true,
"manage": false
}
},
"context_filter": [
"namespace:(default OR support) level:-debug",
"app:-secret"
]
}
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}
