Fetching community information from the Chattz API is straightforward. This endpoint allows you to retrieve community details, such as its name, avatar, banner, owner, member count, and creation date.
Endpoint:
GET https://chattz.net/api/v1/communities?community_id={community_id}Parameters:
- community_id: (Required) The ID of the community whose data you want to retrieve.
Note: You can only fetch data from a public community
Example Request:
To fetch details for the community with ID 123:
https://chattz.net/api/v1/communities?community_id=123Example Response:
{
"community_name": "Excample Community",
"community_avatar": "https://chattz.net/chattz-uploads/avatar.jpg",
"community_banner": "https://chattz.net/chattz-uploads/banner.jpg",
"community_owner": "John Doe",
"member_count": "20",
"created_at": "2025-08-30 14:35:26"
}What You Get:
- community_name: The name of the community.
- community_avatar: A URL to the community’s avatar image.
- community_banner: A URL to the community’s banner image.
- community_owner: The name of the community owner.
- member_count: The number of members in the community.
- created_at: The date and time the community was created.
Common Use Cases:
- Displaying community information on your site or app.
- Integrating community data into your platform.
JavaScript Example to Fetch Community Information:
function fetchCommunityInfo(communityId) {
const apiUrl = `https://chattz.net/api/v1/communities?community_id=${communityId}`;
fetch(apiUrl)
.then(response => {
if (!response.ok) {
throw new Error('Community not found or API error');
}
return response.json();
})
.then(data => {
const communityName = data.community_name;
const communityAvatar = data.community_avatar;
const communityBanner = data.community_banner;
const communityOwner = data.community_owner;
const memberCount = data.member_count;
const createdAt = data.created_at;
console.log(`
Community Name: ${communityName}
Avatar: ${communityAvatar}
Banner: ${communityBanner}
Owner: ${communityOwner}
Member Count: ${memberCount}
Created At: ${createdAt}
`);
})
.catch(error => {
console.log("An error occurred: " + error.message);
});
}
fetchCommunityInfo(1); // Replace 1 with the community ID you want to queryExample Output (console):
Community Name: Excample Community
Avatar: https://chattz.net/chattz-uploads/avatar.jpg
Banner: https://chattz.net/chattz-uploads/banner.jpg
Owner: John Doe
Member Count: 20
Created At: 2025-08-30 14:35:26