Roles
Creates a new role for a company
Creates a custom role for your company. Send the role’s name and, optionally, the permission_keys it grants: dotted keys such as orders.view, taken from Get roles structure. Requires a company admin Bearer token with the roles.update permission. You can create a role only with permissions you hold yourself, and only with the roles.create permission; otherwise it returns 403. Returns 422 when the name is missing, duplicates an existing role, or a permission key is not recognised.
POST
/
api
/
company
/
roles
Creates a new role for a company
curl --request POST \
--url https://api.fluid.app/api/company/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": {
"name": "Customer Support",
"permission_keys": [
"orders.view",
"orders.update",
"refunds.view",
"refunds.create",
"subscriptions.view",
"subscriptions.update"
]
}
}
'import requests
url = "https://api.fluid.app/api/company/roles"
payload = { "role": {
"name": "Customer Support",
"permission_keys": ["orders.view", "orders.update", "refunds.view", "refunds.create", "subscriptions.view", "subscriptions.update"]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
role: {
name: 'Customer Support',
permission_keys: [
'orders.view',
'orders.update',
'refunds.view',
'refunds.create',
'subscriptions.view',
'subscriptions.update'
]
}
})
};
fetch('https://api.fluid.app/api/company/roles', 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.fluid.app/api/company/roles",
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([
'role' => [
'name' => 'Customer Support',
'permission_keys' => [
'orders.view',
'orders.update',
'refunds.view',
'refunds.create',
'subscriptions.view',
'subscriptions.update'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.fluid.app/api/company/roles"
payload := strings.NewReader("{\n \"role\": {\n \"name\": \"Customer Support\",\n \"permission_keys\": [\n \"orders.view\",\n \"orders.update\",\n \"refunds.view\",\n \"refunds.create\",\n \"subscriptions.view\",\n \"subscriptions.update\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", 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))
}HttpResponse<String> response = Unirest.post("https://api.fluid.app/api/company/roles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role\": {\n \"name\": \"Customer Support\",\n \"permission_keys\": [\n \"orders.view\",\n \"orders.update\",\n \"refunds.view\",\n \"refunds.create\",\n \"subscriptions.view\",\n \"subscriptions.update\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/company/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"role\": {\n \"name\": \"Customer Support\",\n \"permission_keys\": [\n \"orders.view\",\n \"orders.update\",\n \"refunds.view\",\n \"refunds.create\",\n \"subscriptions.view\",\n \"subscriptions.update\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"role": {
"id": 3187,
"name": "Customer Support",
"createdAt": "2026-09-14T15:42:08.311Z",
"user_count": 0,
"permission_keys": [
"orders.view",
"orders.update",
"refunds.view",
"refunds.create",
"subscriptions.view",
"subscriptions.update"
]
},
"meta": {
"request_id": "5f0c2b9e-3d41-4a7e-9b12-6e8d4c0a7f31",
"timestamp": "2026-09-30T14:05:12Z"
}
}{
"message": "<string>"
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"blocked_date": "2026-11-30",
"blocked_day": 30,
"allowed_date": "2026-11-28",
"scheduled_date": "2026-12-10",
"last_bill_date": "2026-11-10",
"requested_date": "2026-11-30",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}⌘I
Creates a new role for a company
curl --request POST \
--url https://api.fluid.app/api/company/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": {
"name": "Customer Support",
"permission_keys": [
"orders.view",
"orders.update",
"refunds.view",
"refunds.create",
"subscriptions.view",
"subscriptions.update"
]
}
}
'import requests
url = "https://api.fluid.app/api/company/roles"
payload = { "role": {
"name": "Customer Support",
"permission_keys": ["orders.view", "orders.update", "refunds.view", "refunds.create", "subscriptions.view", "subscriptions.update"]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
role: {
name: 'Customer Support',
permission_keys: [
'orders.view',
'orders.update',
'refunds.view',
'refunds.create',
'subscriptions.view',
'subscriptions.update'
]
}
})
};
fetch('https://api.fluid.app/api/company/roles', 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.fluid.app/api/company/roles",
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([
'role' => [
'name' => 'Customer Support',
'permission_keys' => [
'orders.view',
'orders.update',
'refunds.view',
'refunds.create',
'subscriptions.view',
'subscriptions.update'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.fluid.app/api/company/roles"
payload := strings.NewReader("{\n \"role\": {\n \"name\": \"Customer Support\",\n \"permission_keys\": [\n \"orders.view\",\n \"orders.update\",\n \"refunds.view\",\n \"refunds.create\",\n \"subscriptions.view\",\n \"subscriptions.update\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", 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))
}HttpResponse<String> response = Unirest.post("https://api.fluid.app/api/company/roles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role\": {\n \"name\": \"Customer Support\",\n \"permission_keys\": [\n \"orders.view\",\n \"orders.update\",\n \"refunds.view\",\n \"refunds.create\",\n \"subscriptions.view\",\n \"subscriptions.update\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/company/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"role\": {\n \"name\": \"Customer Support\",\n \"permission_keys\": [\n \"orders.view\",\n \"orders.update\",\n \"refunds.view\",\n \"refunds.create\",\n \"subscriptions.view\",\n \"subscriptions.update\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"role": {
"id": 3187,
"name": "Customer Support",
"createdAt": "2026-09-14T15:42:08.311Z",
"user_count": 0,
"permission_keys": [
"orders.view",
"orders.update",
"refunds.view",
"refunds.create",
"subscriptions.view",
"subscriptions.update"
]
},
"meta": {
"request_id": "5f0c2b9e-3d41-4a7e-9b12-6e8d4c0a7f31",
"timestamp": "2026-09-30T14:05:12Z"
}
}{
"message": "<string>"
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"blocked_date": "2026-11-30",
"blocked_day": 30,
"allowed_date": "2026-11-28",
"scheduled_date": "2026-12-10",
"last_bill_date": "2026-11-10",
"requested_date": "2026-11-30",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}