# Members

## Create

`client.teams.members.create(stringteamID, MemberCreateParamsbody, RequestOptionsoptions?): MemberCreateResponse`

**post** `/teams/{teamId}/members`

Add a member to the team

### Parameters

- `teamID: string`

- `body: MemberCreateParams`

  - `email: string`

    The email of the user you want to add to your team

  - `projectIds?: Array<string>`

    The project IDs for which the user is invited

  - `role?: "admin" | "member"`

    The role you want to give the user

    - `"admin"`

    - `"member"`

### Returns

- `MemberCreateResponse`

  - `team: Team`

    - `id: string`

      The team ID (example: "eyVcnFJcR92BxBkz7N6g5w")

    - `context: Context`

      The context of the team for the current authenticated user

      - `invitationsCount: number`

        The number of invitations on this team

      - `keysCount: number`

        The number of API keys on this team

      - `userRole: "admin" | "key" | "member"`

        The authenticated user's role for this team

        - `"admin"`

        - `"key"`

        - `"member"`

      - `usersCount: number`

        The number of users on this team

    - `createdAt: string`

      The team creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `name: string`

      The team name (example: "Scenario")

    - `plan: "cu-basic" | "cu-creator" | "cu-max" | 9 more`

      The team plan

      - `"cu-basic"`

      - `"cu-creator"`

      - `"cu-max"`

      - `"cu-pro"`

      - `"cu-pro-q3-25"`

      - `"cu-team"`

      - `"cu-team-v2"`

      - `"enterprise"`

      - `"essential"`

      - `"free"`

      - `"premium"`

      - `"pro"`

    - `projects: Array<Project>`

      Projects of the team

      - `id: string`

      - `createdAt: string`

      - `name: string`

      - `updatedAt: string`

      - `avatar?: Avatar`

        - `assetId?: string`

          ID of the asset used as thumbnail if provided, otherwise undefined

        - `url?: string`

          Signed URL of the assetId or free url if assetId is undefined

      - `disableIpDetection?: boolean`

        When true, IP detection is switched off for this project.

      - `qualityGateAutoDetect?: boolean`

        Whether Quality Gate auto-detection runs on generation for this project.

    - `type: "personal" | "shared"`

      The team type

      - `"personal"`

      - `"shared"`

    - `updatedAt: string`

      The team update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `avatar?: Avatar`

      The team's avatar

      - `assetId?: string`

        ID of the asset used as thumbnail if provided, otherwise undefined

      - `url?: string`

        Signed URL of the assetId or free url if assetId is undefined

    - `byok?: Byok`

      BYOK pricing override. Admin-only — omitted for non-admin callers.

      - `markupMultiplier: number`

      - `updatedAt?: string`

        ISO timestamp of the last update. Optional — legacy rows may lack it.

      - `updatedBy?: string`

        Human-readable handle of who last updated the markup (display name).

    - `defaultUserMaxConsumption?: number`

      Team-wide default max consumption (CU) applied to every member over the
      billing period, unless overridden per member. Absent when no team-wide
      default is set.

    - `ipDetectionEnforcement?: "active-fail-closed" | "active-fail-open" | "disabled"`

      The IP detection enforcement posture for the team.
      'disabled': IP detection is not performed.
      'active-fail-open': IP detection runs; on detector error the request is allowed through.
      'active-fail-closed': IP detection runs; on detector error the request is blocked.

      - `"active-fail-closed"`

      - `"active-fail-open"`

      - `"disabled"`

    - `qualityGateAutoDetect?: boolean`

      Quality Gate auto-detection default for the team.

### Example

```typescript
import Scenario from '@scenario-labs/sdk';

const client = new Scenario({
  apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted
  apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted
});

const member = await client.teams.members.create('teamId', { email: 'email' });

console.log(member.team);
```

#### Response

```json
{
  "team": {
    "id": "id",
    "context": {
      "invitationsCount": 0,
      "keysCount": 0,
      "userRole": "admin",
      "usersCount": 0
    },
    "createdAt": "createdAt",
    "name": "name",
    "plan": "cu-basic",
    "projects": [
      {
        "id": "id",
        "createdAt": "createdAt",
        "name": "name",
        "updatedAt": "updatedAt",
        "avatar": {
          "assetId": "assetId",
          "url": "url"
        },
        "disableIpDetection": true,
        "qualityGateAutoDetect": true
      }
    ],
    "type": "personal",
    "updatedAt": "updatedAt",
    "avatar": {
      "assetId": "assetId",
      "url": "url"
    },
    "byok": {
      "markupMultiplier": 0,
      "updatedAt": "updatedAt",
      "updatedBy": "updatedBy"
    },
    "defaultUserMaxConsumption": 0,
    "ipDetectionEnforcement": "active-fail-closed",
    "qualityGateAutoDetect": true
  }
}
```

## Delete

`client.teams.members.delete(stringmemberID, MemberDeleteParamsparams, RequestOptionsoptions?): MemberDeleteResponse`

**delete** `/teams/{teamId}/members/{memberId}`

