Member add

Organization Member Add

[BETA]

Add new members (either via user_email or user_id) to an organization

If user doesn't exist, new user row will also be added to User Table

Only proxy_admin or org_admin of organization, allowed to access this endpoint.

Parameters:

  • organization_id: str (required)
  • member: Union[List[Member], Member] (required)
    • role: Literal[LitellmUserRoles] (required)
    • user_id: Optional[str]
    • user_email: Optional[str]

Note: Either user_id or user_email must be provided for each member.

Example:

curl -X POST 'http://0.0.0.0:4000/organization/member_add'     -H 'Authorization: Bearer sk-1234'     -H 'Content-Type: application/json'     -d '{
    "organization_id": "45e3e396-ee08-4a61-a88e-16b3ce7e0849",
    "member": {
        "role": "internal_user",
        "user_id": "krrish247652@berri.ai"
    },
    "max_budget_in_organization": 100.0
}'

The following is executed in this function:

  1. Check if organization exists
  2. Creates a new Internal User if the user_id or user_email is not found in LiteLLM_UserTable
  3. Add Internal User to the LiteLLM_OrganizationMembership table
POST/organization/member_add
Authorization
Body
member*Member
organization_id*Organization Id
max_budget_in_organizationMax Budget In Organization
Response

Successful Response

Body
organization_id*Organization Id
updated_users*Updated Users
updated_organization_memberships*Updated Organization Memberships
Request
const response = await fetch('/organization/member_add', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "member": [
        {
          "role": "org_admin"
        }
      ],
      "organization_id": "text"
    }),
});
const data = await response.json();
Response
{
  "organization_id": "text",
  "updated_users": [
    {
      "user_id": "text",
      "max_budget": 0,
      "spend": 0,
      "user_email": "text",
      "models": [],
      "tpm_limit": 0,
      "rpm_limit": 0,
      "user_role": "text",
      "organization_memberships": [
        {
          "user_id": "text",
          "organization_id": "text",
          "user_role": "text",
          "spend": 0,
          "budget_id": "text",
          "created_at": "2025-01-30T14:29:53.863Z",
          "updated_at": "2025-01-30T14:29:53.863Z",
          "litellm_budget_table": {
            "soft_budget": 0,
            "max_budget": 0,
            "max_parallel_requests": 0,
            "tpm_limit": 0,
            "rpm_limit": 0,
            "budget_duration": "text"
          }
        }
      ],
      "teams": [
        "text"
      ]
    }
  ],
  "updated_organization_memberships": [
    {
      "user_id": "text",
      "organization_id": "text",
      "user_role": "text",
      "spend": 0,
      "budget_id": "text",
      "created_at": "2025-01-30T14:29:53.863Z",
      "updated_at": "2025-01-30T14:29:53.863Z",
      "litellm_budget_table": {
        "soft_budget": 0,
        "max_budget": 0,
        "max_parallel_requests": 0,
        "tpm_limit": 0,
        "rpm_limit": 0,
        "budget_duration": "text"
      }
    }
  ]
}