Groups API
An enterprise can have different groups, used to categorize participants.
Get All Associated Groups
GET /groups
Retrieves a list of all groups associated with your enterprise. Each group has a group ID you will need to use in subsequent calls.
Headers
{ "x-api-key": "YOUR_API_KEY" }
Example Call
- JavaScript
- Python
- cURL
await fetch("https://api.okaya.me/groups", {
method: "GET",
headers: {
"x-api-key": "YOUR_API_KEY",
},
}).then((response) => response.json());
import requests
requests.get("https://api.okaya.me/groups",
headers={
"x-api-key": "YOUR_API_KEY"
}
).json()
curl --location "https://api.okaya.me/groups" \
--header "x-api-key: YOUR_API_KEY"
Example Response
200
[
{
"groupID": 123456,
"groupName": "Group Name",
"requestedPrivacyLevel": [],
"inviteCode": "654321gfedcba",
"key": "gk_abcdefg123456",
"consentRequired": "false",
"credits": 0
}
]
401: Unauthorized
Create a New Group
POST /groups
Create a new group for your enterprise. After creation, participants will be able to join the group.
Headers
{ "x-api-key": "YOUR_API_KEY" }
Body
{ "groupName": "Group Name" }
Example Call
- JavaScript
- Python
- cURL
await fetch("https://api.okaya.me/groups", {
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
},
body: JSON.stringify({
groupName: "Group Name",
}),
}).then((response) => response.json());
import requests
requests.post("https://api.okaya.me/groups",
headers={
"x-api-key": "YOUR_API_KEY"
},
json={
"groupName": "Group Name"
}
).json()
curl --location --request POST "https://api.okaya.me/groups" \
--header "x-api-key: YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"groupName": "Group Name"
}'
Example Response
200
{
"groupID": 1710748366424,
"groupName": "Group Name",
"requestedPrivacyLevel": [],
"inviteCode": "654321gfedcba",
"key": "gk_abcdefg123456",
"consentRequired": "false",
"credits": 0
}
400
- Invalid 'groupName'
{ "error": "You are missing the path parameter groupName" | "groupName must be a string" }
401: Unauthorized
Update an Existing Group
PUT /groups/{groupID}
Update attributes of an existing group.
Headers
{ "x-api-key": "YOUR_API_KEY" }
URL Parameters
groupID
(required): The group ID of the group you want to update.
Body
{ "groupName": "New Group Name", "consentRequired": "true" | "false" }
Example Call
- JavaScript
- Python
- cURL
await fetch(
"https://api.okaya.me/groups/1710748366424",
{
method: "PUT",
headers: {
"x-api-key": "YOUR_API_KEY",
},
body: JSON.stringify({
groupName: "New Group Name",
consentRequired: "true",
}),
}
).then((response) => response.json());
import requests
requests.put("https://api.okaya.me/groups/1710748366424",
headers={
"x-api-key": "YOUR_API_KEY"
},
json={
"groupName": "New Group Name",
"consentRequired": "true",
}
).json()
curl --location --request PUT "https://api.okaya.me/groups/1710748366424" \
--header "x-api-key: YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"groupName": "New Group Name",
"consentRequired": "true",
}'
Example Response
200
{
"groupID": 1710748366424,
"groupName": "New Group Name",
"requestedPrivacyLevel": [],
"inviteCode": "654321gfedcba",
"key": "gk_abcdefg123456",
"consentRequired": "true",
"credits": 0
}
400
- Invalid 'groupID'
- Invalid 'groupName'
- Invalid 'consentRequired'
- Group not found
- Invalid group
{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }
{ "error": "You are missing the path parameter groupName" | "groupName must be a string" }
{ "error": "You are missing the path parameter consentRequired" | "consentRequired must be a string, one of 'true' or 'false'" }
{ "error": "Group not found" }
{ "error": "Group doesn't exist in associated groups" }
401: Unauthorized
Delete an Existing Group
DELETE /groups/{groupID}
Delete an existing group.
Headers
{ "x-api-key": "YOUR_API_KEY" }
URL Parameters
groupID
(required): The group ID of the group you want to delete.
Example Call
- JavaScript
- Python
- cURL
await fetch(
"https://api.okaya.me/groups/1710748366424",
{
method: "DELETE",
headers: {
"x-api-key": "YOUR_API_KEY",
},
}
).then((response) => response.json());
import requests
requests.delete("https://api.okaya.me/groups/1710748366424",
headers={
"x-api-key": "YOUR_API_KEY"
},
).json()
curl --location --request DELETE "https://api.okaya.me/groups/1710748366424" \
--header "x-api-key: YOUR_API_KEY"
Example Response
200
{ "message": "success" }
400
- Invalid 'groupID'
- Group not found
- Invalid group
{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }
{ "error": "Group not found" }
{ "error": "Group doesn't exist in associated groups" }
401: Unauthorized
List all participants in a group
GET /groups/{groupID}/participants
List the external ID of every participant in your group.
Headers
{ "x-api-key": "YOUR_API_KEY" }
URL Parameters
groupID
(required): The group ID of the group you want to view the participants of.
Example Call
- JavaScript
- Python
- cURL
await fetch(
"https://api.okaya.me/groups/1710748366424/participants",
{
method: "GET",
headers: {
"x-api-key": "YOUR_API_KEY",
},
}
).then((response) => response.json());
import requests
requests.get("https://api.okaya.me/groups/1710748366424/participants",
headers={
"x-api-key": "YOUR_API_KEY"
},
).json()
curl --location "https://api.okaya.me/groups/1710748366424/participants" \
--header "x-api-key: YOUR_API_KEY"
Example Response
200
[
"ok_participant1",
"ok_participant2",
"ok_participant3"
]
400
- Invalid 'groupID'
- Group not found
- Invalid group
{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }
{ "error": "Group not found" }
{ "error": "Group doesn't exist in associated groups" }