Remove a member from the team

### Parameters

- `memberID: string`

- `params: MemberDeleteParams`

  - `teamId: string`

    The team Id concerned by the member removal

### Returns

- `MemberDeleteResponse = unknown`

### Example

```typescript
import Scenario from '@scenario-labs/sdk';

const client = new Scenario({
  apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted
  apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted
});

const member = await client.teams.members.delete('memberId', { teamId: 'teamId' });

console.log(member);
```

#### Response

```json
{}
```

## Update

`client.teams.members.update(stringmemberID, MemberUpdateParamsparams, RequestOptionsoptions?): MemberUpdateResponse`

**put** `/teams/{teamId}/members/{memberId}`

Update a team member's role and/or consumption limit

### Parameters

- `memberID: string`

- `params: MemberUpdateParams`

  - `teamId: string`

    Path param: The team Id the member belongs to

  - `maxConsumption?: number`

    Body param: Max consumption (CU) for this member over the billing period, overriding
    the team-wide default. Use a value `>= 0` to cap, `-1` for unlimited
    (uncapped), or `null` to remove the override and fall back to the team-wide
    default.

  - `role?: string`

    Body param: For a human member: a built-in team role (`admin` | `member`).
    For an API-key member: a team-plane role — a `;`-separated list of `team.*`
    scopes (e.g. `"team.members.manage;team.usage.read"`). Only a human team
    admin can grant a write scope; `team.members.manage` also lets a team key
    manage the members, API keys and consumption cap of every project of the
    team.

### Returns

- `MemberUpdateResponse = unknown`

### Example

```typescript
import Scenario from '@scenario-labs/sdk';

const client = new Scenario({
  apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted
  apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted
});

const member = await client.teams.members.update('memberId', { teamId: 'teamId' });

console.log(member);
```

#### Response

```json
{}
```

## Domain Types

### Member Create Response

- `MemberCreateResponse`

  - `team: Team`

    - `id: string`

      The team ID (example: "eyVcnFJcR92BxBkz7N6g5w")

    - `context: Context`

      The context of the team for the current authenticated user

      - `invitationsCount: number`

        The number of invitations on this team

      - `keysCount: number`

        The number of API keys on this team

      - `userRole: "admin" | "key" | "member"`

        The authenticated user's role for this team

        - `"admin"`

        - `"key"`

        - `"member"`

      - `usersCount: number`

        The number of users on this team

    - `createdAt: string`

      The team creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `name: string`

      The team name (example: "Scenario")

    - `plan: "cu-basic" | "cu-creator" | "cu-max" | 9 more`

      The team plan

      - `"cu-basic"`

      - `"cu-creator"`

      - `"cu-max"`

      - `"cu-pro"`

      - `"cu-pro-q3-25"`

      - `"cu-team"`

      - `"cu-team-v2"`

      - `"enterprise"`

      - `"essential"`

      - `"free"`

      - `"premium"`

      - `"pro"`

    - `projects: Array<Project>`

      Projects of the team

      - `id: string`

      - `createdAt: string`

      - `name: string`

      - `updatedAt: string`

      - `avatar?: Avatar`

        - `assetId?: string`

          ID of the asset used as thumbnail if provided, otherwise undefined

        - `url?: string`

          Signed URL of the assetId or free url if assetId is undefined

      - `disableIpDetection?: boolean`

        When true, IP detection is switched off for this project.

      - `qualityGateAutoDetect?: boolean`

        Whether Quality Gate auto-detection runs on generation for this project.

    - `type: "personal" | "shared"`

      The team type

      - `"personal"`

      - `"shared"`

    - `updatedAt: string`

      The team update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `avatar?: Avatar`

      The team's avatar

      - `assetId?: string`

        ID of the asset used as thumbnail if provided, otherwise undefined

      - `url?: string`

        Signed URL of the assetId or free url if assetId is undefined

    - `byok?: Byok`

      BYOK pricing override. Admin-only — omitted for non-admin callers.

      - `markupMultiplier: number`

      - `updatedAt?: string`

        ISO timestamp of the last update. Optional — legacy rows may lack it.

      - `updatedBy?: string`

        Human-readable handle of who last updated the markup (display name).

    - `defaultUserMaxConsumption?: number`

      Team-wide default max consumption (CU) applied to every member over the
      billing period, unless overridden per member. Absent when no team-wide
      default is set.

    - `ipDetectionEnforcement?: "active-fail-closed" | "active-fail-open" | "disabled"`

      The IP detection enforcement posture for the team.
      'disabled': IP detection is not performed.
      'active-fail-open': IP detection runs; on detector error the request is allowed through.
      'active-fail-closed': IP detection runs; on detector error the request is blocked.

      - `"active-fail-closed"`

      - `"active-fail-open"`

      - `"disabled"`

    - `qualityGateAutoDetect?: boolean`

      Quality Gate auto-detection default for the team.

### Member Delete Response

- `MemberDeleteResponse = unknown`

### Member Update Response

- `MemberUpdateResponse = unknown`
