Organizations API

Manage organizations, team members, and organization-wide settings.

Multi-tenant

Organize personas and chats within separate organizational boundaries.

Team Management

Invite team members and manage roles (Owner, Admin, Member).

LLM Config

Configure LLM providers and API keys at the organization level.

The Organization Object

An organization represents a workspace containing personas, chat sessions, content, and team members.

Organization Structure

JSON
{
  "id": "cmdhtumx9000nus412v5qezme",
  "name": "Acme Corporation",
  "slug": "acme-corporation-1702345678",
  "description": "AI-powered customer support organization",
  "image": "https://...",
  "website": "https://acme.com",
  "industry": "Technology",
  "size": "50-100",
  "location": "San Francisco, CA",
  "ownerId": "user_abc123",
  "createdAt": "2025-01-01T10:00:00.000Z",
  "updatedAt": "2025-01-15T14:30:00.000Z",
  "owner": {
    "id": "user_abc123",
    "name": "John Smith",
    "email": "john@acme.com"
  },
  "members": [
    {
      "userId": "user_abc123",
      "role": "OWNER",
      "joinedAt": "2025-01-01T10:00:00.000Z",
      "user": {
        "id": "user_abc123",
        "name": "John Smith",
      "email": "john@acme.com",
        "image": "https://..."
      }
    }
  ],
  "_count": {
    "members": 5,
    "personas": 12,
    "chatSessions": 342,
    "content": 56,
    "apiKeys": 3
  }
}

Organization Roles

RoleDescriptionPermissions
OWNER
Organization ownerFull control, can delete organization
ADMIN
AdministratorManage personas, members, settings
MEMBER
Regular memberUse personas, create chats

List Organizations

Get all organizations the authenticated user belongs to.

GET
trpc.organization.list

List all organizations for the current user.

Bash
curl -X GET "https://aipersona.dsethiopia.org/api/trpc/organization.list?input=%7B%7D" \
  -H "X-API-Key: your-api-key" \
  -H "X-Organization-ID: your-org-id"

Response

JSON
{
  "result": {
    "data": [
      {
        "id": "cmdhtumx9000nus412v5qezme",
        "name": "Acme Corporation",
        "slug": "acme-corporation-1702345678",
        "description": "AI-powered customer support",
        "memberRole": "OWNER",
        "joinedAt": "2025-01-01T10:00:00.000Z",
        "_count": {
          "members": 5,
          "personas": 12,
          "chatSessions": 342,
          "content": 56
        }
      },
      {
        "id": "cln2xyz789abc123",
        "name": "Side Project",
        "slug": "side-project-1702456789",
        "memberRole": "MEMBER",
        "joinedAt": "2025-01-10T15:00:00.000Z",
        "_count": {
          "members": 2,
          "personas": 3,
          "chatSessions": 15,
          "content": 5
        }
      }
    ]
  }
}

Get Organization

Get detailed information about a specific organization including members.

GET
trpc.organization.get

Get full organization details with member list.

Bash
curl -X GET "https://aipersona.dsethiopia.org/api/trpc/organization.get?input=%7B%22id%22%3A%22cmdhtumx9000nus412v5qezme%22%7D" \
  -H "X-API-Key: your-api-key" \
  -H "X-Organization-ID: your-org-id"

Current Organization

Get the organization associated with the current API key or session.

GET
trpc.organization.current

Returns the organization from the X-Organization-ID header context.

Bash
curl -X GET "https://aipersona.dsethiopia.org/api/trpc/organization.current?input=%7B%7D" \
  -H "X-API-Key: your-api-key" \
  -H "X-Organization-ID: your-org-id"

Create Organization

Create a new organization. The creator becomes the owner.

POST
trpc.organization.create

Create a new organization workspace.

Bash
curl -X POST "https://aipersona.dsethiopia.org/api/trpc/organization.create" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key" \
  -H "X-Organization-ID: your-org-id" \
  -d '{
    "json": {
      "name": "New Organization",
      "description": "Description of the organization"
    }
  }'

Input Parameters

ParameterTypeRequiredDescription
name
string
YesOrganization name (1-100 characters)
description
string
NoOptional description

Update Organization

Update organization details. Requires Owner or Admin role.

POST
trpc.organization.update

Update organization profile and settings.

Bash
curl -X POST "https://aipersona.dsethiopia.org/api/trpc/organization.update" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key" \
  -H "X-Organization-ID: your-org-id" \
  -d '{
    "json": {
      "id": "cmdhtumx9000nus412v5qezme",
      "name": "Updated Organization Name",
      "description": "New description",
      "website": "https://example.com",
      "industry": "Technology",
      "size": "50-100",
      "location": "San Francisco, CA"
    }
  }'

Updatable Fields

name - Organization name
description - Description
image - Logo URL
website - Website URL
industry - Industry type
size - Company size
location - Location

Member Management

Invite, update, and remove organization members.

POST
trpc.organization.inviteMember
Bash
curl -X POST "https://aipersona.dsethiopia.org/api/trpc/organization.inviteMember" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key" \
  -H "X-Organization-ID: your-org-id" \
  -d '{
    "json": {
      "organizationId": "cmdhtumx9000nus412v5qezme",
      "email": "newmember@example.com",
      "role": "MEMBER"
    }
  }'
Note
The invited user must have an existing AIPersona account. They will be added to the organization immediately.

LLM Configuration

Manage LLM provider API keys at the organization level.

GET
trpc.llmConfig.list
Bash
curl -X GET "https://aipersona.dsethiopia.org/api/trpc/llmConfig.list?input=%7B%7D" \
  -H "X-API-Key: your-api-key" \
  -H "X-Organization-ID: your-org-id"

Response

JSON
{
  "result": {
    "data": [
      {
        "id": "config_abc123",
        "provider": "OPENAI",
        "isActive": true,
        "isDefault": true,
        "createdAt": "2025-01-01T10:00:00.000Z"
      },
      {
        "id": "config_def456",
        "provider": "ANTHROPIC",
        "isActive": true,
        "isDefault": false,
        "createdAt": "2025-01-05T14:00:00.000Z"
      }
    ]
  }
}
Tip
API keys are encrypted before storage. When you retrieve configurations, the API key is masked for security.