Skip to content
Product Docs

Add Users To Organization

client.Organizations.Users.Add(ctx, organizationID, body) (*[]OrganizationMember, error)
PUT/api/v1/organizations/{organization_id}/users

Add a user to an organization.

ParametersExpand Collapse
organizationID string
body OrganizationUserAddParams
Body param.Field[[]OrganizationUserAddParamsBody]
ProjectIDs []string

The project IDs to add the user to.

Email stringOptional

The user’s email address.

formatemail
RoleID stringOptional

The role ID to assign to the user.

formatuuid
UserID stringOptional

The user’s ID.

ReturnsExpand Collapse
type OrganizationUserAddResponse []OrganizationMember
ID string

Unique identifier

formatuuid
OrganizationID string

The organization’s ID.

formatuuid

The roles of the user in the organization.

ID string

Unique identifier

formatuuid
OrganizationID string

The organization’s ID.

formatuuid
Role Role

The role.

ID string

Unique identifier

formatuuid
Name string

A name for the role.

maxLength3000
minLength1
Permissions []RolePermission

The actual permissions of the role.

ID string

Unique identifier

formatuuid
Access bool

Whether the permission is granted or not.

Description string

A description for the permission.

Name string

A name for the permission.

maxLength3000
minLength1
CreatedAt TimeOptional

Creation datetime

formatdate-time
UpdatedAt TimeOptional

Update datetime

formatdate-time
CreatedAt TimeOptional

Creation datetime

formatdate-time
UpdatedAt TimeOptional

Update datetime

formatdate-time
UserID string

The user’s ID.

CreatedAt TimeOptional

Creation datetime

formatdate-time
ProjectIDs []stringOptional

The project ID scope.

UpdatedAt TimeOptional

Update datetime

formatdate-time
CreatedAt TimeOptional

Creation datetime

formatdate-time
Email stringOptional

The user’s email address.

formatemail
DeprecatedInvitedByUserEmail stringOptional

The email address of the user who added the user to the organization.

formatemail
InvitedByUserID stringOptional

The user ID of the user who added the user to the organization.

Pending boolOptional

Whether the user’s membership is pending account signup.

UpdatedAt TimeOptional

Update datetime

formatdate-time
UserID stringOptional

The user’s ID.

Add Users To Organization

package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  organizationMembers, err := client.Organizations.Users.Add(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    llamacloudadmin.OrganizationUserAddParams{
      Body: []llamacloudadmin.OrganizationUserAddParamsBody{llamacloudadmin.OrganizationUserAddParamsBody{
        ProjectIDs: []string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"},
      }},
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", organizationMembers)
}
[
  {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "roles": [
      {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "role": {
          "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
          "name": "x",
          "permissions": [
            {
              "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
              "access": true,
              "description": "description",
              "name": "x",
              "created_at": "2019-12-27T18:11:19.117Z",
              "updated_at": "2019-12-27T18:11:19.117Z"
            }
          ],
          "created_at": "2019-12-27T18:11:19.117Z",
          "updated_at": "2019-12-27T18:11:19.117Z"
        },
        "user_id": "user_id",
        "created_at": "2019-12-27T18:11:19.117Z",
        "project_ids": [
          "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
        ],
        "updated_at": "2019-12-27T18:11:19.117Z"
      }
    ],
    "created_at": "2019-12-27T18:11:19.117Z",
    "email": "dev@stainless.com",
    "invited_by_user_email": "dev@stainless.com",
    "invited_by_user_id": "invited_by_user_id",
    "pending": true,
    "updated_at": "2019-12-27T18:11:19.117Z",
    "user_id": "user_id"
  }
]
Returns Examples
[
  {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "roles": [
      {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "role": {
          "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
          "name": "x",
          "permissions": [
            {
              "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
              "access": true,
              "description": "description",
              "name": "x",
              "created_at": "2019-12-27T18:11:19.117Z",
              "updated_at": "2019-12-27T18:11:19.117Z"
            }
          ],
          "created_at": "2019-12-27T18:11:19.117Z",
          "updated_at": "2019-12-27T18:11:19.117Z"
        },
        "user_id": "user_id",
        "created_at": "2019-12-27T18:11:19.117Z",
        "project_ids": [
          "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
        ],
        "updated_at": "2019-12-27T18:11:19.117Z"
      }
    ],
    "created_at": "2019-12-27T18:11:19.117Z",
    "email": "dev@stainless.com",
    "invited_by_user_email": "dev@stainless.com",
    "invited_by_user_id": "invited_by_user_id",
    "pending": true,
    "updated_at": "2019-12-27T18:11:19.117Z",
    "user_id": "user_id"
  }
]