# Projects

## List Projects

`client.projects.list(ProjectListParamsquery?, RequestOptionsoptions?): PaginatedCursor<Project>`

**get** `/api/v2/projects`

List projects in an organization. Requires `organization_id` or a project-scoped API key.

### Parameters

- `query: ProjectListParams`

  - `name?: string | null`

  - `organization_id?: string | null`

  - `page_size?: number | null`

  - `page_token?: string | null`

### Returns

- `Project`

  API response schema for a project.

  - `id: string`

    The project's unique identifier.

  - `name: string`

    The project's display name.

  - `organization_id: string`

    The organization the project belongs to.

  - `created_at?: string | null`

    Creation datetime

  - `is_default?: boolean`

    Whether this project is the default project for its organization.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

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

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

#### Response

```json
{
  "items": [
    {
      "id": "id",
      "name": "name",
      "organization_id": "organization_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "is_default": true,
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Create Project

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

**post** `/api/v2/projects`

Create a new project in the given organization.

### Parameters

- `params: ProjectCreateParams`

  - `organization_id: string`

    Query param

  - `name: string`

    Body param: The project's display name.

### Returns

- `Project`

  API response schema for a project.

  - `id: string`

    The project's unique identifier.

  - `name: string`

    The project's display name.

  - `organization_id: string`

    The organization the project belongs to.

  - `created_at?: string | null`

    Creation datetime

  - `is_default?: boolean`

    Whether this project is the default project for its organization.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

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

const project = await client.projects.create({
  organization_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  name: 'x',
});

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

#### Response

```json
{
  "id": "id",
  "name": "name",
  "organization_id": "organization_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "is_default": true,
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Get Project

`client.projects.get(stringprojectID, ProjectGetParamsquery?, RequestOptionsoptions?): Project`

**get** `/api/v2/projects/{project_id}`

Get a project by ID.

### Parameters

- `projectID: string`

- `query: ProjectGetParams`

  - `organization_id?: string | null`

### Returns

- `Project`

  API response schema for a project.

  - `id: string`

    The project's unique identifier.

  - `name: string`

    The project's display name.

  - `organization_id: string`

    The organization the project belongs to.

  - `created_at?: string | null`

    Creation datetime

  - `is_default?: boolean`

    Whether this project is the default project for its organization.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

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

const project = await client.projects.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');

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

#### Response

```json
{
  "id": "id",
  "name": "name",
  "organization_id": "organization_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "is_default": true,
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Update Existing Project

`client.projects.update(stringprojectID, ProjectUpdateParamsparams, RequestOptionsoptions?): Project`

**put** `/api/v2/projects/{project_id}`

Update an existing project.

### Parameters

- `projectID: string`

- `params: ProjectUpdateParams`

  - `name: string`

    Body param: The project's new display name.

  - `organization_id?: string | null`

    Query param

### Returns

- `Project`

  API response schema for a project.

  - `id: string`

    The project's unique identifier.

  - `name: string`

    The project's display name.

  - `organization_id: string`

    The organization the project belongs to.

  - `created_at?: string | null`

    Creation datetime

  - `is_default?: boolean`

    Whether this project is the default project for its organization.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

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

const project = await client.projects.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { name: 'x' });

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

#### Response

```json
{
  "id": "id",
  "name": "name",
  "organization_id": "organization_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "is_default": true,
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Delete Project

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

**delete** `/api/v2/projects/{project_id}`

Delete a project by ID.

### Parameters

- `projectID: string`

- `params: ProjectDeleteParams`

  - `organization_id?: string | null`

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

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

await client.projects.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
```

## Domain Types

### Project

- `Project`

  API response schema for a project.

  - `id: string`

    The project's unique identifier.

  - `name: string`

    The project's display name.

  - `organization_id: string`

    The organization the project belongs to.

  - `created_at?: string | null`

    Creation datetime

  - `is_default?: boolean`

    Whether this project is the default project for its organization.

  - `updated_at?: string | null`

    Update datetime
