# Projects

## Create

`client.projects.create(ProjectCreateParamsparams, RequestOptionsoptions?): ProjectCreateResponse`

**post** `/projects`

Create a new project

### Parameters

- `params: ProjectCreateParams`

  - `name: string`

    Body param: The name of the project.

  - `teamId?: string`

    Query param: The teamId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

  - `autoJoin?: boolean`

    Body param: Whether to automatically join the project as admin.

  - `privacyMode?: boolean`

    Body param: Whether to create the project in privacyMode. Default is false.

### Returns

- `ProjectCreateResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

### 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 project = await client.projects.create({ name: 'name' });

console.log(project.project);
```

#### Response

```json
{
  "project": {
    "id": "id",
    "createdAt": "createdAt",
    "keys": [
      {
        "id": "id",
        "apiKeyId": "apiKeyId",
        "apiKeyStatus": "active",
        "createdAt": "createdAt",
        "name": "name",
        "role": "role",
        "scope": "project",
        "updatedAt": "updatedAt",
        "authorId": "authorId",
        "consumption": 0,
        "lastUsedAt": "lastUsedAt",
        "maxConsumption": 0,
        "ownerId": "ownerId",
        "projects": [
          {
            "projectId": "projectId",
            "role": "role"
          }
        ]
      }
    ],
    "name": "name",
    "privacyMode": true,
    "teamId": "teamId",
    "updatedAt": "updatedAt",
    "users": [
      {
        "id": "id",
        "createdAt": "createdAt",
        "email": "email",
        "role": "role",
        "updatedAt": "updatedAt",
        "avatar": {
          "assetId": "assetId",
          "url": "url"
        },
        "consumption": 0,
        "maxConsumption": 0
      }
    ],
    "avatar": {
      "assetId": "assetId",
      "url": "url"
    },
    "consumption": 0,
    "description": "description",
    "descriptionDate": "descriptionDate",
    "disableIpDetection": true,
    "maxConsumption": 0,
    "qualityGateAutoDetect": true,
    "settings": {
      "homepage": {
        "foo": "bar"
      }
    }
  }
}
```

## Delete

`client.projects.delete(stringprojectID, RequestOptionsoptions?): ProjectDeleteResponse`

**delete** `/projects/{projectId}`

Delete a particular project

### Parameters

- `projectID: string`

### Returns

- `ProjectDeleteResponse = 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 project = await client.projects.delete('projectId');

console.log(project);
```

#### Response

```json
{}
```

## List

`client.projects.list(ProjectListParamsquery?, RequestOptionsoptions?): ProjectsCursor<ProjectListResponse>`

**get** `/projects`

List projects of a team

### Parameters

- `query: ProjectListParams`

  - `pageSize?: number`

    The number of items to return in the response. The default value is 10, maximum value is 100, minimum value is 1

  - `paginationToken?: string`

    A token you received in a previous request to query the next page of items

  - `teamId?: string`

    The teamId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

### Returns

- `ProjectListResponse`

  - `id: string`

    The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

  - `createdAt: string`

  - `keys: Array<Key>`

    The keys of the project (get from the ProjectRoles table)

    - `id: string`

      The key's member id (its API user id, `apiu_...`), taken by the member and
      usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

    - `apiKeyId: string`

      The API key id (`api_...`), taken by the api-keys routes (example:
      "api_eyVcnFJcR92BxBkz7N6g5w")

    - `apiKeyStatus: "active" | "inactive"`

      The status of the API key

      - `"active"`

      - `"inactive"`

    - `createdAt: string`

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

    - `name: string`

      The API key name (example: "eurv-scenario")

    - `role: string`

      A project role value. Accepted values are:

      - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
      - a custom inline role: a `;`-separated scope list, e.g.
        `"assets.write;workflows.run"`.

      Resolved to capabilities by `ProjectRole.scopesFromRole()`.

    - `scope: "project" | "team"`

      The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

      - `"project"`

      - `"team"`

    - `updatedAt: string`

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

    - `authorId?: string`

      The member who created the key: a human, or the member id (`apiu_...`) of
      the team API key that created it.

    - `consumption?: number`

      Consumption (CU) used by this key over the current billing period.

    - `lastUsedAt?: string`

      The date the API key was last used to authenticate a request, as an ISO
      string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
      been used.

    - `maxConsumption?: number`

      The key's effective consumption (CU) cap for the period (per-key override,
      else the team-wide default). Absent when the key is uncapped.

    - `ownerId?: string`

      For a PROJECT key: the project it was created on (the team id on some
      legacy keys). Absent for team keys.

    - `projects?: Array<Project>`

      For a PROJECT key: the projects it has access to and its role on each.
      Empty when the key is currently not a member of any (live) project.
      Absent for team keys.

      - `projectId: string`

        The project the key has a role on

      - `role: string`

        The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
        or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

  - `name: string`

    The project name (example: "Default Project")

  - `privacyMode: boolean`

    Whether the project is privacyMode
    In a privacyMode project, users can only see their own generated assets (except admins)

  - `teamId: string`

    The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

  - `updatedAt: string`

  - `users: Array<User>`

    The users of the project (get from the ProjectRoles table)

    - `id: string`

      The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

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

    - `email: string`

      The user email (example: "herve@scenario.com")

    - `role: string`

      A project role value. Accepted values are:

      - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
      - a custom inline role: a `;`-separated scope list, e.g.
        `"assets.write;workflows.run"`.

      Resolved to capabilities by `ProjectRole.scopesFromRole()`.

    - `updatedAt: string`

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

    - `avatar?: Avatar`

      The user'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

    - `consumption?: number`

      Consumption (CU) used by this member over the current billing period.

    - `maxConsumption?: number`

      The member's effective consumption (CU) cap for the period (per-user
      override, else the team-wide default). Absent when the member is uncapped.

  - `avatar?: Avatar`

    The project'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

  - `consumption?: number`

    Consumption (CU) used by this project over the current billing period.

  - `description?: string`

    High-level markdown description of the project
    Only returned on single project GET, not on list

  - `descriptionDate?: string`

    ISO string date when the description was last updated
    Only returned on single project GET, not on list

  - `disableIpDetection?: boolean`

    When true, IP detection is switched off for this project even if the team
    has an active posture. Absent means the team posture applies.
    The posture itself (disabled / active-fail-open / active-fail-closed) is a
    team-level setting, see the team's ipDetectionEnforcement.

  - `maxConsumption?: number`

    The project's consumption (CU) cap for the period. Absent when uncapped.

  - `qualityGateAutoDetect?: boolean`

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

  - `settings?: Settings`

    Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
    absent from the projects list.

    - `homepage?: Record<string, unknown>`

      Published homepage layout.

### 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
});

// Automatically fetches more pages as needed.
for await (const projectListResponse of client.projects.list()) {
  console.log(projectListResponse.id);
}
```

#### Response

```json
{
  "projects": [
    {
      "id": "id",
      "createdAt": "createdAt",
      "keys": [
        {
          "id": "id",
          "apiKeyId": "apiKeyId",
          "apiKeyStatus": "active",
          "createdAt": "createdAt",
          "name": "name",
          "role": "role",
          "scope": "project",
          "updatedAt": "updatedAt",
          "authorId": "authorId",
          "consumption": 0,
          "lastUsedAt": "lastUsedAt",
          "maxConsumption": 0,
          "ownerId": "ownerId",
          "projects": [
            {
              "projectId": "projectId",
              "role": "role"
            }
          ]
        }
      ],
      "name": "name",
      "privacyMode": true,
      "teamId": "teamId",
      "updatedAt": "updatedAt",
      "users": [
        {
          "id": "id",
          "createdAt": "createdAt",
          "email": "email",
          "role": "role",
          "updatedAt": "updatedAt",
          "avatar": {
            "assetId": "assetId",
            "url": "url"
          },
          "consumption": 0,
          "maxConsumption": 0
        }
      ],
      "avatar": {
        "assetId": "assetId",
        "url": "url"
      },
      "consumption": 0,
      "description": "description",
      "descriptionDate": "descriptionDate",
      "disableIpDetection": true,
      "maxConsumption": 0,
      "qualityGateAutoDetect": true,
      "settings": {
        "homepage": {
          "foo": "bar"
        }
      }
    }
  ],
  "nextPaginationToken": "nextPaginationToken"
}
```

## Retrieve

`client.projects.retrieve(stringprojectID, RequestOptionsoptions?): ProjectRetrieveResponse`

**get** `/projects/{projectId}`

Get a project by projectId

### Parameters

- `projectID: string`

### Returns

- `ProjectRetrieveResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

### 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 project = await client.projects.retrieve('projectId');

console.log(project.project);
```

#### Response

```json
{
  "project": {
    "id": "id",
    "createdAt": "createdAt",
    "keys": [
      {
        "id": "id",
        "apiKeyId": "apiKeyId",
        "apiKeyStatus": "active",
        "createdAt": "createdAt",
        "name": "name",
        "role": "role",
        "scope": "project",
        "updatedAt": "updatedAt",
        "authorId": "authorId",
        "consumption": 0,
        "lastUsedAt": "lastUsedAt",
        "maxConsumption": 0,
        "ownerId": "ownerId",
        "projects": [
          {
            "projectId": "projectId",
            "role": "role"
          }
        ]
      }
    ],
    "name": "name",
    "privacyMode": true,
    "teamId": "teamId",
    "updatedAt": "updatedAt",
    "users": [
      {
        "id": "id",
        "createdAt": "createdAt",
        "email": "email",
        "role": "role",
        "updatedAt": "updatedAt",
        "avatar": {
          "assetId": "assetId",
          "url": "url"
        },
        "consumption": 0,
        "maxConsumption": 0
      }
    ],
    "avatar": {
      "assetId": "assetId",
      "url": "url"
    },
    "consumption": 0,
    "description": "description",
    "descriptionDate": "descriptionDate",
    "disableIpDetection": true,
    "maxConsumption": 0,
    "qualityGateAutoDetect": true,
    "settings": {
      "homepage": {
        "foo": "bar"
      }
    }
  }
}
```

## Update

`client.projects.update(stringprojectID, ProjectUpdateParamsbody, RequestOptionsoptions?): ProjectUpdateResponse`

**put** `/projects/{projectId}`

Update the name of a Project

### Parameters

- `projectID: string`

- `body: ProjectUpdateParams`

  - `avatarAssetId?: string`

    The project's avatar asset ID (must be kind image)

  - `description?: string`

    High-level markdown description of the project
    Set to null to clear the description

  - `disableIpDetection?: boolean`

    Switch IP detection off for this project only.
    The team's posture (see PUT /teams/{teamId}) applies to every project by
    default; set this to true to opt this project out of it, false to opt it
    back in. A project cannot choose a posture of its own. Team-admin only.

  - `maxConsumption?: number`

    Max consumption (CU) for this project over the billing period.
    Set to null to remove the cap. Team admins only, or a team API key holding
    `team.members.manage`, which may then send this field alone.

  - `name?: string`

    The project name (example: "Default Project")

  - `privacyMode?: boolean`

    Toggle the privacyMode mode
    When enabled, users can only see their own generated assets (except admins)

  - `qualityGateAutoDetect?: boolean`

    Quality Gate auto-detection override for this project (wins over the team
    default). Set to null to clear the override.

  - `settings?: Settings`

    Project settings. Set `homepage` to a layout object to publish it, or to
    `null` to unpublish it. Team admins and project admins only.

    - `homepage?: unknown`

      Homepage layout. An object publishes it; `null` unpublishes it.

### Returns

- `ProjectUpdateResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

