---
title: Departments
editUrl: false
head: []
template: doc
prev: false
next: false
sidebar:
  hidden: false
  attrs: {}
pagefind: true
draft: false
---

Defined in: [src/team/client.gen.ts:224](https://github.com/slingshot/brex/blob/9dff46b5d5637a0dd072bca56d02d8a0f4425312/src/team/client.gen.ts#L224)

## Constructors

### Constructor

> **new Departments**(`_core`): `Departments`

Defined in: [src/team/client.gen.ts:225](https://github.com/slingshot/brex/blob/9dff46b5d5637a0dd072bca56d02d8a0f4425312/src/team/client.gen.ts#L225)

#### Parameters

##### \_core

[`BrexCore`](/brex/api/index/classes/brexcore/)

#### Returns

`Departments`

## Methods

### create()

> **create**(`body`, `options?`): `Promise`\<\{ `description?`: `string` \| `null`; `id`: `string`; `name`: `string`; \}\>

Defined in: [src/team/client.gen.ts:235](https://github.com/slingshot/brex/blob/9dff46b5d5637a0dd072bca56d02d8a0f4425312/src/team/client.gen.ts#L235)

Create department

This endpoint creates a new department

`POST /v2/departments` — requires OAuth scope: `departments`
Supports an optional `Idempotency-Key` via `options.idempotencyKey`.

#### Parameters

##### body

###### description?

`string` \| `null`

**Description**

Description of the department

###### name

`string`

**Description**

Name of the department

##### options?

[`RequestOptions`](/brex/api/index/interfaces/requestoptions/)

#### Returns

`Promise`\<\{ `description?`: `string` \| `null`; `id`: `string`; `name`: `string`; \}\>

***

### get()

> **get**(`id`, `options?`): `Promise`\<\{ `description?`: `string` \| `null`; `id`: `string`; `name`: `string`; \}\>

Defined in: [src/team/client.gen.ts:255](https://github.com/slingshot/brex/blob/9dff46b5d5637a0dd072bca56d02d8a0f4425312/src/team/client.gen.ts#L255)

Get department

This endpoint gets a department by ID.

`GET /v2/departments/{id}` — requires OAuth scope: `departments`, `departments.readonly`

#### Parameters

##### id

`string`

##### options?

[`RequestOptions`](/brex/api/index/interfaces/requestoptions/)

#### Returns

`Promise`\<\{ `description?`: `string` \| `null`; `id`: `string`; `name`: `string`; \}\>

***

### list()

> **list**(`query?`, `options?`): [`PagePromise`](/brex/api/index/classes/pagepromise/)\<\{ `items`: `object`[]; `next_cursor?`: `string` \| `null`; \}\>

Defined in: [src/team/client.gen.ts:274](https://github.com/slingshot/brex/blob/9dff46b5d5637a0dd072bca56d02d8a0f4425312/src/team/client.gen.ts#L274)

List departments

This endpoint lists all departments.

`GET /v2/departments` — requires OAuth scope: `departments`, `departments.readonly`
Await for a single page, or `for await` to iterate items across all pages.

#### Parameters

##### query?

###### cursor?

`string` \| `null`

###### limit?

`number` \| `null`

###### name?

`string` \| `null`

##### options?

[`RequestOptions`](/brex/api/index/interfaces/requestoptions/)

#### Returns

[`PagePromise`](/brex/api/index/classes/pagepromise/)\<\{ `items`: `object`[]; `next_cursor?`: `string` \| `null`; \}\>