# Members ## List workspace members `client.WorkspaceAdmin.Members.List(ctx, workspaceID, query) (*CursorPagination[WorkspaceMember], error)` **get** `/v1/account/workspaces/{workspaceId}/members` Lists the members of a workspace. Admin only. ### Parameters - `workspaceID string` - `query WorkspaceAdminMemberListParams` - `Cursor param.Field[string]` Pagination cursor from previous response - `Limit param.Field[int64]` Maximum number of results to return ### Returns - `type WorkspaceMember struct{…}` A member of a workspace: the profile granted access plus the actor row that links it to the workspace. Returned by member list/add operations. - `ActorID string` The actor row linking the profile to the workspace (the junction record). - `ProfileID string` The account profile that has access to the workspace. - `AddedAt Time` When the member was added to the workspace. - `Email string` Email address of the member's profile. - `Name string` Display name of the member's profile. ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) page, err := client.WorkspaceAdmin.Members.List( context.TODO(), "workspaceId", cadenya.WorkspaceAdminMemberListParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "items": [ { "actorId": "actorId", "profileId": "profileId", "addedAt": "2019-12-27T18:11:19.117Z", "email": "email", "name": "name" } ], "pagination": { "nextCursor": "nextCursor", "total": 0 } } ``` ## Add a member to a workspace `client.WorkspaceAdmin.Members.Add(ctx, workspaceID, body) (*WorkspaceMember, error)` **post** `/v1/account/workspaces/{workspaceId}/members` Grants a profile access to the workspace by creating (or reactivating) the actor that links the profile to the workspace. Accepts either an existing profile_id or an email to resolve-or-invite. Idempotent for an already-active member. Admin only. ### Parameters - `workspaceID string` - `body WorkspaceAdminMemberAddParams` - `Email param.Field[string]` Email address to add (resolve-or-invite). Mutually exclusive with profile_id. - `ProfileID param.Field[string]` An existing account profile to add. Mutually exclusive with email. ### Returns - `type WorkspaceMember struct{…}` A member of a workspace: the profile granted access plus the actor row that links it to the workspace. Returned by member list/add operations. - `ActorID string` The actor row linking the profile to the workspace (the junction record). - `ProfileID string` The account profile that has access to the workspace. - `AddedAt Time` When the member was added to the workspace. - `Email string` Email address of the member's profile. - `Name string` Display name of the member's profile. ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) workspaceMember, err := client.WorkspaceAdmin.Members.Add( context.TODO(), "workspaceId", cadenya.WorkspaceAdminMemberAddParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", workspaceMember.ActorID) } ``` #### Response ```json { "actorId": "actorId", "profileId": "profileId", "addedAt": "2019-12-27T18:11:19.117Z", "email": "email", "name": "name" } ``` ## Remove a member from a workspace `client.WorkspaceAdmin.Members.Remove(ctx, workspaceID, profileID) error` **delete** `/v1/account/workspaces/{workspaceId}/members/{profileId}` Revokes a member's access by deactivating their actor; the member is immediately cut off. The underlying profile is not deleted. Admin only. ### Parameters - `workspaceID string` - `profileID string` ### Example ```go package main import ( "context" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) err := client.WorkspaceAdmin.Members.Remove( context.TODO(), "workspaceId", "profileId", ) if err != nil { panic(err.Error()) } } ```