### 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 project = await client.projects.update('projectId');

console.log(project.project);
```

#### Response

```json
{
  "project": {
    "id": "id",
    "createdAt": "createdAt",
    "keys": [
      {
        "id": "id",
        "apiKeyId": "apiKeyId",
        "apiKeyStatus": "active",
        "createdAt": "createdAt",
        "name": "name",
        "role": "role",
        "scope": "project",
        "updatedAt": "updatedAt",
        "authorId": "authorId",
        "consumption": 0,
        "lastUsedAt": "lastUsedAt",
        "maxConsumption": 0,
        "ownerId": "ownerId",
        "projects": [
          {
            "projectId": "projectId",
            "role": "role"
          }
        ]
      }
    ],
    "name": "name",
    "privacyMode": true,
    "teamId": "teamId",
    "updatedAt": "updatedAt",
    "users": [
      {
        "id": "id",
        "createdAt": "createdAt",
        "email": "email",
        "role": "role",
        "updatedAt": "updatedAt",
        "avatar": {
          "assetId": "assetId",
          "url": "url"
        },
        "consumption": 0,
        "maxConsumption": 0
      }
    ],
    "avatar": {
      "assetId": "assetId",
      "url": "url"
    },
    "consumption": 0,
    "description": "description",
    "descriptionDate": "descriptionDate",
    "disableIpDetection": true,
    "maxConsumption": 0,
    "qualityGateAutoDetect": true,
    "settings": {
      "homepage": {
        "foo": "bar"
      }
    }
  }
}
```

## Domain Types

### Project Create Response

- `ProjectCreateResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

### Project Delete Response

- `ProjectDeleteResponse = unknown`

### Project List Response

- `ProjectListResponse`

  - `id: string`

    The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

  - `createdAt: string`

  - `keys: Array<Key>`

    The keys of the project (get from the ProjectRoles table)

    - `id: string`

      The key's member id (its API user id, `apiu_...`), taken by the member and
      usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

    - `apiKeyId: string`

      The API key id (`api_...`), taken by the api-keys routes (example:
      "api_eyVcnFJcR92BxBkz7N6g5w")

    - `apiKeyStatus: "active" | "inactive"`

      The status of the API key

      - `"active"`

      - `"inactive"`

    - `createdAt: string`

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

    - `name: string`

      The API key name (example: "eurv-scenario")

    - `role: string`

      A project role value. Accepted values are:

      - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
      - a custom inline role: a `;`-separated scope list, e.g.
        `"assets.write;workflows.run"`.

      Resolved to capabilities by `ProjectRole.scopesFromRole()`.

    - `scope: "project" | "team"`

      The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

      - `"project"`

      - `"team"`

    - `updatedAt: string`

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

    - `authorId?: string`

      The member who created the key: a human, or the member id (`apiu_...`) of
      the team API key that created it.

    - `consumption?: number`

      Consumption (CU) used by this key over the current billing period.

    - `lastUsedAt?: string`

      The date the API key was last used to authenticate a request, as an ISO
      string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
      been used.

    - `maxConsumption?: number`

      The key's effective consumption (CU) cap for the period (per-key override,
      else the team-wide default). Absent when the key is uncapped.

    - `ownerId?: string`

      For a PROJECT key: the project it was created on (the team id on some
      legacy keys). Absent for team keys.

    - `projects?: Array<Project>`

      For a PROJECT key: the projects it has access to and its role on each.
      Empty when the key is currently not a member of any (live) project.
      Absent for team keys.

      - `projectId: string`

        The project the key has a role on

      - `role: string`

        The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
        or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

  - `name: string`

    The project name (example: "Default Project")

  - `privacyMode: boolean`

    Whether the project is privacyMode
    In a privacyMode project, users can only see their own generated assets (except admins)

  - `teamId: string`

    The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

  - `updatedAt: string`

  - `users: Array<User>`

    The users of the project (get from the ProjectRoles table)

    - `id: string`

      The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

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

    - `email: string`

      The user email (example: "herve@scenario.com")

    - `role: string`

      A project role value. Accepted values are:

      - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
      - a custom inline role: a `;`-separated scope list, e.g.
        `"assets.write;workflows.run"`.

      Resolved to capabilities by `ProjectRole.scopesFromRole()`.

    - `updatedAt: string`

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

    - `avatar?: Avatar`

      The user'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

    - `consumption?: number`

      Consumption (CU) used by this member over the current billing period.

    - `maxConsumption?: number`

      The member's effective consumption (CU) cap for the period (per-user
      override, else the team-wide default). Absent when the member is uncapped.

  - `avatar?: Avatar`

    The project'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

  - `consumption?: number`

    Consumption (CU) used by this project over the current billing period.

  - `description?: string`

    High-level markdown description of the project
    Only returned on single project GET, not on list

  - `descriptionDate?: string`

    ISO string date when the description was last updated
    Only returned on single project GET, not on list

  - `disableIpDetection?: boolean`

    When true, IP detection is switched off for this project even if the team
    has an active posture. Absent means the team posture applies.
    The posture itself (disabled / active-fail-open / active-fail-closed) is a
    team-level setting, see the team's ipDetectionEnforcement.

  - `maxConsumption?: number`

    The project's consumption (CU) cap for the period. Absent when uncapped.

  - `qualityGateAutoDetect?: boolean`

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

  - `settings?: Settings`

    Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
    absent from the projects list.

    - `homepage?: Record<string, unknown>`

      Published homepage layout.

### Project Retrieve Response

- `ProjectRetrieveResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

### Project Update Response

- `ProjectUpdateResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

# API Keys

## Create

`client.projects.apiKeys.create(stringprojectID, APIKeyCreateParamsbody, RequestOptionsoptions?): APIKeyCreateResponse`

**post** `/projects/{projectId}/api-keys`

Create an API key for a particular project

### Parameters

- `projectID: string`

- `body: APIKeyCreateParams`

  - `maxConsumption?: number`

    Optional spending cap (CU) for this key over the billing period: a value >= 0 to cap, or -1 for unlimited. Omit to inherit the default.

  - `name?: string`

    The API Key name

  - `role?: string`

    Project role: a built-in role (admin | editor | reader) or a custom inline ";"-separated scope list (e.g. "assets.read;workflows.run"). Defaults to editor.

### Returns

- `APIKeyCreateResponse`

  - `id: string`

  - `authorId: string`

  - `createdAt: string`

  - `ownerType: "project" | "team"`

    - `"project"`

    - `"team"`

  - `secret: string`

  - `userId: string`

    The key's member id (`apiu_...`), taken by the member routes; the
    api-keys routes take `id`.

  - `ownerId?: string`

  - `teamId?: string`

### 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 apiKey = await client.projects.apiKeys.create('projectId');

console.log(apiKey.id);
```

#### Response

```json
{
  "id": "id",
  "authorId": "authorId",
  "createdAt": "createdAt",
  "ownerType": "project",
  "secret": "secret",
  "userId": "userId",
  "ownerId": "ownerId",
  "teamId": "teamId"
}
```

## Delete

`client.projects.apiKeys.delete(stringkeyID, APIKeyDeleteParamsparams, RequestOptionsoptions?): APIKeyDeleteResponse`

**delete** `/projects/{projectId}/api-keys/{keyId}`

Delete a particular api key

### Parameters

- `keyID: string`

- `params: APIKeyDeleteParams`

  - `projectId: string`

    The project Id on which the api key exists

### Returns

- `APIKeyDeleteResponse = 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 apiKey = await client.projects.apiKeys.delete('keyId', { projectId: 'projectId' });

console.log(apiKey);
```

#### Response

```json
{}
```

## Domain Types

### API Key Create Response

- `APIKeyCreateResponse`

  - `id: string`

  - `authorId: string`

  - `createdAt: string`

  - `ownerType: "project" | "team"`

    - `"project"`

    - `"team"`

  - `secret: string`

  - `userId: string`

    The key's member id (`apiu_...`), taken by the member routes; the
    api-keys routes take `id`.

  - `ownerId?: string`

  - `teamId?: string`

### API Key Delete Response

- `APIKeyDeleteResponse = unknown`

# Brief

## Delete

`client.projects.brief.delete(stringprojectID, RequestOptionsoptions?): BriefDeleteResponse`

**delete** `/projects/{projectId}/brief`

Delete the project's Quality Gate brief

### Parameters

- `projectID: string`

### Returns

- `BriefDeleteResponse`

  - `deleted: boolean`

### 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 brief = await client.projects.brief.delete('projectId');

console.log(brief.deleted);
```

#### Response

```json
{
  "deleted": true
}
```

## Retrieve

`client.projects.brief.retrieve(stringprojectID, RequestOptionsoptions?): BriefRetrieveResponse`

**get** `/projects/{projectId}/brief`

Get the project's Quality Gate brief

### Parameters

- `projectID: string`

### Returns

