> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mightynetworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Networks

> Understanding Networks in the Mighty Networks API

## 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
* **Profile Fields** - Additional profile information for members

## Getting Network Information

Retrieve details about your Network:

```bash cURL theme={null}
curl https://api.mn.co/admin/v1/networks/{network_id}/ \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

```javascript Node.js theme={null}
const response = await fetch(
  `https://api.mn.co/admin/v1/networks/${NETWORK_ID}/`,
  {
    headers: {
      'Authorization': `Bearer ${API_TOKEN}`
    }
  }
);

const network = await response.json();
console.log(network);
```

```python Python theme={null}
response = requests.get(
    f"https://api.mn.co/admin/v1/networks/{NETWORK_ID}/",
    headers={"Authorization": f"Bearer {API_TOKEN}"}
)

network = response.json()
print(network)
```

## 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

> [!WARNING]
>
> 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 profile fields
* Set up payment plans
* Manage invitations

## Common Use Cases

### Multi-Network Management

If you're managing multiple Mighty Networks:

```javascript theme={null}
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:

```javascript theme={null}
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

1. **Store Network IDs Securely** - Keep Network IDs and tokens in environment variables
2. **Use Consistent Naming** - Use clear variable names when working with multiple Networks
3. **Validate Network Access** - Always verify tokens have access to the intended Network
4. **Handle Errors** - Check for 401/403 errors indicating incorrect Network/token pairing

## Next Steps

> [card] [Spaces](https://docs.mightynetworks.com/spaces.md)
>
> Learn about organizing content with Spaces.

> [card] [Members](https://docs.mightynetworks.com/members.md)
>
> Understand member management and roles.

> [card] [Authentication](https://docs.mightynetworks.com/authentication.md)
>
> Set up API tokens for your Network.

> [card] [Admin API](https://docs.mightynetworks.com/admin-api.md)
>
> Explore all available endpoints.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.