Add favorite
curl --request POST \
--url https://api.opal.dev/v1/favorites \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity_id": "1b978423-db0a-4037-a4cf-f79c60cb67b3",
"entity_type": "GROUP"
}
'import requests
url = "https://api.opal.dev/v1/favorites"
payload = {
"entity_id": "1b978423-db0a-4037-a4cf-f79c60cb67b3",
"entity_type": "GROUP"
}
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({entity_id: '1b978423-db0a-4037-a4cf-f79c60cb67b3', entity_type: 'GROUP'})
};
fetch('https://api.opal.dev/v1/favorites', 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.opal.dev/v1/favorites",
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([
'entity_id' => '1b978423-db0a-4037-a4cf-f79c60cb67b3',
'entity_type' => 'GROUP'
]),
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.opal.dev/v1/favorites"
payload := strings.NewReader("{\n \"entity_id\": \"1b978423-db0a-4037-a4cf-f79c60cb67b3\",\n \"entity_type\": \"GROUP\"\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.opal.dev/v1/favorites")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity_id\": \"1b978423-db0a-4037-a4cf-f79c60cb67b3\",\n \"entity_type\": \"GROUP\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/favorites")
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 \"entity_id\": \"1b978423-db0a-4037-a4cf-f79c60cb67b3\",\n \"entity_type\": \"GROUP\"\n}"
response = http.request(request)
puts response.read_body{
"entity_id": "1b978423-db0a-4037-a4cf-f79c60cb67b3",
"entity_type": "GROUP",
"created_at": "2026-11-27T19:04:17.000Z"
}Add favorite
Adds a group, resource, or app to the favorites of the user who owns the API token.
POST
/
favorites
Add favorite
curl --request POST \
--url https://api.opal.dev/v1/favorites \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity_id": "1b978423-db0a-4037-a4cf-f79c60cb67b3",
"entity_type": "GROUP"
}
'import requests
url = "https://api.opal.dev/v1/favorites"
payload = {
"entity_id": "1b978423-db0a-4037-a4cf-f79c60cb67b3",
"entity_type": "GROUP"
}
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({entity_id: '1b978423-db0a-4037-a4cf-f79c60cb67b3', entity_type: 'GROUP'})
};
fetch('https://api.opal.dev/v1/favorites', 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.opal.dev/v1/favorites",
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([
'entity_id' => '1b978423-db0a-4037-a4cf-f79c60cb67b3',
'entity_type' => 'GROUP'
]),
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.opal.dev/v1/favorites"
payload := strings.NewReader("{\n \"entity_id\": \"1b978423-db0a-4037-a4cf-f79c60cb67b3\",\n \"entity_type\": \"GROUP\"\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.opal.dev/v1/favorites")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity_id\": \"1b978423-db0a-4037-a4cf-f79c60cb67b3\",\n \"entity_type\": \"GROUP\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/favorites")
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 \"entity_id\": \"1b978423-db0a-4037-a4cf-f79c60cb67b3\",\n \"entity_type\": \"GROUP\"\n}"
response = http.request(request)
puts response.read_body{
"entity_id": "1b978423-db0a-4037-a4cf-f79c60cb67b3",
"entity_type": "GROUP",
"created_at": "2026-11-27T19:04:17.000Z"
}Authorizations
Body
application/json
Response
The favorite just added.
A group, resource, or app the user has favorited.
Was this page helpful?