- `BriefRetrieveResponse`

  - `brief: Brief`

    A brand-style / project-rules / campaign-context brief stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `body: string`

      Free-text brief: brand style, rules, campaign context

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the brief

    - `enabled: boolean`

      Whether the brief is applied during verification

    - `level: "project" | "team"`

      Scope this brief applies to: team or project

      - `"project"`

      - `"team"`

    - `referenceAssetIds: Array<string>`

      Reference assets the verifier compares the image against

    - `scopeId: string`

      The id of the team or project that owns this brief

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `sensitivity?: "high" | "low" | "medium"`

      Threshold strictness applied when verifying against this scope

      - `"high"`

      - `"low"`

      - `"medium"`

### 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 brief = await client.projects.brief.retrieve('projectId');

console.log(brief.brief);
```

#### Response

```json
{
  "brief": {
    "id": "id",
    "body": "body",
    "createdAt": "createdAt",
    "createdBy": "createdBy",
    "enabled": true,
    "level": "project",
    "referenceAssetIds": [
      "string"
    ],
    "scopeId": "scopeId",
    "updatedAt": "updatedAt",
    "sensitivity": "high"
  }
}
```

## Update

`client.projects.brief.update(stringprojectID, BriefUpdateParamsbody, RequestOptionsoptions?): BriefUpdateResponse`

**put** `/projects/{projectId}/brief`

Create or update the project's Quality Gate brief

### Parameters

- `projectID: string`

- `body: BriefUpdateParams`

  - `body: string`

    Free-text brief content

  - `enabled?: boolean`

    Whether the brief is applied during verification (default true)

  - `referenceAssetIds?: Array<string>`

    Reference assets the verifier compares against (max 10). Send [] to clear.

  - `sensitivity?: "high" | "low" | "medium"`

    Threshold strictness stored for this scope: low, medium, or high. Applied
    to verifications unless the verify call passes its own sensitivity.

    - `"high"`

    - `"low"`

    - `"medium"`

### Returns

- `BriefUpdateResponse`

  - `brief: Brief`

    A brand-style / project-rules / campaign-context brief stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `body: string`

      Free-text brief: brand style, rules, campaign context

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the brief

    - `enabled: boolean`

      Whether the brief is applied during verification

    - `level: "project" | "team"`

      Scope this brief applies to: team or project

      - `"project"`

      - `"team"`

    - `referenceAssetIds: Array<string>`

      Reference assets the verifier compares the image against

    - `scopeId: string`

      The id of the team or project that owns this brief

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `sensitivity?: "high" | "low" | "medium"`

      Threshold strictness applied when verifying against this scope

      - `"high"`

      - `"low"`

      - `"medium"`

### 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 brief = await client.projects.brief.update('projectId', { body: 'x' });

console.log(brief.brief);
```

#### Response

```json
{
  "brief": {
    "id": "id",
    "body": "body",
    "createdAt": "createdAt",
    "createdBy": "createdBy",
    "enabled": true,
    "level": "project",
    "referenceAssetIds": [
      "string"
    ],
    "scopeId": "scopeId",
    "updatedAt": "updatedAt",
    "sensitivity": "high"
  }
}
```

## Domain Types

### Brief Delete Response

- `BriefDeleteResponse`

  - `deleted: boolean`

### Brief Retrieve Response

- `BriefRetrieveResponse`

  - `brief: Brief`

    A brand-style / project-rules / campaign-context brief stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `body: string`

      Free-text brief: brand style, rules, campaign context

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the brief

    - `enabled: boolean`

      Whether the brief is applied during verification

    - `level: "project" | "team"`

      Scope this brief applies to: team or project

      - `"project"`

      - `"team"`

    - `referenceAssetIds: Array<string>`

      Reference assets the verifier compares the image against

    - `scopeId: string`

      The id of the team or project that owns this brief

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `sensitivity?: "high" | "low" | "medium"`

      Threshold strictness applied when verifying against this scope

      - `"high"`

      - `"low"`

      - `"medium"`

### Brief Update Response

- `BriefUpdateResponse`

  - `brief: Brief`

    A brand-style / project-rules / campaign-context brief stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `body: string`

      Free-text brief: brand style, rules, campaign context

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the brief

    - `enabled: boolean`

      Whether the brief is applied during verification

    - `level: "project" | "team"`

      Scope this brief applies to: team or project

      - `"project"`

      - `"team"`

    - `referenceAssetIds: Array<string>`

      Reference assets the verifier compares the image against

    - `scopeId: string`

      The id of the team or project that owns this brief

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `sensitivity?: "high" | "low" | "medium"`

      Threshold strictness applied when verifying against this scope

      - `"high"`

      - `"low"`

      - `"medium"`

# Instructions

## Retrieve

`client.projects.instructions.retrieve(stringprojectID, RequestOptionsoptions?): InstructionRetrieveResponse`

**get** `/projects/{projectId}/instructions`

Get the project's assistant instructions (markdown). Returns 404 if not set. Any project member can read.

### Parameters

- `projectID: string`

### Returns

- `InstructionRetrieveResponse`

  - `memory: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI

### 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 instruction = await client.projects.instructions.retrieve('projectId');

console.log(instruction.memory);
```

#### Response

```json
{
  "memory": {
    "id": "id",
    "content": "content",
    "createdAt": "createdAt",
    "sizeBytes": 0,
    "updatedAt": "updatedAt",
    "updatedBy": "updatedBy"
  }
}
```

## Update

`client.projects.instructions.update(stringprojectID, InstructionUpdateParamsbody, RequestOptionsoptions?): InstructionUpdateResponse`

**put** `/projects/{projectId}/instructions`

Set the project's assistant instructions (markdown, max 50KB). Set content to null to clear. Team or project admins only.

### Parameters

- `projectID: string`

- `body: InstructionUpdateParams`

  - `content?: string`

    Markdown content of the memory. Set to null to clear.
    Max size depends on the scope (20-50 KB).

### Returns

- `InstructionUpdateResponse`

  - `memory?: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI

### 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 instruction = await client.projects.instructions.update('projectId');

console.log(instruction.memory);
```

#### Response

```json
{
  "memory": {
    "id": "id",
    "content": "content",
    "createdAt": "createdAt",
    "sizeBytes": 0,
    "updatedAt": "updatedAt",
    "updatedBy": "updatedBy"
  }
}
```

## Domain Types

### Instruction Retrieve Response

- `InstructionRetrieveResponse`

  - `memory: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI

### Instruction Update Response

- `InstructionUpdateResponse`

  - `memory?: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI

# Members

## Create

`client.projects.members.create(stringprojectID, MemberCreateParamsbody, RequestOptionsoptions?): MemberCreateResponse`

**post** `/projects/{projectId}/members`

Add a member to the project

### Parameters

- `projectID: string`

- `body: MemberCreateParams`

  - `role: string`

    The role you want to give the user

  - `userId: string`

    The userId of the user you want to add to your project

### Returns

- `MemberCreateResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

### 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.projects.members.create('projectId', {
  role: 'role',
  userId: 'userId',
});

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

#### Response

```json
{
  "project": {
    "id": "id",
    "createdAt": "createdAt",
    "keys": [
      {
        "id": "id",
        "apiKeyId": "apiKeyId",
        "apiKeyStatus": "active",
        "createdAt": "createdAt",
        "name": "name",
        "role": "role",
        "scope": "project",
        "updatedAt": "updatedAt",
        "authorId": "authorId",
        "consumption": 0,
        "lastUsedAt": "lastUsedAt",
        "maxConsumption": 0,
        "ownerId": "ownerId",
        "projects": [
          {
            "projectId": "projectId",
            "role": "role"
          }
        ]
      }
    ],
    "name": "name",
    "privacyMode": true,
    "teamId": "teamId",
    "updatedAt": "updatedAt",
    "users": [
      {
        "id": "id",
        "createdAt": "createdAt",
        "email": "email",
        "role": "role",
        "updatedAt": "updatedAt",
        "avatar": {
          "assetId": "assetId",
          "url": "url"
        },
        "consumption": 0,
        "maxConsumption": 0
      }
    ],
    "avatar": {
      "assetId": "assetId",
      "url": "url"
    },
    "consumption": 0,
    "description": "description",
    "descriptionDate": "descriptionDate",
    "disableIpDetection": true,
    "maxConsumption": 0,
    "qualityGateAutoDetect": true,
    "settings": {
      "homepage": {
        "foo": "bar"
      }
    }
  }
}
```

## Delete

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

**delete** `/projects/{projectId}/members/{memberId}`

Remove a member from the project

### Parameters

- `memberID: string`

- `params: MemberDeleteParams`

  - `projectId: string`

    The project Id concerned by the member removal

### Returns

- `MemberDeleteResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

### 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.projects.members.delete('memberId', { projectId: 'projectId' });

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

#### Response

```json
{
  "project": {
    "id": "id",
    "createdAt": "createdAt",
    "keys": [
      {
        "id": "id",
        "apiKeyId": "apiKeyId",
        "apiKeyStatus": "active",
        "createdAt": "createdAt",
        "name": "name",
        "role": "role",
        "scope": "project",
        "updatedAt": "updatedAt",
        "authorId": "authorId",
        "consumption": 0,
        "lastUsedAt": "lastUsedAt",
        "maxConsumption": 0,
        "ownerId": "ownerId",
        "projects": [
          {
            "projectId": "projectId",
            "role": "role"
          }
        ]
      }
    ],
    "name": "name",
    "privacyMode": true,
    "teamId": "teamId",
    "updatedAt": "updatedAt",
    "users": [
      {
        "id": "id",
        "createdAt": "createdAt",
        "email": "email",
        "role": "role",
        "updatedAt": "updatedAt",
        "avatar": {
          "assetId": "assetId",
          "url": "url"
        },
        "consumption": 0,
        "maxConsumption": 0
      }
    ],
    "avatar": {
      "assetId": "assetId",
      "url": "url"
    },
    "consumption": 0,
    "description": "description",
    "descriptionDate": "descriptionDate",
    "disableIpDetection": true,
    "maxConsumption": 0,
    "qualityGateAutoDetect": true,
    "settings": {
      "homepage": {
        "foo": "bar"
      }
    }
  }
}
```

## Update

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

**put** `/projects/{projectId}/members/{memberId}`

Change a member role

### Parameters

- `memberID: string`

- `params: MemberUpdateParams`

  - `projectId: string`

    Path param: The project Id concerned by the role change

  - `role?: string`

    Body param: The role you want to give the member

### Returns

