Organizations API
The Organization Service provides methods for managing organizations, projects, and members.
Service Definition
service OrganizationService {
// Organizations
rpc CreateOrganization(CreateOrganizationRequest) returns (Organization);
rpc GetOrganization(GetOrganizationRequest) returns (Organization);
rpc ListOrganizations(ListOrganizationsRequest) returns (ListOrganizationsResponse);
rpc UpdateOrganization(UpdateOrganizationRequest) returns (Organization);
rpc DeleteOrganization(DeleteOrganizationRequest) returns (google.protobuf.Empty);
// Projects
rpc CreateProject(CreateProjectRequest) returns (Project);
rpc GetProject(GetProjectRequest) returns (Project);
rpc ListProjects(ListProjectsRequest) returns (ListProjectsResponse);
rpc UpdateProject(UpdateProjectRequest) returns (Project);
rpc DeleteProject(DeleteProjectRequest) returns (google.protobuf.Empty);
// Members
rpc InviteMember(InviteMemberRequest) returns (Invitation);
rpc ListMembers(ListMembersRequest) returns (ListMembersResponse);
rpc UpdateMember(UpdateMemberRequest) returns (Member);
rpc RemoveMember(RemoveMemberRequest) returns (google.protobuf.Empty);
} Organizations
CreateOrganization
Create a new organization.
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{
"name": "acme-corp",
"displayName": "ACME Corporation",
"billingEmail": "[email protected]"
}'
https://api.teabar.dev/teabar.v1.OrganizationService/CreateOrganization Response:
{
"id": "org_abc123",
"name": "acme-corp",
"displayName": "ACME Corporation",
"billingEmail": "[email protected]",
"createdAt": "2024-03-10T14:30:00Z",
"plan": "free"
} GetOrganization
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{"organizationId": "org_abc123"}'
https://api.teabar.dev/teabar.v1.OrganizationService/GetOrganization ListOrganizations
List organizations the authenticated user belongs to.
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{}'
https://api.teabar.dev/teabar.v1.OrganizationService/ListOrganizations Response:
{
"organizations": [
{
"id": "org_abc123",
"name": "acme-corp",
"displayName": "ACME Corporation",
"role": "admin",
"projectCount": 5,
"memberCount": 12
}
]
} UpdateOrganization
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{
"organizationId": "org_abc123",
"displayName": "ACME Corp International"
}'
https://api.teabar.dev/teabar.v1.OrganizationService/UpdateOrganization DeleteOrganization
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{
"organizationId": "org_abc123",
"force": true
}'
https://api.teabar.dev/teabar.v1.OrganizationService/DeleteOrganization Projects
CreateProject
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{
"organizationId": "org_abc123",
"name": "training",
"description": "Training workshop environments"
}'
https://api.teabar.dev/teabar.v1.OrganizationService/CreateProject Response:
{
"id": "proj_xyz789",
"organizationId": "org_abc123",
"name": "training",
"description": "Training workshop environments",
"createdAt": "2024-03-10T14:30:00Z"
} ListProjects
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{"organizationId": "org_abc123"}'
https://api.teabar.dev/teabar.v1.OrganizationService/ListProjects Response:
{
"projects": [
{
"id": "proj_default",
"name": "default",
"environmentCount": 8,
"blueprintCount": 3
},
{
"id": "proj_xyz789",
"name": "training",
"environmentCount": 15,
"blueprintCount": 5
}
]
} DeleteProject
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{
"projectId": "proj_xyz789",
"force": true
}'
https://api.teabar.dev/teabar.v1.OrganizationService/DeleteProject Members
InviteMember
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{
"organizationId": "org_abc123",
"email": "[email protected]",
"role": "member"
}'
https://api.teabar.dev/teabar.v1.OrganizationService/InviteMember Response:
{
"id": "inv_def456",
"email": "[email protected]",
"role": "member",
"status": "pending",
"expiresAt": "2024-03-17T14:30:00Z"
} ListMembers
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{
"organizationId": "org_abc123",
"includeInvitations": true
}'
https://api.teabar.dev/teabar.v1.OrganizationService/ListMembers Response:
{
"members": [
{
"userId": "user_abc",
"email": "[email protected]",
"name": "Alice Admin",
"role": "admin",
"status": "active",
"joinedAt": "2024-01-15T10:00:00Z"
},
{
"userId": "user_xyz",
"email": "[email protected]",
"name": "Bob Developer",
"role": "member",
"status": "active",
"joinedAt": "2024-01-20T09:15:00Z"
}
],
"invitations": [
{
"email": "[email protected]",
"role": "member",
"status": "pending",
"invitedAt": "2024-03-10T14:30:00Z"
}
]
} UpdateMember
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{
"organizationId": "org_abc123",
"userId": "user_xyz",
"role": "admin"
}'
https://api.teabar.dev/teabar.v1.OrganizationService/UpdateMember RemoveMember
curl -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '{
"organizationId": "org_abc123",
"userId": "user_xyz"
}'
https://api.teabar.dev/teabar.v1.OrganizationService/RemoveMember Data Types
Organization
message Organization {
string id = 1;
string name = 2;
string display_name = 3;
string billing_email = 4;
string plan = 5;
int32 project_count = 6;
int32 member_count = 7;
Timestamp created_at = 8;
} Project
message Project {
string id = 1;
string organization_id = 2;
string name = 3;
string description = 4;
int32 environment_count = 5;
int32 blueprint_count = 6;
Timestamp created_at = 7;
} Member
message Member {
string user_id = 1;
string email = 2;
string name = 3;
string role = 4; // "admin" or "member"
string status = 5; // "active", "suspended"
Timestamp joined_at = 6;
Timestamp last_active_at = 7;
} Error Codes
| Code | Description |
|---|---|
NOT_FOUND | Organization/project/member doesn’t exist |
ALREADY_EXISTS | Name already taken |
PERMISSION_DENIED | Insufficient permissions |
FAILED_PRECONDITION | Cannot delete (has active resources) |
See Also
- CLI org Commands - Organization CLI
- CLI project Commands - Project CLI
- CLI member Commands - Member CLI
- Administration - Web console administration