Skip to content

List groups

Endpoint

GET /organizations/{org_id}/groups

This endpoint retrieves a list of groups defined within the specified organization.

Request

Replace {org_id} with your Organization ID.

Headers

  • Authorization: Bearer {your_access_token}
  • Accept: application/json
  • X-Tallyfy-Client: APIClient

Query Parameters (Optional)

  • with (string): Include additional data, e.g., assets (for group logo).
  • Pagination parameters might be available.

Code Samples

const accessToken = 'YOUR_PERSONAL_ACCESS_TOKEN';
const orgId = 'YOUR_ORGANIZATION_ID';
const queryParams = '?with=assets'; // Example
const apiUrl = `https://api.tallyfy.com/organizations/${orgId}/groups${queryParams}`;
const headers = new Headers();
headers.append('Authorization', `Bearer ${accessToken}`);
headers.append('Accept', 'application/json');
headers.append('X-Tallyfy-Client', 'APIClient');
fetch(apiUrl, {
method: 'GET',
headers: headers
})
.then(response => {
if (!response.ok) {
// Error handling...
return response.json().then(errData => { throw new Error(/*...*/); }).catch(() => { throw new Error(/*...*/); });
}
return response.json();
})
.then(data => {
console.log('Successfully listed groups:');
console.log(JSON.stringify(data, null, 2));
})
.catch(error => {
console.error('Error listing groups:', error);
});

Response

A successful request returns a 200 OK status code and a JSON object containing a data array. Each element represents a group.

{
"data": [
{
"id": "group_id_abc123", // Unique group ID
"name": "Sales Team",
"description": "Handles all sales inquiries.",
"logo": null, // Or URL if logo uploaded and requested with 'with=assets'
"members": [1001, 1005], // Array of member user IDs
"guests": ["client.a@example.com"], // Array of guest emails
"created_at": "2023-03-10T09:00:00Z",
"updated_at": "2024-04-20T10:00:00Z",
"deleted_at": null
},
{
"id": "group_id_def456",
"name": "Support Tier 1",
// ... other group details ...
}
]
// Potential meta object for pagination
}