- `MemberUpdateResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

### 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.projects.members.update('memberId', { projectId: 'projectId' });

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

#### Response

```json
{
  "project": {
    "id": "id",
    "createdAt": "createdAt",
    "keys": [
      {
        "id": "id",
        "apiKeyId": "apiKeyId",
        "apiKeyStatus": "active",
        "createdAt": "createdAt",
        "name": "name",
        "role": "role",
        "scope": "project",
        "updatedAt": "updatedAt",
        "authorId": "authorId",
        "consumption": 0,
        "lastUsedAt": "lastUsedAt",
        "maxConsumption": 0,
        "ownerId": "ownerId",
        "projects": [
          {
            "projectId": "projectId",
            "role": "role"
          }
        ]
      }
    ],
    "name": "name",
    "privacyMode": true,
    "teamId": "teamId",
    "updatedAt": "updatedAt",
    "users": [
      {
        "id": "id",
        "createdAt": "createdAt",
        "email": "email",
        "role": "role",
        "updatedAt": "updatedAt",
        "avatar": {
          "assetId": "assetId",
          "url": "url"
        },
        "consumption": 0,
        "maxConsumption": 0
      }
    ],
    "avatar": {
      "assetId": "assetId",
      "url": "url"
    },
    "consumption": 0,
    "description": "description",
    "descriptionDate": "descriptionDate",
    "disableIpDetection": true,
    "maxConsumption": 0,
    "qualityGateAutoDetect": true,
    "settings": {
      "homepage": {
        "foo": "bar"
      }
    }
  }
}
```

## Domain Types

### Member Create Response

- `MemberCreateResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

### Member Delete Response

- `MemberDeleteResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

### Member Update Response

- `MemberUpdateResponse`

  - `project: Project`

    - `id: string`

      The project ID (example: "project_eyVcnFJcR92BxBkz7N6g5w")

    - `createdAt: string`

    - `keys: Array<Key>`

      The keys of the project (get from the ProjectRoles table)

      - `id: string`

        The key's member id (its API user id, `apiu_...`), taken by the member and
        usage routes (example: "apiu_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyId: string`

        The API key id (`api_...`), taken by the api-keys routes (example:
        "api_eyVcnFJcR92BxBkz7N6g5w")

      - `apiKeyStatus: "active" | "inactive"`

        The status of the API key

        - `"active"`

        - `"inactive"`

      - `createdAt: string`

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

      - `name: string`

        The API key name (example: "eurv-scenario")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `scope: "project" | "team"`

        The scope of the API key: 'project' for project-scoped keys, 'team' for team-scoped keys

        - `"project"`

        - `"team"`

      - `updatedAt: string`

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

      - `authorId?: string`

        The member who created the key: a human, or the member id (`apiu_...`) of
        the team API key that created it.

      - `consumption?: number`

        Consumption (CU) used by this key over the current billing period.

      - `lastUsedAt?: string`

        The date the API key was last used to authenticate a request, as an ISO
        string (example: "2023-02-03T11:19:41.579Z"). Absent if the key has never
        been used.

      - `maxConsumption?: number`

        The key's effective consumption (CU) cap for the period (per-key override,
        else the team-wide default). Absent when the key is uncapped.

      - `ownerId?: string`

        For a PROJECT key: the project it was created on (the team id on some
        legacy keys). Absent for team keys.

      - `projects?: Array<Project>`

        For a PROJECT key: the projects it has access to and its role on each.
        Empty when the key is currently not a member of any (live) project.
        Absent for team keys.

        - `projectId: string`

          The project the key has a role on

        - `role: string`

          The key's role on this project: a built-in role (`admin`/`editor`/`reader`)
          or a custom `;`-separated scope list (example: `"asset.read;model.read"`).

    - `name: string`

      The project name (example: "Default Project")

    - `privacyMode: boolean`

      Whether the project is privacyMode
      In a privacyMode project, users can only see their own generated assets (except admins)

    - `teamId: string`

      The team ID (example: "team_eyVcnFJcR92BxBkz7N6g5w")

    - `updatedAt: string`

    - `users: Array<User>`

      The users of the project (get from the ProjectRoles table)

      - `id: string`

        The user ID (example: "eyVcnFJcR92BxBkz7N6g5w")

      - `createdAt: string`

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

      - `email: string`

        The user email (example: "herve@scenario.com")

      - `role: string`

        A project role value. Accepted values are:

        - a built-in role: `"admin"`, `"editor"` or `"reader"` (see `ProjectRoles`);
        - a custom inline role: a `;`-separated scope list, e.g.
          `"assets.write;workflows.run"`.

        Resolved to capabilities by `ProjectRole.scopesFromRole()`.

      - `updatedAt: string`

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

      - `avatar?: Avatar`

        The user'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

      - `consumption?: number`

        Consumption (CU) used by this member over the current billing period.

      - `maxConsumption?: number`

        The member's effective consumption (CU) cap for the period (per-user
        override, else the team-wide default). Absent when the member is uncapped.

    - `avatar?: Avatar`

      The project'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

    - `consumption?: number`

      Consumption (CU) used by this project over the current billing period.

    - `description?: string`

      High-level markdown description of the project
      Only returned on single project GET, not on list

    - `descriptionDate?: string`

      ISO string date when the description was last updated
      Only returned on single project GET, not on list

    - `disableIpDetection?: boolean`

      When true, IP detection is switched off for this project even if the team
      has an active posture. Absent means the team posture applies.
      The posture itself (disabled / active-fail-open / active-fail-closed) is a
      team-level setting, see the team's ipDetectionEnforcement.

    - `maxConsumption?: number`

      The project's consumption (CU) cap for the period. Absent when uncapped.

    - `qualityGateAutoDetect?: boolean`

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

    - `settings?: Settings`

      Project settings. Returned on `GET` and `PUT /projects/{projectId}`,
      absent from the projects list.

      - `homepage?: Record<string, unknown>`

        Published homepage layout.

# Memory

## Retrieve

`client.projects.memory.retrieve(stringprojectID, RequestOptionsoptions?): MemoryRetrieveResponse`

**get** `/projects/{projectId}/memory`

Get the caller's assistant memory scoped to this project (auto-learned). Returns 404 if empty.

### Parameters

- `projectID: string`

### Returns

- `MemoryRetrieveResponse`

  - `memory: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI

### 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 memory = await client.projects.memory.retrieve('projectId');

console.log(memory.memory);
```

#### Response

```json
{
  "memory": {
    "id": "id",
    "content": "content",
    "createdAt": "createdAt",
    "sizeBytes": 0,
    "updatedAt": "updatedAt",
    "updatedBy": "updatedBy"
  }
}
```

## Update

`client.projects.memory.update(stringprojectID, MemoryUpdateParamsbody, RequestOptionsoptions?): MemoryUpdateResponse`

**put** `/projects/{projectId}/memory`

Set the caller's assistant memory scoped to this project (markdown, max 30KB). Set content to null to clear.

### Parameters

- `projectID: string`

- `body: MemoryUpdateParams`

  - `content?: string`

    Markdown content of the memory. Set to null to clear.
    Max size depends on the scope (20-50 KB).

### Returns

- `MemoryUpdateResponse`

  - `memory?: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI

### 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 memory = await client.projects.memory.update('projectId');

console.log(memory.memory);
```

#### Response

```json
{
  "memory": {
    "id": "id",
    "content": "content",
    "createdAt": "createdAt",
    "sizeBytes": 0,
    "updatedAt": "updatedAt",
    "updatedBy": "updatedBy"
  }
}
```

## Domain Types

### Memory Retrieve Response

- `MemoryRetrieveResponse`

  - `memory: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI

### Memory Update Response

- `MemoryUpdateResponse`

  - `memory?: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI

# Watermark

## Delete

`client.projects.watermark.delete(stringprojectID, RequestOptionsoptions?): WatermarkDeleteResponse`

**delete** `/projects/{projectId}/watermark`

Delete the project's forced watermark configuration

### Parameters

- `projectID: string`

### Returns

- `WatermarkDeleteResponse`

  - `deleted: boolean`

### 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 watermark = await client.projects.watermark.delete('projectId');

console.log(watermark.deleted);
```

#### Response

```json
{
  "deleted": true
}
```

## Delete Logo

`client.projects.watermark.deleteLogo(stringprojectID, RequestOptionsoptions?): WatermarkDeleteLogoResponse`

**delete** `/projects/{projectId}/watermark/logo`

Remove the project's watermark logo, falling back to its configured text

### Parameters

- `projectID: string`

### Returns

- `WatermarkDeleteLogoResponse`

  - `watermark: Watermark`

    Forced-watermark configuration stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the configuration

    - `enabled: boolean`

      Whether the watermark is enforced on assets generated in this scope. A
      disabled project configuration falls back to its team's.

    - `level: "project" | "team"`

      Scope this configuration applies to: team or project

      - `"project"`

      - `"team"`

    - `opacity: number`

      Mark opacity, 0.05 (barely visible) to 1 (opaque)

    - `placement: "bottom-left" | "bottom-right" | "center" | 3 more`

      Where the mark sits on the image

      - `"bottom-left"`

      - `"bottom-right"`

      - `"center"`

      - `"tiled"`

      - `"top-left"`

      - `"top-right"`

    - `rotation: number`

      Mark rotation in degrees, -90 to 90. 0 is horizontal.

    - `scale: number`

      Mark width as a fraction of the image width

    - `scopeId: string`

      The id of the team or project that owns this configuration

    - `spacing: number`

      Gap between repetitions, as a fraction of the mark's own size. Tiled
      placement only; 0 repeats the mark edge to edge.

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `version: number`

      Bumped on every write.

    - `deletedAt?: string`

      Set when the configuration has been deleted.

    - `logoIsOpaque?: boolean`

      Whether the stored logo has no transparency at all.

      Recorded at upload so the UI can warn without decoding the image again: an
      opaque logo draws its whole rectangle, which a rotated tiled mark turns
      into a very visible diamond.

    - `logoKey?: string`

      Where the uploaded logo lives, when one is set.

    - `text?: string`

      Text rendered as the mark, when no logo is set

### 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 response = await client.projects.watermark.deleteLogo('projectId');

console.log(response.watermark);
```

#### Response

```json
{
  "watermark": {
    "id": "id",
    "createdAt": "createdAt",
    "createdBy": "createdBy",
    "enabled": true,
    "level": "project",
    "opacity": 0,
    "placement": "bottom-left",
    "rotation": 0,
    "scale": 0,
    "scopeId": "scopeId",
    "spacing": 0,
    "updatedAt": "updatedAt",
    "version": 0,
    "deletedAt": "deletedAt",
    "logoIsOpaque": true,
    "logoKey": "logoKey",
    "text": "text"
  }
}
```

