curl -X GET 'https://api.weir.ai/org/teams?page=1&limit=10' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'x-source: console'
{
"data": {
"teams": [
{
"teamId": "team_123456789",
"name": "Development Team",
"memberCount": 5,
"createdAt": "2024-01-15T10:30:00Z",
"status": "active"
},
{
"teamId": "team_987654321",
"name": "Marketing Team",
"memberCount": 3,
"createdAt": "2024-01-20T14:15:00Z",
"status": "active"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 2,
"totalPages": 1
}
},
"message": "Teams retrieved successfully",
"status": "success"
}
Retrieve all teams in your organization with pagination support
curl -X GET 'https://api.weir.ai/org/teams?page=1&limit=10' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'x-source: console'
{
"data": {
"teams": [
{
"teamId": "team_123456789",
"name": "Development Team",
"memberCount": 5,
"createdAt": "2024-01-15T10:30:00Z",
"status": "active"
},
{
"teamId": "team_987654321",
"name": "Marketing Team",
"memberCount": 3,
"createdAt": "2024-01-20T14:15:00Z",
"status": "active"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 2,
"totalPages": 1
}
},
"message": "Teams retrieved successfully",
"status": "success"
}
curl -X GET 'https://api.weir.ai/org/teams?page=1&limit=10' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'x-source: console'
{
"data": {
"teams": [
{
"teamId": "team_123456789",
"name": "Development Team",
"memberCount": 5,
"createdAt": "2024-01-15T10:30:00Z",
"status": "active"
},
{
"teamId": "team_987654321",
"name": "Marketing Team",
"memberCount": 3,
"createdAt": "2024-01-20T14:15:00Z",
"status": "active"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 2,
"totalPages": 1
}
},
"message": "Teams retrieved successfully",
"status": "success"
}
x-source: console header.
Bearer YOUR_ACCESS_TOKENconsole for all Console API requests.Show Teams Data Properties
Show Team Object Properties
401 Unauthorized
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired token",
"details": "The provided access token is invalid or has expired"
},
"status": "error"
}
403 Forbidden
{
"error": {
"code": "FORBIDDEN",
"message": "Insufficient permissions",
"details": "You do not have permission to view teams in this organization"
},
"status": "error"
}
400 Bad Request
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid pagination parameters",
"details": {
"page": "Page must be a positive integer",
"limit": "Limit must be between 1 and 100"
}
},
"status": "error"
}
const getTeams = async (accessToken, page = 1, limit = 10) => {
try {
const response = await fetch(`https://api.weir.ai/org/teams?page=${page}&limit=${limit}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'x-source': 'console'
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data.data;
} catch (error) {
console.error('Get teams error:', error);
throw error;
}
};
// Usage
const teamsData = await getTeams('your_access_token', 1, 20);
console.log('Teams:', teamsData.teams);
console.log('Total teams:', teamsData.pagination.total);
Basic Pagination
// Get first page with default limit
const firstPage = await getTeams(accessToken);
// Get second page with 20 items per page
const secondPage = await getTeams(accessToken, 2, 20);
Complete Pagination
async function getAllTeams(accessToken) {
const allTeams = [];
let page = 1;
let hasMore = true;
while (hasMore) {
const data = await getTeams(accessToken, page, 50);
allTeams.push(...data.teams);
hasMore = page < data.pagination.totalPages;
page++;
}
return allTeams;
}
Search and Filter
// Client-side filtering example
const teamsData = await getTeams(accessToken);
const activeTeams = teamsData.teams.filter(team => team.status === 'active');
const largeTeams = teamsData.teams.filter(team => team.memberCount > 5);
Pagination
Performance
Error Handling
Was this page helpful?