What is a Network?
A Network is the top-level organizational unit in Mighty Networks. It represents your entire community platform and contains all other resources like members, spaces, posts, and events.
Every API operation is scoped to a specific network, identified by the network_id parameter in your API requests.
Network Properties
Each network includes:
- Network ID - Unique identifier used in all API calls
- Name - The display name of your network
- Domain - Custom domain or subdomain (e.g.,
yournetwork.mn.co)
- Settings - Configuration for branding, features, and permissions
- Members - All users who have joined your network
- Spaces - Organizational units within the network
- Payment Plans - Subscription and pricing options
- Custom Fields - Additional profile fields for members
Retrieve details about your network:
curl https://api.mn.co/admin/v1/networks/{network_id}/ \
-H "Authorization: Bearer YOUR_API_TOKEN"
Network Scope
All API tokens and operations are scoped to a single network:
- API tokens can only access the network they were created for
- You cannot use one network’s token to access another network
- Each network requires its own API token for authentication
If you manage multiple networks, you’ll need separate API tokens for each one.
Network-Level Operations
The following operations are performed at the network level:
Members Management
- List all members across the network
- Search for specific members
- Update member roles and permissions
- View network-wide member activity
Content Management
- List all posts across all spaces
- Create posts in specific spaces
- Moderate content network-wide
- Track engagement metrics
Administrative Tasks
- Manage network settings
- Configure custom fields
- Set up payment plans
- Manage invitations
Common Use Cases
Multi-Network Management
If you’re managing multiple Mighty Networks:
const networks = [
{ id: 'network1', token: 'token1' },
{ id: 'network2', token: 'token2' }
];
for (const network of networks) {
const response = await fetch(
`https://api.mn.co/admin/v1/networks/${network.id}/members`,
{
headers: { 'Authorization': `Bearer ${network.token}` }
}
);
const members = await response.json();
console.log(`${network.id} has ${members.items.length} members`);
}
Network Analytics
Pull network-wide statistics:
async function getNetworkStats(networkId, apiToken) {
// Get total members
const membersResponse = await fetch(
`https://api.mn.co/admin/v1/networks/${networkId}/members`,
{ headers: { 'Authorization': `Bearer ${apiToken}` } }
);
// Get total spaces
const spacesResponse = await fetch(
`https://api.mn.co/admin/v1/networks/${networkId}/spaces`,
{ headers: { 'Authorization': `Bearer ${apiToken}` } }
);
return {
totalMembers: membersResponse.meta?.total_count,
totalSpaces: spacesResponse.meta?.total_count
};
}
Best Practices
- Store Network IDs Securely - Keep network IDs and tokens in environment variables
- Use Consistent Naming - Use clear variable names when working with multiple networks
- Validate Network Access - Always verify tokens have access to the intended network
- Handle Errors - Check for 401/403 errors indicating incorrect network/token pairing
Next Steps