## Preview

`client.projects.watermark.preview(stringprojectID, WatermarkPreviewParamsbody, RequestOptionsoptions?): WatermarkPreviewResponse`

**post** `/projects/{projectId}/watermark/preview`

Draw the given watermark settings on a sample image, without saving them

### Parameters

- `projectID: string`

- `body: WatermarkPreviewParams`

  - `opacity?: number`

    Mark opacity, 0.05 (barely visible) to 1 (opaque)

  - `placement?: "bottom-left" | "bottom-right" | "center" | 3 more`

    Where the mark sits on the image

    - `"bottom-left"`

    - `"bottom-right"`

    - `"center"`

    - `"tiled"`

    - `"top-left"`

    - `"top-right"`

  - `rotation?: number`

    Mark rotation in degrees. 0 is horizontal, negative tilts it up.

  - `scale?: number`

    Mark width as a fraction of the image width

  - `spacing?: number`

    Gap between repetitions, as a fraction of the mark's own size. Only drawn
    for the tiled placement; 0 repeats the mark edge to edge.

  - `text?: string`

    Text to draw. Optional only because a logo can stand in for it.

### Returns

- `WatermarkPreviewResponse`

  Response of the watermark preview routes.

  - `image: string`

    The sample image with the mark drawn on it, base64-encoded.

### 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 response = await client.projects.watermark.preview('projectId');

console.log(response.image);
```

#### Response

```json
{
  "image": "image"
}
```

## Retrieve

`client.projects.watermark.retrieve(stringprojectID, RequestOptionsoptions?): WatermarkRetrieveResponse`

**get** `/projects/{projectId}/watermark`

Get the project's forced watermark configuration

### Parameters

- `projectID: string`

### Returns

- `WatermarkRetrieveResponse`

  - `watermark: Watermark`

    Forced-watermark configuration stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the configuration

    - `enabled: boolean`

      Whether the watermark is enforced on assets generated in this scope. A
      disabled project configuration falls back to its team's.

    - `level: "project" | "team"`

      Scope this configuration applies to: team or project

      - `"project"`

      - `"team"`

    - `opacity: number`

      Mark opacity, 0.05 (barely visible) to 1 (opaque)

    - `placement: "bottom-left" | "bottom-right" | "center" | 3 more`

      Where the mark sits on the image

      - `"bottom-left"`

      - `"bottom-right"`

      - `"center"`

      - `"tiled"`

      - `"top-left"`

      - `"top-right"`

    - `rotation: number`

      Mark rotation in degrees, -90 to 90. 0 is horizontal.

    - `scale: number`

      Mark width as a fraction of the image width

    - `scopeId: string`

      The id of the team or project that owns this configuration

    - `spacing: number`

      Gap between repetitions, as a fraction of the mark's own size. Tiled
      placement only; 0 repeats the mark edge to edge.

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `version: number`

      Bumped on every write.

    - `deletedAt?: string`

      Set when the configuration has been deleted.

    - `logoIsOpaque?: boolean`

      Whether the stored logo has no transparency at all.

      Recorded at upload so the UI can warn without decoding the image again: an
      opaque logo draws its whole rectangle, which a rotated tiled mark turns
      into a very visible diamond.

    - `logoKey?: string`

      Where the uploaded logo lives, when one is set.

    - `text?: string`

      Text rendered as the mark, when no logo is set

### 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 watermark = await client.projects.watermark.retrieve('projectId');

console.log(watermark.watermark);
```

#### Response

```json
{
  "watermark": {
    "id": "id",
    "createdAt": "createdAt",
    "createdBy": "createdBy",
    "enabled": true,
    "level": "project",
    "opacity": 0,
    "placement": "bottom-left",
    "rotation": 0,
    "scale": 0,
    "scopeId": "scopeId",
    "spacing": 0,
    "updatedAt": "updatedAt",
    "version": 0,
    "deletedAt": "deletedAt",
    "logoIsOpaque": true,
    "logoKey": "logoKey",
    "text": "text"
  }
}
```

## Update

`client.projects.watermark.update(stringprojectID, WatermarkUpdateParamsbody, RequestOptionsoptions?): WatermarkUpdateResponse`

**put** `/projects/{projectId}/watermark`

Create or update the project's forced watermark configuration

### Parameters

- `projectID: string`

- `body: WatermarkUpdateParams`

  - `enabled: boolean`

    Whether the watermark is enforced on assets generated in this scope. A
    disabled project configuration falls back to its team's.

  - `opacity?: number`

    Mark opacity, 0.05 (barely visible) to 1 (opaque)

  - `placement?: "bottom-left" | "bottom-right" | "center" | 3 more`

    Where the mark sits on the image

    - `"bottom-left"`

    - `"bottom-right"`

    - `"center"`

    - `"tiled"`

    - `"top-left"`

    - `"top-right"`

  - `rotation?: number`

    Mark rotation in degrees. 0 is horizontal, negative tilts it up.

  - `scale?: number`

    Mark width as a fraction of the image width

  - `spacing?: number`

    Gap between repetitions, as a fraction of the mark's own size. Only drawn
    for the tiled placement; 0 repeats the mark edge to edge.

  - `text?: string`

    Text rendered as the mark. Ignored while a logo is set.

### Returns

- `WatermarkUpdateResponse`

  - `watermark: Watermark`

    Forced-watermark configuration stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the configuration

    - `enabled: boolean`

      Whether the watermark is enforced on assets generated in this scope. A
      disabled project configuration falls back to its team's.

    - `level: "project" | "team"`

      Scope this configuration applies to: team or project

      - `"project"`

      - `"team"`

    - `opacity: number`

      Mark opacity, 0.05 (barely visible) to 1 (opaque)

    - `placement: "bottom-left" | "bottom-right" | "center" | 3 more`

      Where the mark sits on the image

      - `"bottom-left"`

      - `"bottom-right"`

      - `"center"`

      - `"tiled"`

      - `"top-left"`

      - `"top-right"`

    - `rotation: number`

      Mark rotation in degrees, -90 to 90. 0 is horizontal.

    - `scale: number`

      Mark width as a fraction of the image width

    - `scopeId: string`

      The id of the team or project that owns this configuration

    - `spacing: number`

      Gap between repetitions, as a fraction of the mark's own size. Tiled
      placement only; 0 repeats the mark edge to edge.

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `version: number`

      Bumped on every write.

    - `deletedAt?: string`

      Set when the configuration has been deleted.

    - `logoIsOpaque?: boolean`

      Whether the stored logo has no transparency at all.

      Recorded at upload so the UI can warn without decoding the image again: an
      opaque logo draws its whole rectangle, which a rotated tiled mark turns
      into a very visible diamond.

    - `logoKey?: string`

      Where the uploaded logo lives, when one is set.

    - `text?: string`

      Text rendered as the mark, when no logo is set

### 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 watermark = await client.projects.watermark.update('projectId', { enabled: true });

console.log(watermark.watermark);
```

#### Response

```json
{
  "watermark": {
    "id": "id",
    "createdAt": "createdAt",
    "createdBy": "createdBy",
    "enabled": true,
    "level": "project",
    "opacity": 0,
    "placement": "bottom-left",
    "rotation": 0,
    "scale": 0,
    "scopeId": "scopeId",
    "spacing": 0,
    "updatedAt": "updatedAt",
    "version": 0,
    "deletedAt": "deletedAt",
    "logoIsOpaque": true,
    "logoKey": "logoKey",
    "text": "text"
  }
}
```

## Update Logo

`client.projects.watermark.updateLogo(stringprojectID, WatermarkUpdateLogoParamsbody, RequestOptionsoptions?): WatermarkUpdateLogoResponse`

**put** `/projects/{projectId}/watermark/logo`

Upload the project's watermark logo, used as the mark instead of its text

### Parameters

- `projectID: string`

- `body: WatermarkUpdateLogoParams`

  - `logo: string`

    The logo image, base64-encoded, at most 1 MB and 4 megapixels once decoded.
    PNG, JPEG and WebP are accepted; SVG is refused. Stored as PNG.

### Returns

- `WatermarkUpdateLogoResponse`

  - `watermark: Watermark`

    Forced-watermark configuration stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the configuration

    - `enabled: boolean`

      Whether the watermark is enforced on assets generated in this scope. A
      disabled project configuration falls back to its team's.

    - `level: "project" | "team"`

      Scope this configuration applies to: team or project

      - `"project"`

      - `"team"`

    - `opacity: number`

      Mark opacity, 0.05 (barely visible) to 1 (opaque)

    - `placement: "bottom-left" | "bottom-right" | "center" | 3 more`

      Where the mark sits on the image

      - `"bottom-left"`

      - `"bottom-right"`

      - `"center"`

      - `"tiled"`

      - `"top-left"`

      - `"top-right"`

    - `rotation: number`

      Mark rotation in degrees, -90 to 90. 0 is horizontal.

    - `scale: number`

      Mark width as a fraction of the image width

    - `scopeId: string`

      The id of the team or project that owns this configuration

    - `spacing: number`

      Gap between repetitions, as a fraction of the mark's own size. Tiled
      placement only; 0 repeats the mark edge to edge.

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `version: number`

      Bumped on every write.

    - `deletedAt?: string`

      Set when the configuration has been deleted.

    - `logoIsOpaque?: boolean`

      Whether the stored logo has no transparency at all.

      Recorded at upload so the UI can warn without decoding the image again: an
      opaque logo draws its whole rectangle, which a rotated tiled mark turns
      into a very visible diamond.

    - `logoKey?: string`

      Where the uploaded logo lives, when one is set.

    - `text?: string`

      Text rendered as the mark, when no logo is set

### 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 response = await client.projects.watermark.updateLogo('projectId', { logo: 'logo' });

console.log(response.watermark);
```

#### Response

```json
{
  "watermark": {
    "id": "id",
    "createdAt": "createdAt",
    "createdBy": "createdBy",
    "enabled": true,
    "level": "project",
    "opacity": 0,
    "placement": "bottom-left",
    "rotation": 0,
    "scale": 0,
    "scopeId": "scopeId",
    "spacing": 0,
    "updatedAt": "updatedAt",
    "version": 0,
    "deletedAt": "deletedAt",
    "logoIsOpaque": true,
    "logoKey": "logoKey",
    "text": "text"
  }
}
```

