Entities API
The Entities API allows you to manage organizations, team members, invitations, and organization projects programmatically.
Endpoints
Entity Management
| Method | Path | Description |
|---|---|---|
| GET | /cloud/entities | List entities you belong to |
| POST | /cloud/entities | Create a new entity |
| GET | /cloud/entities/:id | Get entity details |
| PUT | /cloud/entities/:id | Update entity |
| DELETE | /cloud/entities/:id | Delete entity (owner only) |
Member Management
| Method | Path | Description |
|---|---|---|
| GET | /cloud/entities/:id/members | List entity members |
| POST | /cloud/entities/:id/members/invite | Invite a member by email |
| PUT | /cloud/entities/:id/members/:userId | Update member role |
| DELETE | /cloud/entities/:id/members/:userId | Remove member |
| POST | /cloud/entities/:id/leave | Leave entity |
| POST | /cloud/entities/:id/transfer | Transfer ownership |
Invitations
| Method | Path | Description |
|---|---|---|
| GET | /cloud/entities/invites/pending | Get pending invites for current user |
| POST | /cloud/entities/invites/:token/accept | Accept an invitation |
Entity Projects
| Method | Path | Description |
|---|---|---|
| GET | /cloud/entities/:id/projects | List entity projects |
| POST | /cloud/entities/:id/projects | Create project under entity |
| PUT | /cloud/entities/:id/projects/:projectId | Assign existing project to entity |
| DELETE | /cloud/entities/:id/projects/:projectId | Remove project from entity |
Create Entity
curl -X POST https://api.cloud.tenzro.com/cloud/entities \-H "Authorization: Bearer YOUR_API_KEY" \-H "Content-Type: application/json" \-d '{"entityName": "My Team","description": "Engineering team workspace"}'
Response:
{"success": true,"data": {"entityId": "ent_xxx","entityName": "My Team","entitySlug": "my-team","description": "Engineering team workspace","ownerUserId": "user_xxx","isActive": true,"createdAt": "2025-01-06T12:00:00Z"}}
Invite Member
curl -X POST https://api.cloud.tenzro.com/cloud/entities/ent_xxx/members/invite \-H "Authorization: Bearer YOUR_API_KEY" \-H "Content-Type: application/json" \-d '{"email": "teammate@example.com","role": "member"}'
Response:
{"success": true,"data": {"inviteId": "inv_xxx","entityId": "ent_xxx","email": "teammate@example.com","role": "member","inviteToken": "token_xxx","expiresAt": "2025-01-13T12:00:00Z"}}
Member Roles
Available roles for entity members:
owner- Full control over the entityadmin- Manage members and projectsmember- Access and create resourcesviewer- Read-only access
SDK Examples
import { Tenzro } from '@tenzro/cloud';const client = new Tenzro({ apiKey: 'sk_xxx' });// List your organizationsconst orgs = await client.entities.list();// Get organization detailsconst org = await client.entities.get('ent_xxx');// Update organizationawait client.entities.update('ent_xxx', {entityName: 'New Name',});// List membersconst members = await client.entities.listMembers('ent_xxx');// Update member roleawait client.entities.updateMemberRole('ent_xxx', 'user_yyy', {role: 'admin',});// Remove memberawait client.entities.removeMember('ent_xxx', 'user_yyy');// Accept an invitationconst entity = await client.entities.acceptInvite('token_xxx');