Teams API
Manage team channels synced from WooCommerce Teams. Archive, restore, and sync team membership.
The Teams API allows external systems (primarily WooCommerce Teams) to manage team channels in Loop.
Archive / Restore Team
Archive a team channel or restore an archived team.
Endpoint
POST /api/v1/integration/teams/{wpTeamId}/archive
Path Parameters
| Parameter | Type | Description |
|---|---|---|
wpTeamId | integer | The WordPress/WooCommerce team ID |
Request Body
{
"action": "archive" | "restore",
"visibility": "hidden" | "readonly"
}
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Either "archive" to archive or "restore" to restore the team channel |
visibility | string | No | Archive visibility mode. Only used when action is "archive". Defaults to "hidden" |
Archive Visibility Modes
| Mode | Behavior |
|---|---|
hidden | Team channel is completely hidden from members |
readonly | Team channel is visible but members cannot post new messages |
Example Request - Archive Team as Read-Only
curl -X POST https://your-domain.com/api/v1/integration/teams/42/archive \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"action": "archive",
"visibility": "readonly"
}'
Example Request - Restore Team
curl -X POST https://your-domain.com/api/v1/integration/teams/42/archive \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"action": "restore"
}'
Success Response
{
"success": true,
"message": "Team archived successfully"
}
Error Responses
Invalid Team ID (400)
{
"error": {
"code": "invalid_team_id",
"message": "WordPress team ID must be a positive integer"
}
}
Team Not Found (400)
{
"error": {
"code": "team_not_found",
"message": "Team with WordPress ID 42 not found"
}
}
Sync Team
Create or update a team channel with full team data.
Endpoint
POST /api/v1/integration/teams
Request Body
{
"wp_team_id": 42,
"name": "Premium Subscribers",
"slug": "premium-subscribers",
"owner_wp_id": 123,
"member_wp_ids": [123, 456, 789],
"status": "active"
}
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
wp_team_id | integer | Yes | WordPress/WooCommerce team ID |
name | string | Yes | Team name (used as channel name) |
slug | string | No | URL-friendly slug (auto-generated if not provided) |
owner_wp_id | integer | Yes | WordPress user ID of the team owner |
member_wp_ids | integer[] | No | Array of WordPress user IDs for team members |
status | string | No | Team status: "active" or "inactive" |
Success Response
{
"success": true,
"created": true,
"channel": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Premium Subscribers",
"slug": "premium-subscribers",
"privacy": "private",
"channel_type": "channel",
"is_archived": false
}
}
Add Team Member
Add a member to an existing team channel.
Endpoint
POST /api/v1/integration/teams/{wpTeamId}/members
Request Body
{
"wp_user_id": 456
}
Success Response
{
"success": true,
"message": "Member added to team"
}
Remove Team Member
Remove a member from a team channel.
Endpoint
DELETE /api/v1/integration/teams/{wpTeamId}/members/{wpUserId}
Success Response
{
"success": true,
"message": "Member removed from team"
}
Error Response - Cannot Remove Owner
{
"error": {
"code": "cannot_remove_owner",
"message": "Cannot remove the team owner from the channel"
}
}
Change Team Owner
Transfer team ownership to another member.
Endpoint
PUT /api/v1/integration/teams/{wpTeamId}/owner
Request Body
{
"new_owner_wp_id": 789
}
Success Response
{
"success": true,
"message": "Team ownership transferred"
}
WooCommerce Integration Notes
Webhook Events
The Teams API is designed to be called from WooCommerce webhook events:
| WooCommerce Event | API Action |
|---|---|
team_created | POST /teams (sync) |
team_updated | POST /teams (sync) |
team_deleted | POST /teams/{id}/archive |
team_member_added | POST /teams/{id}/members |
team_member_removed | DELETE /teams/{id}/members/{userId} |
User Mapping
Team members are mapped to Loop users via the wp_user_id stored in user metadata. Users must exist in Loop before they can be added as team members.