## Domain Types

### Watermark Delete Response

- `WatermarkDeleteResponse`

  - `deleted: boolean`

### Watermark Delete Logo Response

- `WatermarkDeleteLogoResponse`

  - `watermark: Watermark`

    Forced-watermark configuration stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the configuration

    - `enabled: boolean`

      Whether the watermark is enforced on assets generated in this scope. A
      disabled project configuration falls back to its team's.

    - `level: "project" | "team"`

      Scope this configuration applies to: team or project

      - `"project"`

      - `"team"`

    - `opacity: number`

      Mark opacity, 0.05 (barely visible) to 1 (opaque)

    - `placement: "bottom-left" | "bottom-right" | "center" | 3 more`

      Where the mark sits on the image

      - `"bottom-left"`

      - `"bottom-right"`

      - `"center"`

      - `"tiled"`

      - `"top-left"`

      - `"top-right"`

    - `rotation: number`

      Mark rotation in degrees, -90 to 90. 0 is horizontal.

    - `scale: number`

      Mark width as a fraction of the image width

    - `scopeId: string`

      The id of the team or project that owns this configuration

    - `spacing: number`

      Gap between repetitions, as a fraction of the mark's own size. Tiled
      placement only; 0 repeats the mark edge to edge.

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `version: number`

      Bumped on every write.

    - `deletedAt?: string`

      Set when the configuration has been deleted.

    - `logoIsOpaque?: boolean`

      Whether the stored logo has no transparency at all.

      Recorded at upload so the UI can warn without decoding the image again: an
      opaque logo draws its whole rectangle, which a rotated tiled mark turns
      into a very visible diamond.

    - `logoKey?: string`

      Where the uploaded logo lives, when one is set.

    - `text?: string`

      Text rendered as the mark, when no logo is set

### Watermark Preview Response

- `WatermarkPreviewResponse`

  Response of the watermark preview routes.

  - `image: string`

    The sample image with the mark drawn on it, base64-encoded.

### Watermark Retrieve Response

- `WatermarkRetrieveResponse`

  - `watermark: Watermark`

    Forced-watermark configuration stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the configuration

    - `enabled: boolean`

      Whether the watermark is enforced on assets generated in this scope. A
      disabled project configuration falls back to its team's.

    - `level: "project" | "team"`

      Scope this configuration applies to: team or project

      - `"project"`

      - `"team"`

    - `opacity: number`

      Mark opacity, 0.05 (barely visible) to 1 (opaque)

    - `placement: "bottom-left" | "bottom-right" | "center" | 3 more`

      Where the mark sits on the image

      - `"bottom-left"`

      - `"bottom-right"`

      - `"center"`

      - `"tiled"`

      - `"top-left"`

      - `"top-right"`

    - `rotation: number`

      Mark rotation in degrees, -90 to 90. 0 is horizontal.

    - `scale: number`

      Mark width as a fraction of the image width

    - `scopeId: string`

      The id of the team or project that owns this configuration

    - `spacing: number`

      Gap between repetitions, as a fraction of the mark's own size. Tiled
      placement only; 0 repeats the mark edge to edge.

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `version: number`

      Bumped on every write.

    - `deletedAt?: string`

      Set when the configuration has been deleted.

    - `logoIsOpaque?: boolean`

      Whether the stored logo has no transparency at all.

      Recorded at upload so the UI can warn without decoding the image again: an
      opaque logo draws its whole rectangle, which a rotated tiled mark turns
      into a very visible diamond.

    - `logoKey?: string`

      Where the uploaded logo lives, when one is set.

    - `text?: string`

      Text rendered as the mark, when no logo is set

### Watermark Update Response

- `WatermarkUpdateResponse`

  - `watermark: Watermark`

    Forced-watermark configuration stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the configuration

    - `enabled: boolean`

      Whether the watermark is enforced on assets generated in this scope. A
      disabled project configuration falls back to its team's.

    - `level: "project" | "team"`

      Scope this configuration applies to: team or project

      - `"project"`

      - `"team"`

    - `opacity: number`

      Mark opacity, 0.05 (barely visible) to 1 (opaque)

    - `placement: "bottom-left" | "bottom-right" | "center" | 3 more`

      Where the mark sits on the image

      - `"bottom-left"`

      - `"bottom-right"`

      - `"center"`

      - `"tiled"`

      - `"top-left"`

      - `"top-right"`

    - `rotation: number`

      Mark rotation in degrees, -90 to 90. 0 is horizontal.

    - `scale: number`

      Mark width as a fraction of the image width

    - `scopeId: string`

      The id of the team or project that owns this configuration

    - `spacing: number`

      Gap between repetitions, as a fraction of the mark's own size. Tiled
      placement only; 0 repeats the mark edge to edge.

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `version: number`

      Bumped on every write.

    - `deletedAt?: string`

      Set when the configuration has been deleted.

    - `logoIsOpaque?: boolean`

      Whether the stored logo has no transparency at all.

      Recorded at upload so the UI can warn without decoding the image again: an
      opaque logo draws its whole rectangle, which a rotated tiled mark turns
      into a very visible diamond.

    - `logoKey?: string`

      Where the uploaded logo lives, when one is set.

    - `text?: string`

      Text rendered as the mark, when no logo is set

### Watermark Update Logo Response

- `WatermarkUpdateLogoResponse`

  - `watermark: Watermark`

    Forced-watermark configuration stored at one scope.

    - `id: string`

      Stable identifier derived from level + scopeId

    - `createdAt: string`

      ISO-8601 creation timestamp

    - `createdBy: string`

      User id that last wrote the configuration

    - `enabled: boolean`

      Whether the watermark is enforced on assets generated in this scope. A
      disabled project configuration falls back to its team's.

    - `level: "project" | "team"`

      Scope this configuration applies to: team or project

      - `"project"`

      - `"team"`

    - `opacity: number`

      Mark opacity, 0.05 (barely visible) to 1 (opaque)

    - `placement: "bottom-left" | "bottom-right" | "center" | 3 more`

      Where the mark sits on the image

      - `"bottom-left"`

      - `"bottom-right"`

      - `"center"`

      - `"tiled"`

      - `"top-left"`

      - `"top-right"`

    - `rotation: number`

      Mark rotation in degrees, -90 to 90. 0 is horizontal.

    - `scale: number`

      Mark width as a fraction of the image width

    - `scopeId: string`

      The id of the team or project that owns this configuration

    - `spacing: number`

      Gap between repetitions, as a fraction of the mark's own size. Tiled
      placement only; 0 repeats the mark edge to edge.

    - `updatedAt: string`

      ISO-8601 last-update timestamp

    - `version: number`

      Bumped on every write.

    - `deletedAt?: string`

      Set when the configuration has been deleted.

    - `logoIsOpaque?: boolean`

      Whether the stored logo has no transparency at all.

      Recorded at upload so the UI can warn without decoding the image again: an
      opaque logo draws its whole rectangle, which a rotated tiled mark turns
      into a very visible diamond.

    - `logoKey?: string`

      Where the uploaded logo lives, when one is set.

    - `text?: string`

      Text rendered as the mark, when no logo is set

# Webhook Endpoints

## Create

`client.projects.webhookEndpoints.create(stringprojectID, WebhookEndpointCreateParamsbody, RequestOptionsoptions?): WebhookEndpointCreateResponse`

**post** `/projects/{projectId}/webhook-endpoints`

Register a new webhook endpoint for the project

### Parameters

- `projectID: string`

- `body: WebhookEndpointCreateParams`

  - `enabledEvents: Array<"*" | "asset.download.completed" | "asset.download.created" | 16 more>`

    The events that trigger the webhook. ['*'] indicates that all events are enabled

    - `"*"`

    - `"asset.download.completed"`

    - `"asset.download.created"`

    - `"asset.download.failed"`

    - `"generation.completed"`

    - `"generation.created"`

    - `"generation.failed"`

    - `"inference.cancelled"`

    - `"inference.completed"`

    - `"inference.created"`

    - `"inference.failed"`

    - `"model.download.completed"`

    - `"model.download.created"`

    - `"model.download.failed"`

    - `"model.training.cancelled"`

    - `"model.training.completed"`

    - `"model.training.failed"`

    - `"model.training.started"`

    - `"team.credit.threshold.crossed"`

  - `url: string`

    The URL of the webhook endpoint. Must be an absolute http(s) URL

  - `description?: string`

    A description of the webhook endpoint

### Returns

- `WebhookEndpointCreateResponse`

  - `webhookEndpoint: WebhookEndpoint`

    The creation response, and the only one that carries the secret: it is
    generated once and never returned again, so a client that loses it has to
    recreate the endpoint.

    - `id: string`

      The ID of the webhook endpoint

    - `createdAt: string`

      The date and time the webhook endpoint was created

    - `enabled: boolean`

      Whether the webhook is enabled

    - `enabledEvents: Array<"*" | "asset.download.completed" | "asset.download.created" | 16 more>`

      The events that trigger the webhook. ['*'] indicates that all events are enabled

      - `"*"`

      - `"asset.download.completed"`

      - `"asset.download.created"`

      - `"asset.download.failed"`

      - `"generation.completed"`

      - `"generation.created"`

      - `"generation.failed"`

      - `"inference.cancelled"`

      - `"inference.completed"`

      - `"inference.created"`

      - `"inference.failed"`

      - `"model.download.completed"`

      - `"model.download.created"`

      - `"model.download.failed"`

      - `"model.training.cancelled"`

      - `"model.training.completed"`

      - `"model.training.failed"`

      - `"model.training.started"`

      - `"team.credit.threshold.crossed"`

    - `nbFailedCalls: number`

      The number of calls to the webhook endpoint that have failed

    - `nbTotalCalls: number`

      The number of calls to the webhook endpoint

    - `ownerId: string`

      The ID of the owner of the webhook endpoint: a project id for job
      lifecycle events, a team id for alert events

    - `ownerType: "project" | "team"`

      Whether the owner is a project or a team. Required to tell them apart: a
      project created before the team/project split shares its team's id

      - `"project"`

      - `"team"`

    - `secret: string`

      The endpoint's secret, used to generate webhook signatures

    - `updatedAt: string`

      The date and time the webhook endpoint was updated

    - `url: string`

      The URL of the webhook endpoint

    - `description?: string`

      A description of the webhook endpoint

