Skip to main content

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

await fetch("https://api.okaya.me/groups", {
method: "GET",
headers: {
"x-api-key": "YOUR_API_KEY",
},
}).then((response) => response.json());

Example Response

200

[
{
"groupID": 123456,
"groupName": "Group Name",
"inviteCode": "654321gfedcba",
"key": "gk_abcdefg123456",
"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

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());

Example Response

200

{
"groupID": 1710748366424,
"groupName": "Group Name",
"inviteCode": "654321gfedcba",
"key": "gk_abcdefg123456",
"credits": 0
}

400

{ "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" }

Example Call

await fetch(
"https://api.okaya.me/groups/1710748366424",
{
method: "PUT",
headers: {
"x-api-key": "YOUR_API_KEY",
},
body: JSON.stringify({
newGroupName: "New Group Name",
}),
}
).then((response) => response.json());

Example Response

200

{
"groupID": 1710748366424,
"groupName": "New Group Name",
"inviteCode": "654321gfedcba",
"key": "gk_abcdefg123456",
"credits": 0
}

400

{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }

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

await fetch(
"https://api.okaya.me/groups/1710748366424",
{
method: "DELETE",
headers: {
"x-api-key": "YOUR_API_KEY",
},
}
).then((response) => response.json());

Example Response

200

{ "message": "success" }

400

{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }

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

await fetch(
"https://api.okaya.me/groups/1710748366424/participants",
{
method: "GET",
headers: {
"x-api-key": "YOUR_API_KEY",
},
}
).then((response) => response.json());

Example Response

200

[
"ok_participant1",
"ok_participant2",
"ok_participant3"
]

400

{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }

401: Unauthorized