### 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 webhookEndpoint = await client.projects.webhookEndpoints.create('projectId', {
  enabledEvents: ['*'],
  url: 'url',
});

console.log(webhookEndpoint.webhookEndpoint);
```

#### Response

```json
{
  "webhookEndpoint": {
    "id": "id",
    "createdAt": "createdAt",
    "enabled": true,
    "enabledEvents": [
      "*"
    ],
    "nbFailedCalls": 0,
    "nbTotalCalls": 0,
    "ownerId": "ownerId",
    "ownerType": "project",
    "secret": "secret",
    "updatedAt": "updatedAt",
    "url": "url",
    "description": "description"
  }
}
```

## Delete

`client.projects.webhookEndpoints.delete(stringwebhookEndpointID, WebhookEndpointDeleteParamsparams, RequestOptionsoptions?): WebhookEndpointDeleteResponse`

**delete** `/projects/{projectId}/webhook-endpoints/{webhookEndpointId}`

Delete a particular webhook endpoint by its Id

### Parameters

- `webhookEndpointID: string`

- `params: WebhookEndpointDeleteParams`

  - `projectId: string`

    The project Id

### Returns

- `WebhookEndpointDeleteResponse = 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 webhookEndpoint = await client.projects.webhookEndpoints.delete('webhookEndpointId', {
  projectId: 'projectId',
});

console.log(webhookEndpoint);
```

#### Response

```json
{}
```

## List

`client.projects.webhookEndpoints.list(stringprojectID, RequestOptionsoptions?): WebhookEndpointListResponse`

**get** `/projects/{projectId}/webhook-endpoints`

List the project's webhook endpoints

### Parameters

- `projectID: string`

### Returns

- `WebhookEndpointListResponse`

  - `webhookEndpoints: Array<WebhookEndpoint>`

    A list of the project webhooks

    - `id: string`

      The ID of the webhook endpoint

    - `createdAt: string`

      The date and time the webhook endpoint was created

    - `enabled: boolean`

      Whether the webhook is enabled

    - `enabledEvents: Array<"*" | "asset.download.completed" | "asset.download.created" | 16 more>`

      The events that trigger the webhook. ['*'] indicates that all events are enabled

      - `"*"`

      - `"asset.download.completed"`

      - `"asset.download.created"`

      - `"asset.download.failed"`

      - `"generation.completed"`

      - `"generation.created"`

      - `"generation.failed"`

      - `"inference.cancelled"`

      - `"inference.completed"`

      - `"inference.created"`

      - `"inference.failed"`

      - `"model.download.completed"`

      - `"model.download.created"`

      - `"model.download.failed"`

      - `"model.training.cancelled"`

      - `"model.training.completed"`

      - `"model.training.failed"`

      - `"model.training.started"`

      - `"team.credit.threshold.crossed"`

    - `nbFailedCalls: number`

      The number of calls to the webhook endpoint that have failed

    - `nbTotalCalls: number`

      The number of calls to the webhook endpoint

    - `ownerId: string`

      The ID of the owner of the webhook endpoint: a project id for job
      lifecycle events, a team id for alert events

    - `ownerType: "project" | "team"`

      Whether the owner is a project or a team. Required to tell them apart: a
      project created before the team/project split shares its team's id

      - `"project"`

      - `"team"`

    - `updatedAt: string`

      The date and time the webhook endpoint was updated

    - `url: string`

      The URL of the webhook endpoint

    - `description?: string`

      A description of the webhook endpoint

### 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 webhookEndpoints = await client.projects.webhookEndpoints.list('projectId');

console.log(webhookEndpoints.webhookEndpoints);
```

#### Response

```json
{
  "webhookEndpoints": [
    {
      "id": "id",
      "createdAt": "createdAt",
      "enabled": true,
      "enabledEvents": [
        "*"
      ],
      "nbFailedCalls": 0,
      "nbTotalCalls": 0,
      "ownerId": "ownerId",
      "ownerType": "project",
      "updatedAt": "updatedAt",
      "url": "url",
      "description": "description"
    }
  ]
}
```

## Update

`client.projects.webhookEndpoints.update(stringwebhookEndpointID, WebhookEndpointUpdateParamsparams, RequestOptionsoptions?): WebhookEndpointUpdateResponse`

**put** `/projects/{projectId}/webhook-endpoints/{webhookEndpointId}`

Update a particular webhook endpoint for a project

### Parameters

- `webhookEndpointID: string`

- `params: WebhookEndpointUpdateParams`

  - `projectId: string`

    Path param: The project Id

  - `description?: string`

    Body param: A description of the webhook endpoint

  - `enabled?: boolean`

    Body param: Whether the webhook is enabled

  - `enabledEvents?: Array<"*" | "asset.download.completed" | "asset.download.created" | 16 more>`

    Body param: The events that trigger the webhook. ['*'] indicates that all events are enabled

    - `"*"`

    - `"asset.download.completed"`

    - `"asset.download.created"`

    - `"asset.download.failed"`

    - `"generation.completed"`

    - `"generation.created"`

    - `"generation.failed"`

    - `"inference.cancelled"`

    - `"inference.completed"`

    - `"inference.created"`

    - `"inference.failed"`

    - `"model.download.completed"`

    - `"model.download.created"`

    - `"model.download.failed"`

    - `"model.training.cancelled"`

    - `"model.training.completed"`

    - `"model.training.failed"`

    - `"model.training.started"`

    - `"team.credit.threshold.crossed"`

  - `url?: string`

    Body param: The URL of the webhook endpoint. Must be an absolute http(s) URL

### Returns

- `WebhookEndpointUpdateResponse`

  - `webhookEndpoint: WebhookEndpoint`

    - `id: string`

      The ID of the webhook endpoint

    - `createdAt: string`

      The date and time the webhook endpoint was created

    - `enabled: boolean`

      Whether the webhook is enabled

    - `enabledEvents: Array<"*" | "asset.download.completed" | "asset.download.created" | 16 more>`

      The events that trigger the webhook. ['*'] indicates that all events are enabled

      - `"*"`

      - `"asset.download.completed"`

      - `"asset.download.created"`

      - `"asset.download.failed"`

      - `"generation.completed"`

      - `"generation.created"`

      - `"generation.failed"`

      - `"inference.cancelled"`

      - `"inference.completed"`

      - `"inference.created"`

      - `"inference.failed"`

      - `"model.download.completed"`

      - `"model.download.created"`

      - `"model.download.failed"`

      - `"model.training.cancelled"`

      - `"model.training.completed"`

      - `"model.training.failed"`

      - `"model.training.started"`

      - `"team.credit.threshold.crossed"`

    - `nbFailedCalls: number`

      The number of calls to the webhook endpoint that have failed

    - `nbTotalCalls: number`

      The number of calls to the webhook endpoint

    - `ownerId: string`

      The ID of the owner of the webhook endpoint: a project id for job
      lifecycle events, a team id for alert events

    - `ownerType: "project" | "team"`

      Whether the owner is a project or a team. Required to tell them apart: a
      project created before the team/project split shares its team's id

      - `"project"`

      - `"team"`

    - `updatedAt: string`

      The date and time the webhook endpoint was updated

    - `url: string`

      The URL of the webhook endpoint

    - `description?: string`

      A description of the webhook endpoint

### 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 webhookEndpoint = await client.projects.webhookEndpoints.update('webhookEndpointId', {
  projectId: 'projectId',
});

console.log(webhookEndpoint.webhookEndpoint);
```

#### Response

```json
{
  "webhookEndpoint": {
    "id": "id",
    "createdAt": "createdAt",
    "enabled": true,
    "enabledEvents": [
      "*"
    ],
    "nbFailedCalls": 0,
    "nbTotalCalls": 0,
    "ownerId": "ownerId",
    "ownerType": "project",
    "updatedAt": "updatedAt",
    "url": "url",
    "description": "description"
  }
}
```

## Domain Types

### Webhook Endpoint Create Response

- `WebhookEndpointCreateResponse`

  - `webhookEndpoint: WebhookEndpoint`

    The creation response, and the only one that carries the secret: it is
    generated once and never returned again, so a client that loses it has to
    recreate the endpoint.

    - `id: string`

      The ID of the webhook endpoint

    - `createdAt: string`

      The date and time the webhook endpoint was created

    - `enabled: boolean`

      Whether the webhook is enabled

    - `enabledEvents: Array<"*" | "asset.download.completed" | "asset.download.created" | 16 more>`

      The events that trigger the webhook. ['*'] indicates that all events are enabled

      - `"*"`

      - `"asset.download.completed"`

      - `"asset.download.created"`

      - `"asset.download.failed"`

      - `"generation.completed"`

      - `"generation.created"`

      - `"generation.failed"`

      - `"inference.cancelled"`

      - `"inference.completed"`

      - `"inference.created"`

      - `"inference.failed"`

      - `"model.download.completed"`

      - `"model.download.created"`

      - `"model.download.failed"`

      - `"model.training.cancelled"`

      - `"model.training.completed"`

      - `"model.training.failed"`

      - `"model.training.started"`

      - `"team.credit.threshold.crossed"`

    - `nbFailedCalls: number`

      The number of calls to the webhook endpoint that have failed

    - `nbTotalCalls: number`

      The number of calls to the webhook endpoint

    - `ownerId: string`

      The ID of the owner of the webhook endpoint: a project id for job
      lifecycle events, a team id for alert events

    - `ownerType: "project" | "team"`

      Whether the owner is a project or a team. Required to tell them apart: a
      project created before the team/project split shares its team's id

      - `"project"`

      - `"team"`

    - `secret: string`

      The endpoint's secret, used to generate webhook signatures

    - `updatedAt: string`

      The date and time the webhook endpoint was updated

    - `url: string`

      The URL of the webhook endpoint

    - `description?: string`

      A description of the webhook endpoint

### Webhook Endpoint Delete Response

- `WebhookEndpointDeleteResponse = unknown`

### Webhook Endpoint List Response

- `WebhookEndpointListResponse`

  - `webhookEndpoints: Array<WebhookEndpoint>`

    A list of the project webhooks

    - `id: string`

      The ID of the webhook endpoint

    - `createdAt: string`

      The date and time the webhook endpoint was created

    - `enabled: boolean`

      Whether the webhook is enabled

    - `enabledEvents: Array<"*" | "asset.download.completed" | "asset.download.created" | 16 more>`

      The events that trigger the webhook. ['*'] indicates that all events are enabled

      - `"*"`

      - `"asset.download.completed"`

      - `"asset.download.created"`

      - `"asset.download.failed"`

      - `"generation.completed"`

      - `"generation.created"`

      - `"generation.failed"`

      - `"inference.cancelled"`

      - `"inference.completed"`

      - `"inference.created"`

      - `"inference.failed"`

      - `"model.download.completed"`

      - `"model.download.created"`

      - `"model.download.failed"`

      - `"model.training.cancelled"`

      - `"model.training.completed"`

      - `"model.training.failed"`

      - `"model.training.started"`

      - `"team.credit.threshold.crossed"`

    - `nbFailedCalls: number`

      The number of calls to the webhook endpoint that have failed

    - `nbTotalCalls: number`

      The number of calls to the webhook endpoint

    - `ownerId: string`

      The ID of the owner of the webhook endpoint: a project id for job
      lifecycle events, a team id for alert events

    - `ownerType: "project" | "team"`

      Whether the owner is a project or a team. Required to tell them apart: a
      project created before the team/project split shares its team's id

      - `"project"`

      - `"team"`

    - `updatedAt: string`

      The date and time the webhook endpoint was updated

    - `url: string`

      The URL of the webhook endpoint

    - `description?: string`

      A description of the webhook endpoint

### Webhook Endpoint Update Response

- `WebhookEndpointUpdateResponse`

  - `webhookEndpoint: WebhookEndpoint`

    - `id: string`

      The ID of the webhook endpoint

    - `createdAt: string`

      The date and time the webhook endpoint was created

    - `enabled: boolean`

      Whether the webhook is enabled

    - `enabledEvents: Array<"*" | "asset.download.completed" | "asset.download.created" | 16 more>`

      The events that trigger the webhook. ['*'] indicates that all events are enabled

      - `"*"`

      - `"asset.download.completed"`

      - `"asset.download.created"`

      - `"asset.download.failed"`

      - `"generation.completed"`

      - `"generation.created"`

      - `"generation.failed"`

      - `"inference.cancelled"`

      - `"inference.completed"`

      - `"inference.created"`

      - `"inference.failed"`

      - `"model.download.completed"`

      - `"model.download.created"`

      - `"model.download.failed"`

      - `"model.training.cancelled"`

      - `"model.training.completed"`

      - `"model.training.failed"`

      - `"model.training.started"`

      - `"team.credit.threshold.crossed"`

    - `nbFailedCalls: number`

      The number of calls to the webhook endpoint that have failed

    - `nbTotalCalls: number`

      The number of calls to the webhook endpoint

    - `ownerId: string`

      The ID of the owner of the webhook endpoint: a project id for job
      lifecycle events, a team id for alert events

    - `ownerType: "project" | "team"`

      Whether the owner is a project or a team. Required to tell them apart: a
      project created before the team/project split shares its team's id

      - `"project"`

      - `"team"`

    - `updatedAt: string`

      The date and time the webhook endpoint was updated

    - `url: string`

      The URL of the webhook endpoint

    - `description?: string`

      A description of the webhook endpoint

# Events

## List

`client.projects.webhookEndpoints.events.list(stringwebhookEndpointID, EventListParamsparams, RequestOptionsoptions?): EventListResponse`

**get** `/projects/{projectId}/webhook-endpoints/{webhookEndpointId}/events`

List the project's webhook events

### Parameters

- `webhookEndpointID: string`

- `params: EventListParams`

  - `projectId: string`

    Path param: The project Id

  - `paginationToken?: string`

    Query param: A token you received in a previous request to query the next page of items

### Returns

- `EventListResponse`

  - `items: Array<Item>`

    A list of the project webhook events

    - `id: string`

    - `endpointId: string`

    - `status: "created" | "failed" | "retrying" | "success"`

      - `"created"`

      - `"failed"`

      - `"retrying"`

      - `"success"`

    - `type: "*" | "asset.download.completed" | "asset.download.created" | 16 more`

      Every event a webhook endpoint can subscribe to: a project endpoint takes the
      job lifecycle events, a team endpoint takes the alert events.

      - `"*"`

      - `"asset.download.completed"`

      - `"asset.download.created"`

      - `"asset.download.failed"`

      - `"generation.completed"`

      - `"generation.created"`

      - `"generation.failed"`

      - `"inference.cancelled"`

      - `"inference.completed"`

      - `"inference.created"`

      - `"inference.failed"`

      - `"model.download.completed"`

      - `"model.download.created"`

      - `"model.download.failed"`

      - `"model.training.cancelled"`

      - `"model.training.completed"`

      - `"model.training.failed"`

      - `"model.training.started"`

      - `"team.credit.threshold.crossed"`

    - `updatedAt: string`

  - `nextPaginationToken?: string`

    A token to query the next page of events

### 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 events = await client.projects.webhookEndpoints.events.list('webhookEndpointId', {
  projectId: 'projectId',
});

console.log(events.items);
```

#### Response

```json
{
  "items": [
    {
      "id": "id",
      "endpointId": "endpointId",
      "status": "created",
      "type": "*",
      "updatedAt": "updatedAt"
    }
  ],
  "nextPaginationToken": "nextPaginationToken"
}
```

## Retrieve

`client.projects.webhookEndpoints.events.retrieve(stringeventID, EventRetrieveParamsparams, RequestOptionsoptions?): EventRetrieveResponse`

**get** `/projects/{projectId}/webhook-endpoints/{webhookEndpointId}/events/{eventId}`

Retrieve one delivery event of one of the project's webhook endpoints

### Parameters

- `eventID: string`

- `params: EventRetrieveParams`

  - `projectId: string`

    The project Id

  - `webhookEndpointId: string`

    The webhook endpoint that delivered the event

### Returns

- `EventRetrieveResponse`

  - `webhookEvent: WebhookEvent`

    - `id: string`

    - `attempts: Array<Attempt>`

      - `responseStatusCode: number`

      - `sentAt: string`

    - `createdAt: string`

    - `endpointId: string`

    - `payload: unknown`

    - `sentAt: string`

    - `status: "created" | "failed" | "retrying" | "success"`

      - `"created"`

      - `"failed"`

      - `"retrying"`

      - `"success"`

    - `type: "*" | "asset.download.completed" | "asset.download.created" | 16 more`

      Every event a webhook endpoint can subscribe to: a project endpoint takes the
      job lifecycle events, a team endpoint takes the alert events.

      - `"*"`

      - `"asset.download.completed"`

      - `"asset.download.created"`

      - `"asset.download.failed"`

      - `"generation.completed"`

      - `"generation.created"`

      - `"generation.failed"`

      - `"inference.cancelled"`

      - `"inference.completed"`

      - `"inference.created"`

      - `"inference.failed"`

      - `"model.download.completed"`

      - `"model.download.created"`

      - `"model.download.failed"`

      - `"model.training.cancelled"`

      - `"model.training.completed"`

      - `"model.training.failed"`

      - `"model.training.started"`

      - `"team.credit.threshold.crossed"`

    - `updatedAt: string`

### 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 event = await client.projects.webhookEndpoints.events.retrieve('eventId', {
  projectId: 'projectId',
  webhookEndpointId: 'webhookEndpointId',
});

console.log(event.webhookEvent);
```

#### Response

```json
{
  "webhookEvent": {
    "id": "id",
    "attempts": [
      {
        "responseStatusCode": 0,
        "sentAt": "sentAt"
      }
    ],
    "createdAt": "createdAt",
    "endpointId": "endpointId",
    "payload": {},
    "sentAt": "sentAt",
    "status": "created",
    "type": "*",
    "updatedAt": "updatedAt"
  }
}
```

## Domain Types

### Event List Response

- `EventListResponse`

  - `items: Array<Item>`

    A list of the project webhook events

    - `id: string`

    - `endpointId: string`

    - `status: "created" | "failed" | "retrying" | "success"`

      - `"created"`

      - `"failed"`

      - `"retrying"`

      - `"success"`

    - `type: "*" | "asset.download.completed" | "asset.download.created" | 16 more`

      Every event a webhook endpoint can subscribe to: a project endpoint takes the
      job lifecycle events, a team endpoint takes the alert events.

      - `"*"`

      - `"asset.download.completed"`

      - `"asset.download.created"`

      - `"asset.download.failed"`

      - `"generation.completed"`

      - `"generation.created"`

      - `"generation.failed"`

      - `"inference.cancelled"`

      - `"inference.completed"`

      - `"inference.created"`

      - `"inference.failed"`

      - `"model.download.completed"`

      - `"model.download.created"`

      - `"model.download.failed"`

      - `"model.training.cancelled"`

      - `"model.training.completed"`

      - `"model.training.failed"`

      - `"model.training.started"`

      - `"team.credit.threshold.crossed"`

    - `updatedAt: string`

  - `nextPaginationToken?: string`

    A token to query the next page of events

### Event Retrieve Response

- `EventRetrieveResponse`

  - `webhookEvent: WebhookEvent`

    - `id: string`

    - `attempts: Array<Attempt>`

      - `responseStatusCode: number`

      - `sentAt: string`

    - `createdAt: string`

    - `endpointId: string`

    - `payload: unknown`

    - `sentAt: string`

    - `status: "created" | "failed" | "retrying" | "success"`

      - `"created"`

      - `"failed"`

      - `"retrying"`

      - `"success"`

    - `type: "*" | "asset.download.completed" | "asset.download.created" | 16 more`

      Every event a webhook endpoint can subscribe to: a project endpoint takes the
      job lifecycle events, a team endpoint takes the alert events.

      - `"*"`

      - `"asset.download.completed"`

      - `"asset.download.created"`

      - `"asset.download.failed"`

      - `"generation.completed"`

      - `"generation.created"`

      - `"generation.failed"`

      - `"inference.cancelled"`

      - `"inference.completed"`

      - `"inference.created"`

      - `"inference.failed"`

      - `"model.download.completed"`

      - `"model.download.created"`

      - `"model.download.failed"`

      - `"model.training.cancelled"`

      - `"model.training.completed"`

      - `"model.training.failed"`

      - `"model.training.started"`

      - `"team.credit.threshold.crossed"`

    - `updatedAt: string`
