> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# noCRM API reference

> API reference for the noCRM plugin in Corsair: every `nocrm.api.*` operation with its input and output types, taken from the plugin's Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](https://docs.corsair.dev/concepts/api.md), [authentication](https://docs.corsair.dev/concepts/auth.md), and [error handling](https://docs.corsair.dev/concepts/error-handling).

## Account

### ping

`account.ping`

Ping the API with one of your API key or the USER token received to make sure that the key to authenticate the requests is correct. Return a status 200 if the API key or the USER token you are using to authenticate your requests is valid.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.account.ping({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `number \| string \| null` | No | — |
| `message` | `string \| null` | No | — |

***

## Activities

### list

`activities.list`

Return the list of activities, previously created in your account.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.activities.list({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   icon?: string | null,
>   parent_id?: number | string | null,
>   color?: string | null,
>   kind?: string | null,
>   is_disabled?: boolean | null,
>   position?: any | null
> }[]
> ```

***

## Calls

### listContacts

`calls.listContacts`

Get all phone/mobile contact for leads and prospects In the response: The contacts are returned with a limit of 500 maximum. However it is possible to lower this limit. To get more than 500 contacts, you need to do multiple requests and use the offset parameter to shift the data. Registered noCRM partner integrations only: needs the partnerKey option (sent as X-API-PARTNER-KEY).

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.calls.listContacts({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `limit` | `number` | Yes | Number of data returned. Value should be between 1 and 500. |
| `offset` | `number` | Yes | Shift the returned data by the offset value. Option used with the limit parameter in order to paginate the return. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   title?: string | null,
>   field?: {
>     type?: string | null,
>     value?: string | null
>   } | null,
>   item?: {
>     type?: string | null,
>     id?: number | string | null
>   } | null,
>   permalink?: string | null
> }[]
> ```

***

## Categories

### create

`categories.create`

Return the created category.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.categories.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | The category name |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `is_required` | `boolean \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `position` | `any \| null` | No | — |

***

### list

`categories.list`

Return the list of categories with their tags if option added, previously created in your account.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.categories.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `includeTags` | `boolean` | No | Include the supertags under each categories returned. Default: false. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   is_required?: boolean | null,
>   updated_at?: string | null,
>   created_at?: string | null,
>   supertags?: {
>     id?: number | string | null,
>     name?: string | null,
>     category?: string | null,
>     category_id?: number | string | null,
>     created_at?: string | null,
>     position?: any | null
>   }[] | null
> }[]
> ```

***

## Clients

### create

`clients.create`

Return the client folder created.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.clients.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | The name of the client folder. |
| `description` | `string` | No | The client folder's description. |
| `userId` | `number \| string` | No | User’s email address or id to assign the client folder to the user. This parameter returns an error in case you are using the login user method to authenticate (USER token) |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `is_active` | `boolean \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   permalink?: string | null,
>   fields?: {
>     email?: any | null,
>     phone?: any | null,
>     mobile?: any | null,
>     address?: string | null,
>     web?: any | null,
>     first_name?: any | null,
>     last_name?: any | null,
>     full_name?: any | null,
>     job?: any | null,
>     fax?: any | null,
>     vat?: any | null,
>     city?: any | null,
>     zipcode?: any | null,
>     state?: any | null,
>     country?: any | null
>   } | null,
>   fields_by_name?: {
>     Address?: string | null,
>     Billing address?: any | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null
> } | null
> ```

***

### delete

`clients.delete`

Delete the client folder previously created from its id.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.clients.delete({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The identifier of the client folder |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |

***

### get

`clients.get`

Return the client folder, previously created in your account.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.clients.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The identifier of the lead |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `is_active` | `boolean \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   permalink?: string | null,
>   fields?: {
>     email?: any | null,
>     phone?: any | null,
>     mobile?: any | null,
>     address?: string | null,
>     web?: any | null,
>     first_name?: any | null,
>     last_name?: any | null,
>     full_name?: any | null,
>     job?: any | null,
>     fax?: any | null,
>     vat?: any | null,
>     city?: any | null,
>     zipcode?: any | null,
>     state?: any | null,
>     country?: any | null
>   } | null,
>   fields_by_name?: {
>     Address?: string | null,
>     Billing address?: any | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null
> } | null
> ```

***

### list

`clients.list`

Return the list of client folders, previously created in your account. The client folders are returned ordered by their name by default.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.clients.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `direction` | `asc \| desc` | No | Return data order by their order in ascending or descending. The value should be asc or desc. Default: asc. |
| `order` | `string` | No | Return data order by their name or id. The value should be name or id. Default: name. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   description?: string | null,
>   is_active?: boolean | null,
>   created_at?: string | null,
>   user_id?: number | string | null
> }[]
> ```

***

### update

`clients.update`

Update the client folder previously created.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.clients.update({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The identifier of the client folder |
| `name` | `string` | No | The new name of the client folder |
| `description` | `string` | No | The new description of the client folder |
| `isActive` | `boolean` | No | Boolean to activate or inactivate the client folder |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `is_active` | `boolean \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   permalink?: string | null,
>   fields?: {
>     email?: any | null,
>     phone?: any | null,
>     mobile?: any | null,
>     address?: string | null,
>     web?: any | null,
>     first_name?: any | null,
>     last_name?: any | null,
>     full_name?: any | null,
>     job?: any | null,
>     fax?: any | null,
>     vat?: any | null,
>     city?: any | null,
>     zipcode?: any | null,
>     state?: any | null,
>     country?: any | null
>   } | null,
>   fields_by_name?: {
>     Address?: string | null,
>     Billing address?: any | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null
> } | null
> ```

***

## Email Signatures

### set

`emailSignatures.set`

Create or update a user's email signature. This endpoint is only available for EMAIL type registered integrations. You must pass an HTTP header X-API-PARTNER-KEY with a partner public key. Registered noCRM partner integrations only: needs the partnerKey option (sent as X-API-PARTNER-KEY).

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.emailSignatures.set({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `content` | `string` | Yes | The content of the email signature. |
| `userId` | `number \| string` | Yes | User’s email address or id to assign the email signature to the user. |

**Output:** `any`

***

## Fields

### create

`fields.create`

Return the created fields.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.fields.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Name of the field (max 32 characters) |
| `parentType` | `lead \| client` | Yes | Element on which the field will be associated. Possible values: lead, client |
| `type` | `string` | No | Type of the field. Possible values: unset, email, phone, mobile, address, web, first\_name, last\_name, full\_name, job, fax, vat, city, zipcode, state, country, company\_id, custom1 (not available in starter edition), custom2 (not available in starter edition), custom3 (not available in starter edition), custom4 (not available in starter edition), custom5 (not available in starter edition) |
| `isKey` | `boolean` | No | If true, the field will be used to detect potential duplicate leads Default: false. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `type` | `string \| null` | No | — |
| `parent_type` | `string \| null` | No | — |
| `position` | `number \| string \| null` | No | — |
| `is_key` | `boolean \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |

***

### list

`fields.list`

Return the list of fields defined for your leads and clients.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.fields.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `string` | No | To restrict the type of fields you want. The values can be lead or client. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   type?: string | null,
>   parent_type?: string | null,
>   position?: number | string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }[]
> ```

***

## Lead Attachments

### create

`leadAttachments.create`

Create an attachment for the specified lead from the uploaded file.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leadAttachments.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `attachment` | `object` | Yes | The information of the uploaded file |

POST /api/v2/leads/\{lead\_id}/attachments as multipart, with attachment \{filename, contentType, base64}.

> [accordion] attachment full type
>
> ```ts theme={null}
> {
>   filename: string,
>   contentType: string,
>   base64: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `url` | `string \| null` | No | — |
| `content_type` | `string \| null` | No | — |
| `kind` | `string \| null` | No | — |

***

### delete

`leadAttachments.delete`

Delete an attachment for the specified lead from the uploaded file.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.leadAttachments.delete({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `id` | `number` | Yes | Attachment's id. The identifier of the attachment on the lead. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |

***

### get

`leadAttachments.get`

Retrieve one attachment url for the specified lead. The url returned allows the download of the attachment for a short period of time. It only returns the urls for the attachments of kind attachment. The other attachments coming from accounting for example cannot be downloaded.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.leadAttachments.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `id` | `number` | Yes | Attachment's id. The identifier of the attachment of kind attachment. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string \| null` | No | — |

***

### list

`leadAttachments.list`

Retrieve all attachments for the specified lead. It includes all the files that have been attached but also if you have an integration with Freshbooks, QuickBooks or Factomos, the estimate and invoices attached to the lead. To differenciate the different kind of attachments, the attribute kind will specify where the attachment is coming from. The possible values are attachment, business\_card, freshbooks\_estimate, freshbooks\_invoice, quickbooks\_estimate, quickbooks\_invoice, factomos\_estimate, factomos\_invoice, dropbox.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.leadAttachments.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   url?: string | null,
>   content_type?: string | null,
>   kind?: string | null
> }[]
> ```

***

## Lead Comments

### create

`leadComments.create`

Create a comment on a lead.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leadComments.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `content` | `string` | Yes | Content of the comment. |
| `userId` | `number \| string` | No | User’s email address or id to whom the comment should belong. This parameter is ignored in case of the login method to authenticate is used. (USER token) |
| `attachments` | `object` | No | Attachment to add on the comment |
| `activityId` | `number` | No | Activity's id to set on the comment |
| `createdAt` | `string` | No | Change the creation date of the comment |

> [accordion] attachments full type
>
> ```ts theme={null}
> {
>   filename: string,
>   contentType: string,
>   base64: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `content` | `string \| null` | No | — |
| `commented_item` | `object \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `attachments` | `any[] \| null` | No | — |
| `activity_id` | `any \| null` | No | — |
| `is_pinned` | `boolean \| null` | No | — |
| `raw_content` | `string \| null` | No | — |
| `extended_info` | `any \| null` | No | — |
| `reactions` | `any[] \| null` | No | — |
| `user` | `object \| null` | No | — |

> [accordion] commented\_item full type
>
> ```ts theme={null}
> {
>   item?: string | null,
>   id?: number | string | null
> } | null
> ```

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null
> } | null
> ```

***

### delete

`leadComments.delete`

Delete a comment on a lead.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.leadComments.delete({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `id` | `number` | Yes | Comment's id. The identifier of the comment to delete. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |

***

### list

`leadComments.list`

Retrieve all comments of a lead.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.leadComments.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `direction` | `asc \| desc` | No | Direction for ordereing the data returned in ascending or descending. The value should be asc or desc. Default: desc. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   content?: string | null,
>   commented_item?: {
>     item?: string | null,
>     id?: number | string | null
>   } | null,
>   created_at?: string | null,
>   attachments?: {
>     id?: number | string | null,
>     name?: string | null,
>     url?: string | null,
>     permalink?: string | null,
>     content_type?: any | null,
>     kind?: string | null
>   }[] | null,
>   activity_id?: number | string | null,
>   is_pinned?: boolean | null,
>   raw_content?: string | null,
>   extended_info?: {
>     from?: string | null,
>     to?: string | null,
>     cc?: string | null,
>     subject?: string | null
>   } | null,
>   reactions?: any[] | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   activity?: {
>     id?: number | string | null,
>     name?: string | null,
>     kind?: string | null,
>     duration?: any | null,
>     icon?: string | null,
>     color?: string | null,
>     created_at?: string | null,
>     is_outcome?: boolean | null
>   } | null,
>   action_item?: {
>     type?: string | null,
>     email?: {
>       id?: number | string | null,
>       parent_item?: Record<string, any> | null,
>       to?: string | null,
>       from?: string | null,
>       from_name?: any | null,
>       cc?: string | null,
>       bcc?: string | null,
>       subject?: string | null,
>       content?: string | null,
>       threaded_content?: (string | null)[] | null,
>       has_more_content?: boolean | null,
>       sent_at?: string | null,
>       created_at?: string | null,
>       attachments?: any[] | null,
>       is_read?: boolean | null,
>       lead_id?: number | string | null,
>       status?: number | string | null,
>       scheduled_at?: string | null,
>       user?: Record<string, any> | null
>     } | null
>   } | null
> }[]
> ```

***

### update

`leadComments.update`

Update a comment on a lead

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leadComments.update({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead id. |
| `id` | `number` | Yes | Id. |
| `content` | `string` | Yes | Replace existing content |
| `activityId` | `number` | No | Activity's id to set on the comment |
| `isPinned` | `boolean` | No | Pinned the comment |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `content` | `string \| null` | No | — |
| `commented_item` | `object \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `attachments` | `any[] \| null` | No | — |
| `activity_id` | `number \| string \| null` | No | — |
| `is_pinned` | `boolean \| null` | No | — |
| `raw_content` | `string \| null` | No | — |
| `extended_info` | `any \| null` | No | — |
| `reactions` | `any[] \| null` | No | — |
| `user` | `object \| null` | No | — |
| `activity` | `object \| null` | No | — |

> [accordion] commented\_item full type
>
> ```ts theme={null}
> {
>   item?: string | null,
>   id?: number | string | null
> } | null
> ```

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null
> } | null
> ```

> [accordion] activity full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   kind?: string | null,
>   duration?: any | null,
>   icon?: string | null,
>   color?: string | null,
>   created_at?: string | null,
>   is_outcome?: boolean | null
> } | null
> ```

***

## Leads

### addTag

`leads.addTag`

Add the specified tag to the lead.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.addTag({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `tag` | `string` | Yes | The tag to add to the lead. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `string \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `string \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### addToClient

`leads.addToClient`

Add a lead to an existing client folder.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.addToClient({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | Lead's id. The identifier of the lead. |
| `clientId` | `number` | Yes | Client folder's id. The identifier of a client folder |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `any \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `next_action_at` | `string \| null` | No | — |
| `remind_date` | `string \| null` | No | — |
| `remind_time` | `string \| null` | No | — |
| `reminder_at` | `string \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `reminder_activity_id` | `number \| string \| null` | No | — |
| `reminder_activity_log_id` | `number \| string \| null` | No | — |
| `reminder_note` | `string \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `number \| string \| null` | No | — |
| `client_folder_name` | `string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   first_contact_email?: string | null,
>   all_contact_emails?: (string | null)[] | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: {
>     id?: number | string | null,
>     name?: string | null,
>     description?: string | null,
>     is_active?: boolean | null,
>     created_at?: string | null,
>     user_id?: number | string | null,
>     extended_info?: {
>       permalink?: string | null,
>       fields?: Record<string, any> | null,
>       fields_by_name?: Record<string, any> | null,
>       user?: Record<string, any> | null
>     } | null
>   } | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null
> } | null
> ```

***

### appendToDescription

`leads.appendToDescription`

Append text to lead's description.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.appendToDescription({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `toAppend` | `string` | Yes | Text to append at the end of the lead's description. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `any \| null` | No | — |
| `probability` | `any \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `any \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `any \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### assign

`leads.assign`

Assign a lead to a collaborator. The user will be notified by email of the assignment if the preference to receive notifications is checked. noCRM emails the new owner when their assignment notifications are on.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.leads.assign({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | Id. |
| `userId` | `number \| string` | Yes | Lead's user id or email. The new user id or user email of the lead. This update corresponds to assign the lead to a new user. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `any \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `next_action_at` | `string \| null` | No | — |
| `remind_date` | `string \| null` | No | — |
| `remind_time` | `string \| null` | No | — |
| `reminder_at` | `string \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `reminder_activity_id` | `number \| string \| null` | No | — |
| `reminder_activity_log_id` | `number \| string \| null` | No | — |
| `reminder_note` | `string \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `number \| string \| null` | No | — |
| `client_folder_name` | `string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   first_contact_email?: string | null,
>   all_contact_emails?: (string | null)[] | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: {
>     id?: number | string | null,
>     name?: string | null,
>     description?: string | null,
>     is_active?: boolean | null,
>     created_at?: string | null,
>     user_id?: number | string | null,
>     extended_info?: {
>       permalink?: string | null,
>       fields?: Record<string, any> | null,
>       fields_by_name?: Record<string, any> | null,
>       user?: Record<string, any> | null
>     } | null
>   } | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null
> } | null
> ```

***

### assignRandom

`leads.assignRandom`

Assign the lead randomly to any user of the account. An option is possible to assign a lead to any user excluding the administrators noCRM emails the new owner when their assignment notifications are on.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.leads.assignRandom({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `noAdmin` | `boolean` | No | Exclude the administrator when picking randomly a user in the account. Default: false. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `string \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `string \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### assignRandomInTeam

`leads.assignRandomInTeam`

Assign the lead randomly to another user inside the specified team. noCRM emails the new owner when their assignment notifications are on.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.leads.assignRandomInTeam({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `teamId` | `number` | Yes | Team's identifier. |
| `noManager` | `boolean` | No | Exclude managers inside the team. true to exclude and false to include. By default the managers are included. Default: false. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `string \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `string \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### assignRoundRobin

`leads.assignRoundRobin`

Assign the lead to any user with an equal repartition between the users. noCRM emails the new owner when their assignment notifications are on.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.leads.assignRoundRobin({ leadId: 40379412, increment: 18, teamId: 13447 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `increment` | `number` | Yes | The value of the increment counter that tracks the number of leads assigned thus far. |
| `teamId` | `number` | No | The team idenitifier number in order to assign leads to team members. |
| `noManager` | `boolean` | No | Exclude managers inside the team. true to exclude and false to include. By default the managers are included. Default: false. |
| `noAdmin` | `boolean` | No | Exclude administrators. true to exclude and false to include. By default the administrators are included. Default: false. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `string \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `string \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### assignWeightedRoundRobin

`leads.assignWeightedRoundRobin`

Assigns the lead to a user based on a weighted distribution, where each user's assignment probability is determined by their configured weight. noCRM emails the new owner when their assignment notifications are on.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.leads.assignWeightedRoundRobin({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `increment` | `number` | Yes | The value of the increment counter that tracks the number of leads assigned thus far. |
| `weightConfiguration` | `Record<string, number>` | Yes | JSON where each key is a user ID and each value is a numeric weight that determines how frequently that user should be assigned. |
| `noManager` | `boolean` | No | Exclude managers inside the team. true to exclude and false to include. By default the managers are included. Default: false. |
| `noAdmin` | `boolean` | No | Exclude administrators. true to exclude and false to include. By default the administrators are included. Default: false. |
| `assignOnlyOnListedUsers` | `boolean` | No | Restricts assignments exclusively to users listed in the "weight\_configuration" parameter. "True" to enable this restriction and "False" to disable it. By default, the restriction is enabled. Default: true. |

GET /api/simple/leads/\{lead\_id}/assign/weighted\_round\_robin. weightConfiguration maps user ids to weights, e.g. \{"131792": 3, "131798": 7}; the plugin sends it as JSON.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `string \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `string \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### create

`leads.create`

To create a new lead, you have to pass the required parameters. Depending on the key you used, with only the required parameters the lead will belong to: In case you are using the API key and you want to assign directly the lead to a collaborator, you need to add the email address or the id of the user as parameter. If we cannot retrieve any user registered in the account an error is returned. When using the "direct assignment" The user won't receive a notification when the lead is created. If a notification has to be sent, create the lead unassigned and use the method assign to assign the lead to the user. With this method, the user is notified. The user\_id parameter returns an error when using the USER token.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `title` | `string` | Yes | Lead's title. Usually it corresponds to the company name. |
| `description` | `string` | Yes | Lead's description. Usually it contains the information of the contact in the company. |
| `userId` | `number \| string` | No | User's email address or id to assign the lead to the user. This parameter returns an error in case you are using the login user method to authenticate (USER token) |
| `tags` | `string[]` | No | An array of tags describing the lead. If the tags don't exist they are automatically created. The tags could also include the Predefined tags of your account. |
| `createdAt` | `string` | No | Date of lead's creation with the following format: YYYY-MM-DD HH:MM:SS in the time zone of the account and the time in 24h format. The time can be also be in UTC with this specific format: YYYY-MM-DDTHH:MM:SS.sssZ. Do not use this parameter if you don't want to past date your lead creation. |
| `step` | `number \| string` | No | Step's id or Step's name for the lead. If the step is not found, an error 404 is returned. For information if you have steps in different pipeline that have the same name, it is better to use the step's id. The step can only be set if the lead is assigned. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `any \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `next_action_at` | `string \| null` | No | — |
| `remind_date` | `any \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `any \| null` | No | — |
| `reminder_duration` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `string \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `any \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   first_contact_email?: string | null,
>   all_contact_emails?: (string | null)[] | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: any | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null
> } | null
> ```

***

### delete

`leads.delete`

Delete a lead previously created from its id.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.leads.delete({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | Lead's id. The identifier of the lead. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |

***

### deleteMany

`leads.deleteMany`

Delete multiple leads at once from their ids. It returns a list of lead ids that couldn't be deleted: not existing anymore, no rights to delete,... This list will empty of course if all lead ids have been deleted. Answers the ids that could not be deleted (an empty list when all were).

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.leads.deleteMany({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `ids` | `number[]` | Yes | Comma separated lead's ids. |

DELETE /api/v2/leads/delete\_multiple with ids. Answers the ids that could not be deleted; an empty list means all were.

**Output:** `(number \| string \| null)[]`

***

### duplicate

`leads.duplicate`

Duplicate the lead. If the step parameter is not used, the duplicated lead will go to the first step of the same pipeline of the lead.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.duplicate({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | Lead's id. The identifier of the lead. |
| `step` | `number \| string` | No | Step's id or Step's name for the lead. If the step is not found, an error 404 is returned. For information if you have steps in different pipeline that have the same name, it is better to use the step's id. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `any \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `next_action_at` | `string \| null` | No | — |
| `remind_date` | `any \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `any \| null` | No | — |
| `reminder_duration` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `string \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `any \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   first_contact_email?: string | null,
>   all_contact_emails?: (string | null)[] | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: any | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null
> } | null
> ```

***

### get

`leads.get`

Retrieve a lead previously created from its id.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.leads.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | Lead's id. The identifier of the lead. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `any \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `next_action_at` | `string \| null` | No | — |
| `remind_date` | `string \| null` | No | — |
| `remind_time` | `string \| null` | No | — |
| `reminder_at` | `string \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `reminder_activity_id` | `number \| string \| null` | No | — |
| `reminder_activity_log_id` | `number \| string \| null` | No | — |
| `reminder_note` | `string \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `number \| string \| null` | No | — |
| `client_folder_name` | `string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   first_contact_email?: string | null,
>   all_contact_emails?: (string | null)[] | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: {
>     id?: number | string | null,
>     name?: string | null,
>     description?: string | null,
>     is_active?: boolean | null,
>     created_at?: string | null,
>     user_id?: number | string | null,
>     extended_info?: {
>       permalink?: string | null,
>       fields?: Record<string, any> | null,
>       fields_by_name?: Record<string, any> | null,
>       user?: Record<string, any> | null
>     } | null
>   } | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null
> } | null
> ```

***

### getBusinessCard

`leads.getBusinessCard`

Retrieve the picture of a business card on a lead previously created by a business card.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.leads.getBusinessCard({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | Lead's id. The identifier of the lead. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string \| null` | No | — |

***

### list

`leads.list`

Return a list of leads, previously created in your account. The leads are returned with a limit of 100 by default. However it is possible to lower this limit. To get more than 100 leads, you need to do multiple requests and use the offset parameter to shift the data.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.leads.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `direction` | `asc \| desc` | No | Direction for ordering the data returned in ascending or descending. The value should be asc or desc. Default: desc. |
| `order` | `string` | No | Attribute to order the data returned. Could be: id, creation\_date, last\_update, next\_action, sale\_step, amount, probability, probalized\_amount, alphabetically. Default: id. |
| `limit` | `number` | No | Maximum count of data returned by request. Default: 100. |
| `status` | `string[]` | No | Array of status names separated by a comma. Return the leads with the specified statuses. The status could be one of these values: todo, standby, won, cancelled, lost. |
| `step` | `string[]` | No | Array of step names separated by commas, or array of step IDs separated by commas. Each step must match the exact name entered in the application. You cannot mix step names and step IDs. Returns the leads for the specified steps. |
| `starred` | `boolean` | No | If set to true, returned all starred leads. |
| `userId` | `number \| string` | No | User id or email to retrieve the leads belonging to this user only. |
| `email` | `string` | No | Email address entered in the lead's description or in a comment. Return the leads containing this email address. |
| `fieldKey` | `string` | No | Field name entered in the lead's description which has been set as a key to detect duplicates. It has to be used with the field\_value parameter. This parameter is only available for Expert accounts. |
| `fieldValue` | `string` | No | Field value corresponding to the field\_key parameter. Return the leads containing this value in the field\_key. It has to be used with the field\_key parameter. This parameter is only available for Expert accounts. |
| `tags` | `string[]` | No | An array of tags. Return the leads containing all the tags of the array. The tags could also include the Predefined tags of your account. |
| `offset` | `number` | No | Shift the returned data by the offset value. Option used with the limit parameter in order to paginate the return. |
| `updatedAfter` | `string` | No | Date from which leads will be retrieved according to their last update (can conflict with date\_range\_type parameter) |
| `startDate` | `string` | No | Date from which leads will be retrieved according to the date\_range\_type parameter |
| `endDate` | `string` | No | Date until which leads will be retrieved according to the date\_range\_type parameter |
| `dateRangeType` | `creation \| update \| next_action \| closed` | No | Type of date range when using start\_date and/or end\_date parameters. Could be: creation, update, next\_action, closed Default: creation. |
| `includeUnassigned` | `boolean` | No | Include or not the unassigned leads when listing or searching the leads. false by default. If using the USER\_TOKEN authentication, the user has to be able to see the unassigned leads. Default: false. |

GET /api/v2/leads. Paged with limit (default 100) and offset; the total is in the X-TOTAL-COUNT header, which the plugin does not return. status, step and tags take lists (sent comma-separated). Unassigned leads are left out unless includeUnassigned is true.

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   title?: string | null,
>   pipeline?: any | null,
>   step?: string | null,
>   step_id?: number | string | null,
>   status?: string | null,
>   amount?: number | string | null,
>   probability?: number | string | null,
>   currency?: string | null,
>   starred?: boolean | null,
>   next_action_at?: string | null,
>   remind_date?: string | null,
>   remind_time?: string | null,
>   created_at?: string | null,
>   estimated_closing_date?: any | null,
>   updated_at?: string | null,
>   second_number?: any | null,
>   amount_percentage?: any | null,
>   closed_at?: any | null,
>   description?: string | null,
>   html_description?: string | null,
>   tags?: (string | null)[] | null,
>   created_from?: string | null,
>   attachment_count?: number | string | null,
>   created_by_id?: number | string | null,
>   user_id?: number | string | null,
>   client_folder_id?: number | string | null,
>   client_folder_name?: string | null,
>   team_id?: number | string | null,
>   team_name?: string | null,
>   text_description?: string | null
> }[]
> ```

***

### listDuplicates

`leads.listDuplicates`

Retrieves all duplicates of a lead. Duplicates are retrieved from lead titles and default fields set as key (see our help center for more information about default fields set as key).

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.leads.listDuplicates({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   lead?: {
>     id?: number | string | null,
>     title?: string | null,
>     pipeline?: any | null,
>     step?: string | null,
>     step_id?: number | string | null,
>     status?: string | null,
>     amount?: number | string | null,
>     probability?: number | string | null,
>     currency?: string | null,
>     starred?: boolean | null,
>     next_action_at?: string | null,
>     remind_date?: string | null,
>     remind_time?: string | null,
>     reminder_at?: string | null,
>     reminder_duration?: number | string | null,
>     created_at?: string | null,
>     estimated_closing_date?: any | null,
>     updated_at?: string | null,
>     second_number?: any | null,
>     amount_percentage?: any | null,
>     reminder_activity_id?: number | string | null,
>     reminder_activity_log_id?: number | string | null,
>     reminder_note?: string | null,
>     comment_count?: number | string | null,
>     closed_at?: any | null,
>     description?: string | null,
>     html_description?: string | null,
>     tags?: (string | null)[] | null,
>     created_from?: string | null,
>     created_by_id?: number | string | null,
>     user_id?: number | string | null,
>     team_id?: number | string | null,
>     client_folder_id?: number | string | null,
>     client_folder_name?: string | null,
>     attachment_count?: number | string | null,
>     extended_info?: {
>       first_contact_email?: string | null,
>       all_contact_emails?: (string | null)[] | null,
>       permalink?: string | null,
>       fields?: Record<string, any> | null,
>       fields_by_name?: Record<string, any> | null,
>       comment_count?: number | string | null,
>       bcc_count?: number | string | null,
>       team?: Record<string, any> | null,
>       user?: Record<string, any> | null,
>       client_folder?: Record<string, any> | null,
>       created_by?: Record<string, any> | null,
>       business_card_id?: number | string | null,
>       visible_by_count?: number | string | null,
>       follow_ups?: any[] | null
>     } | null
>   } | null,
>   matches?: ((string | null)[] | null)[] | null
> }[]
> ```

***

### listHistory

`leads.listHistory`

Retrieve the action histories of a lead depending on the filter you entered. The action histories are returned by bulk. The number of items returned can be defined by a parameter but cannot exceed 100 items.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.leads.listHistory({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead id. |
| `from` | `string` | No | Start date to retrieve the action histories. |
| `to` | `string` | No | End date to retrieve the action histories. If used with the from parameter, action histories are retrieved in the date range. If used alone, all the action histories are retrieved until this date. |
| `actionType` | `string` | No | Filter on the action's type that triggered the entry in the history. Could be one of these values: client\_assigned, step\_changed, status\_changed, amount\_set, user\_assigned, lead\_created, comment\_added, email\_sent. |
| `actionValue` | `string` | No | Filter on the value of two specifics action's types: step\_changed and status\_changed. The available status\_changed values are: todo, standby, won, lost, cancelled. If the step or status value is not recognized (typo, deletion), the filter is ignored. |
| `userIds` | `string[]` | No | Filter on the users who made the actions. Comma-separated list of user ids or user emails. |
| `direction` | `asc \| desc` | No | Return data order by their id in ascending or descending. The value should be asc or desc. Default: asc. |
| `limit` | `number` | No | Number of data returned. Value should be between 1 and 100. Default: 100. |
| `offset` | `number` | No | Shift the returned data by the offset value. Option used with the limit parameter in order to paginate the return. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lead_id?: number | string | null,
>   action_type?: string | null,
>   action_item?: {
>     type?: string | null,
>     id?: number | string | null
>   } | null,
>   created_at?: string | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null
> }[]
> ```

***

### listUnassigned

`leads.listUnassigned`

Return the list of unassigned leads. The leads are returned with a limit of 100 by default. However it is possible to lower this limit.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.leads.listUnassigned({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `limit` | `number` | No | Maximum count of data returned by the request. Default: 100. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   title?: string | null,
>   pipeline?: any | null,
>   step?: string | null,
>   step_id?: number | string | null,
>   status?: string | null,
>   amount?: any | null,
>   probability?: any | null,
>   currency?: any | null,
>   starred?: boolean | null,
>   next_action_at?: string | null,
>   remind_date?: any | null,
>   remind_time?: any | null,
>   created_at?: string | null,
>   estimated_closing_date?: any | null,
>   updated_at?: string | null,
>   second_number?: any | null,
>   amount_percentage?: any | null,
>   reminder_activity_id?: any | null,
>   reminder_activity_log_id?: any | null,
>   reminder_note?: string | null,
>   comment_count?: number | string | null,
>   closed_at?: any | null,
>   description?: string | null,
>   html_description?: string | null,
>   tags?: (string | null)[] | null,
>   created_from?: string | null,
>   attachment_count?: number | string | null,
>   created_by_id?: any | null,
>   user_id?: any | null,
>   client_folder_id?: any | null,
>   client_folder_name?: any | null,
>   text_description?: string | null
> }[]
> ```

***

### logActivity

`leads.logActivity`

Add an activity to the lead.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.logActivity({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `activityId` | `number` | Yes | The identifier of the activity to add. |
| `userId` | `number \| string` | Yes | The identifier of the user who posts the activity. |
| `content` | `string` | No | The content of the activity to log. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `content` | `string \| null` | No | — |
| `commented_item` | `object \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `attachments` | `any[] \| null` | No | — |
| `activity_id` | `number \| string \| null` | No | — |
| `raw_content` | `string \| null` | No | — |
| `reactions` | `any[] \| null` | No | — |
| `is_pinned` | `boolean \| null` | No | — |
| `user` | `object \| null` | No | — |

> [accordion] commented\_item full type
>
> ```ts theme={null}
> {
>   item?: string | null,
>   id?: number | string | null
> } | null
> ```

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null
> } | null
> ```

***

### logCall

`leads.logCall`

Create a call on a lead. This endpoint is only available for registered integrations. You must pass an HTTP header X-API-PARTNER-KEY with a partner public key. Registered noCRM partner integrations only: needs the partnerKey option (sent as X-API-PARTNER-KEY). Deprecated by noCRM and due to be removed.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.logCall({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead (present in url). |
| `calledNumber` | `string` | No | The phone number called. This parameter is required in case of outbound call |
| `fromNumber` | `string` | No | The phone number who initiated the call. This parameter is required in case of inbound call |
| `direction` | `inbound \| outbound` | Yes | Must be inbound or outbound |
| `userId` | `number \| string` | No | User’s email address or id to whom the call should belong. |
| `startedAt` | `string` | No | Date of call's start with the following format: YYYY-MM-DD HH:MM:SS in the time zone of the account and the time in 24h format. The time can also be in UTC with this specific format: YYYY-MM-DDTHH:MM:SS.sssZ. Warning : started\_at \< ended\_at |
| `endedAt` | `string` | No | Date of call's end with the following format: YYYY-MM-DD HH:MM:SS in the time zone of the account and the time in 24h format. The time can also be in UTC with this specific format: YYYY-MM-DDTHH:MM:SS.sssZ. Warning : started\_at \< ended\_at |
| `recordLink` | `string` | No | Link to the record |
| `extCallKey` | `string` | No | Call ID from the partner side |
| `feedback` | `string` | No | A text that the customer could fill up to have feedback on the call and might add insight regarding the call |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `ext_call_key` | `string \| null` | No | — |
| `provider` | `string \| null` | No | — |
| `direction` | `string \| null` | No | — |
| `called_number` | `string \| null` | No | — |
| `from_number` | `string \| null` | No | — |
| `record_link` | `string \| null` | No | — |
| `started_at` | `string \| null` | No | — |
| `ended_at` | `string \| null` | No | — |
| `sent_at` | `any \| null` | No | — |
| `duration` | `number \| string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `kind` | `string \| null` | No | — |
| `user` | `object \| null` | No | — |
| `called_item` | `object \| null` | No | — |
| `comment` | `object \| null` | No | — |
| `text_content` | `any \| null` | No | — |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null
> } | null
> ```

> [accordion] called\_item full type
>
> ```ts theme={null}
> {
>   item?: string | null,
>   id?: number | string | null
> } | null
> ```

> [accordion] comment full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   content?: string | null,
>   activity_id?: number | string | null,
>   is_pinned?: boolean | null
> } | null
> ```

***

### markCancelled

`leads.markCancelled`

Change the lead's status to Cancelled.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.markCancelled({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `any \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `any \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### markLost

`leads.markLost`

Change the lead's status to Lost.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.markLost({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `any \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `any \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### markTodo

`leads.markTodo`

Change the lead's status to Todo.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.markTodo({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `any \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `any \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### markWon

`leads.markWon`

Change the lead's status to Won and set the amount if specified.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.markWon({ leadId: 40379412, amount: 1500 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `amount` | `number` | No | Amount of the won lead. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `any \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `any \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### moveToStep

`leads.moveToStep`

Move the lead to the specified step.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.moveToStep({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `stepId` | `number` | Yes | Step's identifier. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `string \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `string \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### nextStep

`leads.nextStep`

Move the lead to the next step. If the lead is already to the last step in its pipeline, an error is returned.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.nextStep({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `string \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `string \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### sendEmail

`leads.sendEmail`

Send a custom email to the lead. Sends a real email to the lead from the given user mailbox.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.leads.sendEmail({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `subject` | `string` | Yes | The subject of the email. |
| `fromUserId` | `number` | Yes | The identifier of the user who sends the email (FROM of the email). |
| `cc` | `string` | No | Email address to add in CC. |
| `bcc` | `string` | No | Email address to add in BCC. |
| `content` | `string` | Yes | The content of the email. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `message` | `string \| null` | No | — |

***

### sendTemplateEmail

`leads.sendTemplateEmail`

Send an email from a template. This route is only available for Dreamteam Edition. There are conditions before being able to send the email, if they are not respected the email is not sent: Sends a real email to the lead from the given user mailbox.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.leads.sendTemplateEmail({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `emailTemplateId` | `number` | Yes | The identifier of the email template. |
| `fromUserId` | `number` | Yes | The identifier of the user who sends the email (FROM of the email). |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `message` | `string \| null` | No | — |

***

### setStandby

`leads.setStandby`

Change the lead's status to Standby and schedule the next reminder to be due in a specified number of days in the future.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.setStandby({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `days` | `number` | Yes | Number of days to schedule the reminder in the future. |
| `activityId` | `number` | No | Activity identifier to set on the reminder. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `string \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `string \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `number \| string \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

### update

`leads.update`

Update a lead previously created.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.update({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | Lead's id. The identifier of the lead. |
| `title` | `string` | No | Lead's title. The new title of the lead. |
| `description` | `string` | No | Lead's description. The new description of the lead. Warning : you can't send description and fields or append\_desc parameters at the same time. |
| `status` | `string` | No | Lead's status. The new status of the lead. Could be one of these values: todo, standby, won, lost, cancelled. If the value is not recognized, an error 400 is returned. |
| `remindDate` | `string` | No | Date of the reminder with the following format: YYYY-MM-DD in the time zone of the account. If the status is changed to standby, this parameter is mandatory, otherwise an error 400 is returned. |
| `remindTime` | `string` | No | When a reminder date is added, a time can also be set. The format of the time is HH:MM and in 24h. The time can be set every 15 min. It is not mandatory, only the remind\_at is mandatory in case of status changed to standby. |
| `reminderDuration` | `number` | No | When a reminder date and time are added, the duration time can be updated. The duration is a positive integer in minutes and should be one of these values: 0, 15, 30, 45, 60, 90, 120, 150, 180, 240, 480, 720. It is not mandatory, if no duration is set, the default duration time of the lead's owner is used. |
| `reminderActivityId` | `number` | No | When setting up a reminder, you can define the activity for this reminder. |
| `reminderNote` | `string` | No | Add a note when setting up a reminder. |
| `amount` | `number` | No | Lead's amount. The new amount of the lead. |
| `probability` | `number` | No | Lead's probability. The new probability of the lead. |
| `starred` | `boolean` | No | Lead's starred. true if the lead is starred, false otherwise. |
| `step` | `number \| string` | No | New step's id or step's name for the lead. If the step is not found, an error 404 is returned. For information if you have steps in different pipeline that have the same name, it is better to use the step's id. |
| `userId` | `number \| string` | No | Lead's user id or email. The new user id or user email of the lead. This update corresponds to assign the lead to a new user. |
| `tags` | `string[]` | No | An array of tags describing the lead. If the tags don’t exist they are automatically created. The tags could also include the Predefined tags of your account. |
| `createdAt` | `string` | No | Date of lead's creation with the following format: YYYY-MM-DD HH:MM:SS in the time zone of the account and the time in 24h format. The time can be also be in UTC with this specific format: YYYY-MM-DDTHH:MM:SS.sssZ. Do not use this parameter if you don't want to past date your lead creation. |
| `estimatedClosingDate` | `string` | No | Estimated closing date on a lead. The date has to be in the time zone of the account. |
| `fields` | `object[]` | No | Fields to update into description, must contain keys and values about fields to update, eg : \[\{"key": "Phone", "value": "06 07 08 09 04"}, \{ "key": "Email", "value": "[you@example.com](mailto:you@example.com)"}, \{ "key": "Custom field", "value": "Hello"}].Warning : you can't send description and fields parameters at the same time. See limitation |
| `appendDesc` | `string` | No | Text to append at the end of the lead's description. Warning: you can't send description and append\_desc parameters simultaneously. |

PUT /api/v2/leads/\{id}. Send description, fields or appendDesc, not more than one of them. Setting status standby needs remindDate.

> [accordion] fields full type
>
> ```ts theme={null}
> {
>   key: string,
>   value: string | number | null
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `any \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `next_action_at` | `string \| null` | No | — |
| `remind_date` | `any \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `any \| null` | No | — |
| `reminder_duration` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `string \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `any \| null` | No | — |
| `client_folder_id` | `number \| string \| null` | No | — |
| `client_folder_name` | `string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   first_contact_email?: string | null,
>   all_contact_emails?: (string | null)[] | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: any | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: {
>     id?: number | string | null,
>     name?: string | null,
>     description?: string | null,
>     is_active?: boolean | null,
>     created_at?: string | null,
>     user_id?: number | string | null,
>     extended_info?: {
>       permalink?: string | null,
>       fields?: Record<string, any> | null,
>       fields_by_name?: Record<string, any> | null,
>       user?: Record<string, any> | null
>     } | null
>   } | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null
> } | null
> ```

***

### updateField

`leads.updateField`

Update a field's lead into description.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.leads.updateField({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `field` | `string` | Yes | Field's name to update. |
| `value` | `string` | Yes | New value of the field. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `string \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `any \| null` | No | — |
| `probability` | `any \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `remind_date` | `any \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `any \| null` | No | — |
| `reminder_duration` | `number \| string \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `any \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `any[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `number \| string \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   all_contact_emails?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null,
>   attachments?: any[] | null
> } | null
> ```

***

## Pipelines

### list

`pipelines.list`

Return the list of pipelines, previously created in your account.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.pipelines.list({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   is_default?: boolean | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }[]
> ```

***

## Post Sales Tasks

### createFromTemplate

`postSalesTasks.createFromTemplate`

Create a post-sales process on a lead from a template

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.postSalesTasks.createFromTemplate({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | Yes | Lead's id. The identifier of the lead. |
| `postSalesTemplateId` | `number` | Yes | The identifier of the post-sales process template. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `tasks_count` | `number \| string \| null` | No | — |
| `tasks_done_count` | `number \| string \| null` | No | — |
| `next_action_at` | `string \| null` | No | — |
| `lead_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `tasks` | `object[] \| null` | No | — |

> [accordion] tasks full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   content?: string | null,
>   position?: number | string | null,
>   status?: string | null,
>   done_at?: any | null,
>   next_action_at?: string | null,
>   follow_up_id?: number | string | null,
>   user_id?: number | string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }[] | null
> ```

***

### list

`postSalesTasks.list`

Get list of post-sales tasks

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.postSalesTasks.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `leadId` | `number` | No | Lead's id. Give leadId or userId. |
| `userId` | `number \| string` | No | User id or email. Give leadId or userId. |
| `status` | `string[]` | No | Array of status names separated by a comma. Return the post-sales tasks with the specified statuses. The status could be one of these values: todo, standby, done |

GET /api/v2/follow\_ups. noCRM requires leadId or userId.

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   title?: string | null,
>   description?: string | null,
>   status?: string | null,
>   tags?: (string | null)[] | null,
>   tasks_count?: number | string | null,
>   tasks_done_count?: number | string | null,
>   next_action_at?: string | null,
>   lead_id?: number | string | null,
>   user_id?: number | string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }[]
> ```

***

### updateTask

`postSalesTasks.updateTask`

Update task

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.postSalesTasks.updateTask({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `followUpId` | `number` | Yes | The identifier of the post sales task |
| `taskId` | `number` | Yes | The identifier of the task |
| `status` | `string` | No | The status could be one of these values: todo, standby, done |
| `remindDate` | `string` | No | Date of the reminder with the following format: YYYY-MM-DD in the time zone of the account. If the status is changed to standby, this parameter is mandatory, otherwise an error 400 is returned. |
| `remindTime` | `string` | No | When a reminder date is added, a time can also be set. The format of the time is HH:MM and in 24h. The time can be set every 15 min. It is not mandatory, only the remind\_date is mandatory in case of status changed to standby. |
| `reminderDuration` | `number` | No | When a reminder date and time are added, the duration time can be updated. The duration is a positive integer in minutes and should be one of these values: 0, 15, 30, 45, 60, 90, 120, 150, 180, 240, 480, 720. It is not mandatory, if no duration is set, the default duration time is 0. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `content` | `string \| null` | No | — |
| `position` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `done_at` | `any \| null` | No | — |
| `next_action_at` | `string \| null` | No | — |
| `follow_up_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |

***

## Predefined Tags

### create

`predefinedTags.create`

Return the created predefined tag.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.predefinedTags.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | The tag name |
| `categoryId` | `number` | Yes | The category id where the tag should be added |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `category` | `string \| null` | No | — |
| `category_id` | `number \| string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `position` | `any \| null` | No | — |

***

### list

`predefinedTags.list`

Return the list of predefined tags, previously created in your account.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.predefinedTags.list({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   category?: string | null,
>   category_id?: number | string | null,
>   created_at?: string | null,
>   position?: any | null
> }[]
> ```

***

## Prospecting Lists

### assign

`prospectingLists.assign`

Assign a prospecting list to a collaborator. The user will be notified by email of the assignment if the preference to receive notifications is checked. noCRM emails the new owner when their assignment notifications are on.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.prospectingLists.assign({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | Id. |
| `userId` | `number \| string` | Yes | Prospecting list's user id or email. The new user id or user email of the prospecting list. This update corresponds to assign the prospecting list to a new user. |

PUT /api/v2/spreadsheets/\{id}/assign. The reference says POST, which answers 404 "Action not found" (checked live).

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `column_count` | `number \| string \| null` | No | — |
| `column_names` | `(string \| null)[] \| null` | No | — |
| `privacy` | `number \| string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `permalink` | `string \| null` | No | — |
| `is_archived` | `boolean \| null` | No | — |
| `user` | `object \| null` | No | — |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null
> } | null
> ```

***

### comment

`prospectingLists.comment`

Create a comment on a prospecting list.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.prospectingLists.comment({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spreadsheetId` | `number` | Yes | Prospecting list's identifier. |
| `content` | `string` | Yes | Content of the comment. |
| `userId` | `number \| string` | No | User’s email address or id to whom the comment should belong. This parameter is ignored in case of the login method to authenticate is used. (USER token) |
| `attachments` | `object` | No | Attachment to add on the comment |
| `activityId` | `number` | No | Activity's id to set on the comment |

> [accordion] attachments full type
>
> ```ts theme={null}
> {
>   filename: string,
>   contentType: string,
>   base64: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `content` | `string \| null` | No | — |
| `commented_item` | `object \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `attachments` | `any[] \| null` | No | — |
| `activity_id` | `any \| null` | No | — |
| `is_pinned` | `boolean \| null` | No | — |
| `raw_content` | `string \| null` | No | — |
| `extended_info` | `any \| null` | No | — |
| `reactions` | `any[] \| null` | No | — |
| `user` | `object \| null` | No | — |

> [accordion] commented\_item full type
>
> ```ts theme={null}
> {
>   item?: string | null,
>   id?: number | string | null
> } | null
> ```

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null
> } | null
> ```

***

### create

`prospectingLists.create`

To create a new prospecting list, you have to pass the required parameters. With the required parameters the prospecting list will be created and will belong to: When using the API key authentication, if no user is set or if it does not correspond to any user in the account, the prospecting list will belong to the first administrator of the account. When using the USER token authentication, the user\_id parameter is ignored. By default the privacy of the prospecting list is computed automatically according to the settings of the account. However, it is possible to set the privacy of the prospecting list to be shared with everyone in the account. In this case just pass off for the privacy. The number of rows is limited to 5000. The number of columns on each row is limited to 26.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.prospectingLists.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `title` | `string` | Yes | Prospecting file's title. It could be the origin of the prospecting file. |
| `content` | `(string \| number \| null)[][]` | Yes | Content of the prospecting file as a json string from the array of array of data. The first row should be the column header. |
| `description` | `string` | No | Prospecting file's description. |
| `tags` | `string[]` | No | An array of tags describing the prospecting file. If the tags don't exist they are automatically created. The tags could also include the Predefined tags of your account. |
| `userId` | `number \| string` | No | Email address or id of the user owner of the prospecting\_file. Required parameter if a privacy is set and API key authentication. |
| `privacy` | `string` | No | If privacy is set to 'off' the prospecting list will be shared with everyone on the account. Otherwise the privacy is computed automatically with the settings of the account and the user used to create the list. Default: default. |

POST /api/v2/spreadsheets. content is rows of cells; the first row is the column names. noCRM renames the first column to "Lead's name". The API has no route to delete a prospecting list.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `column_names` | `(string \| null)[] \| null` | No | — |
| `privacy` | `number \| string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `permalink` | `string \| null` | No | — |
| `is_archived` | `boolean \| null` | No | — |
| `user` | `object \| null` | No | — |
| `spreadsheet_rows` | `object[] \| null` | No | — |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null
> } | null
> ```

> [accordion] spreadsheet\_rows full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lead_id?: any | null,
>   is_active?: boolean | null,
>   content?: (string | null)[] | null
> }[] | null
> ```

***

### get

`prospectingLists.get`

Retrieve a prospecting list previously created with its id.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.prospectingLists.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | Prospecting list's identifier. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `column_names` | `(string \| null)[] \| null` | No | — |
| `privacy` | `number \| string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `permalink` | `string \| null` | No | — |
| `user` | `object \| null` | No | — |
| `spreadsheet_rows` | `object[] \| null` | No | — |
| `is_archived` | `boolean \| null` | No | — |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null
> } | null
> ```

> [accordion] spreadsheet\_rows full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lead_id?: number | string | null,
>   is_active?: boolean | null,
>   content?: (string | null)[] | null,
>   comment_count?: number | string | null
> }[] | null
> ```

***

### list

`prospectingLists.list`

List the prospecting lists that the user can see

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.prospectingLists.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `title` | `string` | No | Filter the prospecting list by title (exact match) |
| `order` | `string` | No | Attribute used to sort the prospecting lists. The value should be one of id or created\_at or updated\_at Default: id. |
| `direction` | `asc \| desc` | No | Direction of data returned sorted out by ids. The value should be asc or desc Default: desc. |
| `limit` | `number` | No | Limit the number of data returned Default: 100. |
| `offset` | `number` | No | Shift the returned data by the offset value. Option used with the limit parameter in order to paginate the return. Default: 0. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   title?: string | null,
>   description?: string | null,
>   column_count?: number | string | null,
>   column_names?: (string | null)[] | null,
>   privacy?: number | string | null,
>   updated_at?: string | null,
>   created_at?: string | null,
>   tags?: (string | null)[] | null,
>   permalink?: string | null,
>   is_archived?: boolean | null,
>   to_qualify_row_count?: number | string | null,
>   total_row_count?: number | string | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null
> }[]
> ```

***

## Prospects

### add

`prospects.add`

Add the prospects (new rows) at the end of the specified prospecting list. The number of rows is limited to 100.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.prospects.add({ spreadsheetId: 348410, content: [['Acme Corp', 'jane@acme.example']] });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spreadsheetId` | `number` | Yes | Prospecting list's identifier. |
| `content` | `(string \| number \| null)[][]` | Yes | Content of the prospects as a json string corresponding of an array of an array of data. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lead_id?: any | null,
>   is_active?: boolean | null,
>   content?: (string | null)[] | null
> }[]
> ```

***

### comment

`prospects.comment`

Create a comment on a prospect.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.prospects.comment({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spreadsheetId` | `number` | Yes | Prospecting list's identifier. |
| `prospectId` | `number` | Yes | Prospect's identifier. |
| `content` | `string` | Yes | Content of the comment. |
| `userId` | `number \| string` | No | User’s email address or id to whom the comment should belong. This parameter is ignored in case of the login method to authenticate is used. (USER token) |
| `attachments` | `object` | No | Attachment to add on the comment |
| `activityId` | `number` | No | Activity's id to set on the comment |

> [accordion] attachments full type
>
> ```ts theme={null}
> {
>   filename: string,
>   contentType: string,
>   base64: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `content` | `string \| null` | No | — |
| `commented_item` | `object \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `attachments` | `any[] \| null` | No | — |
| `activity_id` | `any \| null` | No | — |
| `is_pinned` | `boolean \| null` | No | — |
| `raw_content` | `string \| null` | No | — |
| `extended_info` | `any \| null` | No | — |
| `reactions` | `any[] \| null` | No | — |
| `user` | `object \| null` | No | — |

> [accordion] commented\_item full type
>
> ```ts theme={null}
> {
>   item?: string | null,
>   id?: number | string | null
> } | null
> ```

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null
> } | null
> ```

***

### createLead

`prospects.createLead`

Create a lead from a prospect and associate the new lead created to the prospect in the prospecting list

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.prospects.createLead({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spreadsheetId` | `number` | Yes | Prospecting list's identifier. |
| `id` | `number` | Yes | Prospect's identifier. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `pipeline` | `any \| null` | No | — |
| `step` | `string \| null` | No | — |
| `step_id` | `number \| string \| null` | No | — |
| `status` | `string \| null` | No | — |
| `amount` | `number \| string \| null` | No | — |
| `probability` | `number \| string \| null` | No | — |
| `currency` | `string \| null` | No | — |
| `starred` | `boolean \| null` | No | — |
| `next_action_at` | `string \| null` | No | — |
| `remind_date` | `any \| null` | No | — |
| `remind_time` | `any \| null` | No | — |
| `reminder_at` | `any \| null` | No | — |
| `reminder_duration` | `any \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `estimated_closing_date` | `any \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `second_number` | `any \| null` | No | — |
| `amount_percentage` | `any \| null` | No | — |
| `reminder_activity_id` | `any \| null` | No | — |
| `reminder_activity_log_id` | `any \| null` | No | — |
| `reminder_note` | `string \| null` | No | — |
| `comment_count` | `number \| string \| null` | No | — |
| `closed_at` | `any \| null` | No | — |
| `description` | `string \| null` | No | — |
| `html_description` | `string \| null` | No | — |
| `tags` | `(string \| null)[] \| null` | No | — |
| `created_from` | `string \| null` | No | — |
| `created_by_id` | `number \| string \| null` | No | — |
| `user_id` | `number \| string \| null` | No | — |
| `team_id` | `any \| null` | No | — |
| `client_folder_id` | `any \| null` | No | — |
| `client_folder_name` | `any \| null` | No | — |
| `attachment_count` | `number \| string \| null` | No | — |
| `extended_info` | `object \| null` | No | — |

> [accordion] extended\_info full type
>
> ```ts theme={null}
> {
>   first_contact_email?: string | null,
>   all_contact_emails?: (string | null)[] | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: string | null,
>     address?: string | null,
>     web?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: string | null,
>     job?: string | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   fields_by_name?: {
>     Firstname?: string | null,
>     Lastname?: string | null,
>     Full name?: string | null,
>     Email?: string | null,
>     Phone?: string | null,
>     Mobile?: string | null,
>     Address?: string | null,
>     Web?: string | null,
>     Department?: string | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: any | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   client_folder?: any | null,
>   created_by?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     mobile_phone?: string | null
>   } | null,
>   business_card_id?: any | null,
>   visible_by_count?: number | string | null,
>   follow_ups?: any[] | null
> } | null
> ```

***

### delete

`prospects.delete`

Delete a prospect in a prospecting list.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.prospects.delete({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spreadsheetId` | `number` | Yes | Prospecting list's identifier. |
| `id` | `number` | Yes | Prospect's identifier. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |

***

### find

`prospects.find`

Find prospects by email or by field.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.prospects.find({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `email` | `string` | No | Email address in the column of the prospect. |
| `fieldKey` | `string` | No | Field name entered as column for the prospect. It has to be used with the field\_value parameter. |
| `fieldValue` | `string` | No | Field value corresponding to the field\_key parameter. Return the prospects containing this value in the field\_key. It has to be used with the field\_key parameter |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lead_id?: any | null,
>   is_active?: boolean | null,
>   content?: (string | null)[] | null,
>   spreadsheet_id?: number | string | null
> }[]
> ```

***

### findCalled

`prospects.findCalled`

List all prospects called with the specified phone number from the noCRM application. All prospects called outside of noCRM are not retrieved.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.prospects.findCalled({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `phoneNumber` | `string` | Yes | The phone number which has been called from a prospect. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lead_id?: any | null,
>   is_active?: boolean | null,
>   content?: (string | null)[] | null,
>   spreadsheet_id?: number | string | null
> }[]
> ```

***

### logCall

`prospects.logCall`

Create a call on a prospect. This endpoint is only available for registered integrations. You must pass an HTTP header X-API-PARTNER-KEY with a partner public key. Registered noCRM partner integrations only: needs the partnerKey option (sent as X-API-PARTNER-KEY). Deprecated by noCRM and due to be removed.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.prospects.logCall({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spreadsheetId` | `number` | Yes | Prospecting list's identifier. |
| `id` | `number` | Yes | Prospect's id. The identifier of the prospect (present in url). |
| `calledNumber` | `string` | No | The phone number called. This parameter is required in case of outbound call |
| `fromNumber` | `string` | No | The phone number who initiated the call. This parameter is required in case of inbound call |
| `direction` | `inbound \| outbound` | Yes | Must be inbound or outbound |
| `userId` | `number \| string` | No | User’s email address or id to whom the call should belong. |
| `startedAt` | `string` | No | Date of call's start with the following format: YYYY-MM-DD HH:MM:SS in the time zone of the account and the time in 24h format. The time can also be in UTC with this specific format: YYYY-MM-DDTHH:MM:SS.sssZ. Warning : started\_at \< ended\_at |
| `endedAt` | `string` | No | Date of call's end with the following format: YYYY-MM-DD HH:MM:SS in the time zone of the account and the time in 24h format. The time can also be in UTC with this specific format: YYYY-MM-DDTHH:MM:SS.sssZ. Warning : started\_at \< ended\_at |
| `recordLink` | `string` | No | Link to the record |
| `extCallKey` | `string` | No | Call ID from the partner side |
| `feedback` | `string` | No | A text that the customer could fill up to have feedback on the call and might add insight regarding the call |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `ext_call_key` | `string \| null` | No | — |
| `provider` | `string \| null` | No | — |
| `direction` | `string \| null` | No | — |
| `called_number` | `string \| null` | No | — |
| `from_number` | `string \| null` | No | — |
| `record_link` | `string \| null` | No | — |
| `started_at` | `string \| null` | No | — |
| `ended_at` | `string \| null` | No | — |
| `sent_at` | `any \| null` | No | — |
| `duration` | `number \| string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `kind` | `string \| null` | No | — |
| `user` | `object \| null` | No | — |
| `called_item` | `object \| null` | No | — |
| `comment` | `object \| null` | No | — |
| `text_content` | `any \| null` | No | — |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null
> } | null
> ```

> [accordion] called\_item full type
>
> ```ts theme={null}
> {
>   item?: string | null,
>   id?: number | string | null
> } | null
> ```

> [accordion] comment full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   content?: string | null,
>   activity_id?: number | string | null,
>   is_pinned?: boolean | null
> } | null
> ```

***

### update

`prospects.update`

Update a prospect in a prospecting list.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.prospects.update({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spreadsheetId` | `number` | Yes | Prospecting list's identifier. |
| `id` | `number` | Yes | Prospect's identifier. |
| `content` | `(string \| number \| null)[]` | Yes | Content of the prospect as a json string corresponding of an array of data. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `lead_id` | `any \| null` | No | — |
| `is_active` | `boolean \| null` | No | — |
| `content` | `(string \| null)[] \| null` | No | — |

***

### updateComment

`prospects.updateComment`

Update a comment on a prospect

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.prospects.updateComment({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spreadsheetId` | `number` | Yes | Spreadsheet id. |
| `prospectId` | `number` | Yes | Prospect id. |
| `id` | `number` | Yes | Id. |
| `content` | `string` | Yes | Replace existing content |
| `activityId` | `number` | No | Activity's id to set on the comment |
| `isPinned` | `boolean` | No | Pinned the comment |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `content` | `string \| null` | No | — |
| `commented_item` | `object \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `attachments` | `any[] \| null` | No | — |
| `activity_id` | `number \| string \| null` | No | — |
| `is_pinned` | `boolean \| null` | No | — |
| `raw_content` | `string \| null` | No | — |
| `extended_info` | `any \| null` | No | — |
| `reactions` | `any[] \| null` | No | — |
| `user` | `object \| null` | No | — |
| `activity` | `object \| null` | No | — |

> [accordion] commented\_item full type
>
> ```ts theme={null}
> {
>   item?: string | null,
>   id?: number | string | null
> } | null
> ```

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null
> } | null
> ```

> [accordion] activity full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   kind?: string | null,
>   duration?: any | null,
>   icon?: string | null,
>   color?: string | null,
>   created_at?: string | null,
>   is_outcome?: boolean | null
> } | null
> ```

***

### updateFields

`prospects.updateFields`

Update fields on a prospect in a prospecting list.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.prospects.updateFields({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spreadsheetId` | `number` | Yes | Prospecting list's identifier. |
| `id` | `number` | Yes | Prospect's identifier. |
| `fields` | `Record<string, any>` | Yes | Fields to update on the prospect, as a JSON hash turned into a string. Each key corresponding to a column's name of the prospecting list. |

PUT .../rows/\{id}/update\_fields with fields keyed by column name; unknown names answer 422 "Columns not found".

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `lead_id` | `any \| null` | No | — |
| `is_active` | `boolean \| null` | No | — |
| `content` | `(string \| null)[] \| null` | No | — |

***

## Steps

### get

`steps.get`

Retrieve a step previously created with its id.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.steps.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string` | Yes | Step's id or step's name. The identifier of the step that could be its id or its name. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `position` | `number \| string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `pipeline_id` | `number \| string \| null` | No | — |
| `pipeline` | `object \| null` | No | — |

> [accordion] pipeline full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   is_default?: boolean | null,
>   created_at?: string | null,
>   updated_at?: string | null
> } | null
> ```

***

### list

`steps.list`

Return the list of steps, previously created in your account. The steps are returned ordered by their position.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.steps.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `direction` | `asc \| desc` | No | Return data order by their position in ascending or descending. The value should be asc or desc. Default: asc. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   position?: number | string | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   pipeline_id?: number | string | null,
>   pipeline?: {
>     id?: number | string | null,
>     name?: string | null,
>     is_default?: boolean | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   } | null
> }[]
> ```

***

## Teams

### addMember

`teams.addMember`

Add a team member or change the manager role for the specified user. When using the USER TOKEN authentication, only admin users can add a member to a team.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.teams.addMember({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The id of the team |
| `userId` | `number \| string` | Yes | User’s email address or id to add. |
| `isManager` | `boolean` | No | True if the user should be manager of the team. Default: false. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `users` | `object[] \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |

> [accordion] users full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   is_manager?: boolean | null
> }[] | null
> ```

***

### create

`teams.create`

Create a team with the specified name. When using the USER TOKEN authentication, only admin users can create a team.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.teams.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | The name of the team |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `users` | `any[] \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |

***

### delete

`teams.delete`

Delete the team specified by its id. When using the USER TOKEN authentication, only admin users can delete a team.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.teams.delete({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The id of the team |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |

***

### get

`teams.get`

Retrieve a specific team from its id. When using the USER TOKEN authentication, only admin users can retrieve a team.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.teams.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string` | Yes | The id or name of the team to retrieve. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `users` | `object[] \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |

> [accordion] users full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   is_manager?: boolean | null
> }[] | null
> ```

***

### list

`teams.list`

List all the teams created in the account.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.teams.list({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   name?: string | null,
>   users?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null,
>     is_manager?: boolean | null
>   }[] | null,
>   updated_at?: string | null,
>   created_at?: string | null
> }[]
> ```

***

### removeMember

`teams.removeMember`

Remove a team member. When using the USER TOKEN authentication, only admin users can remove a member from a team. The user stays on the account.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.teams.removeMember({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The id of the team |
| `userId` | `number \| string` | Yes | User’s email address or id to remove. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `users` | `any[] \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |

***

### update

`teams.update`

Update the team by updating its name. When using the USER TOKEN authentication, only admin users can update a team.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.teams.update({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The id of the team |
| `name` | `string` | Yes | The new team's name |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `users` | `object[] \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |

> [accordion] users full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   is_manager?: boolean | null
> }[] | null
> ```

***

## Users

### create

`users.create`

Create a user with the specified information of lastname, firstname and email. By default, the activation email is not sent to the user. If the user has to receive the email when he/she is created, the option dont\_send\_email has to be specified to false. When using the USER token, if the user logged is not an administrator of the account, he/she won't be allowed to create a user. Adds a seat to the account (billed on paid plans). dontSendEmail false emails the new user.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.users.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `email` | `string` | Yes | The email of the user |
| `lastname` | `string` | No | The lastname of the user |
| `firstname` | `string` | No | The firstname of the user |
| `isAdmin` | `boolean` | No | true if the user should be administrator of the account. Default: false. |
| `dontSendEmail` | `boolean` | No | false if the user has to receive his/her activation email when he/she is created. Default: true. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `lastname` | `string \| null` | No | — |
| `firstname` | `string \| null` | No | — |
| `email` | `string \| null` | No | — |
| `phone` | `string \| null` | No | — |
| `mobile_phone` | `string \| null` | No | — |
| `job_title` | `string \| null` | No | — |
| `im_type` | `string \| null` | No | — |
| `im` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `is_admin` | `boolean \| null` | No | — |
| `has_activated` | `boolean \| null` | No | — |
| `is_disabled` | `boolean \| null` | No | — |
| `locale` | `string \| null` | No | — |
| `time_zone` | `string \| null` | No | — |
| `permalink` | `string \| null` | No | — |
| `avatar_url` | `any \| null` | No | — |

***

### disable

`users.disable`

Disable the specific user from the account. The user won't be able to connect anymore to the account. No data will be lost. Note: Even after disabling the user, a new user with the same email address cannot be created. The support has to be contacted to re-enable the disabled user. When using the USER authentication, only admin users can disable a user. There is no API route to enable the user again.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.users.disable({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string` | Yes | The id of the user |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `lastname` | `string \| null` | No | — |
| `firstname` | `string \| null` | No | — |
| `email` | `string \| null` | No | — |
| `phone` | `string \| null` | No | — |
| `mobile_phone` | `string \| null` | No | — |
| `job_title` | `string \| null` | No | — |
| `im_type` | `string \| null` | No | — |
| `im` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `is_admin` | `boolean \| null` | No | — |
| `has_activated` | `boolean \| null` | No | — |
| `is_disabled` | `boolean \| null` | No | — |
| `locale` | `string \| null` | No | — |
| `time_zone` | `string \| null` | No | — |
| `permalink` | `string \| null` | No | — |
| `avatar_url` | `any \| null` | No | — |

***

### get

`users.get`

Retrieve a specific user from its id.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.users.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string` | Yes | The id of the user or its email address. Make sure to encode the email address properly. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `lastname` | `string \| null` | No | — |
| `firstname` | `string \| null` | No | — |
| `email` | `string \| null` | No | — |
| `phone` | `string \| null` | No | — |
| `mobile_phone` | `string \| null` | No | — |
| `job_title` | `string \| null` | No | — |
| `im_type` | `string \| null` | No | — |
| `im` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `is_admin` | `boolean \| null` | No | — |
| `has_activated` | `boolean \| null` | No | — |
| `is_disabled` | `boolean \| null` | No | — |
| `locale` | `string \| null` | No | — |
| `time_zone` | `string \| null` | No | — |
| `permalink` | `string \| null` | No | — |
| `avatar_url` | `any \| null` | No | — |

***

### list

`users.list`

Retrieve all the users created in the account. The deleted users are retrieved too. Their state, is\_disabled, is set to true in their case. The users could be in different state.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.users.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `email` | `string` | No | The email address of the user |
| `lastname` | `string` | No | The lastname of the user |
| `firstname` | `string` | No | The firstname of the user |
| `status` | `string` | No | The status of the users, one of all, activated or deactivated Default: all. |
| `direction` | `asc \| desc` | No | Direction of data returned sorted out by ids. The value should be asc or desc Default: asc. |
| `role` | `all \| admin \| non-admin` | No | The role of the users to return, one of all, admin, non-admin Default: all. |
| `teams` | `string[]` | No | Array of the ids or names of the teams the users belong to |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   lastname?: string | null,
>   firstname?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   mobile_phone?: string | null,
>   job_title?: string | null,
>   im_type?: string | null,
>   im?: string | null,
>   updated_at?: string | null,
>   created_at?: string | null,
>   is_admin?: boolean | null,
>   has_activated?: boolean | null,
>   is_disabled?: boolean | null,
>   locale?: string | null,
>   time_zone?: string | null,
>   permalink?: string | null,
>   avatar_url?: string | null
> }[]
> ```

***

### sendActivationEmail

`users.sendActivationEmail`

Send the activation email of the specific user in order for him/her to access the account. When using the USER authentication, only admin users can send the activation email. Emails the user an activation link.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.users.sendActivationEmail({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string` | Yes | The id of the user |

**Output:** `any`

***

## Webhook Events

### get

`webhookEvents.get`

Retrieve a specific event from its id. This request is only available for admin users.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.webhookEvents.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The id of the webhook event |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `event` | `string \| null` | No | — |
| `signature` | `string \| null` | No | — |
| `has_succeeded` | `boolean \| null` | No | — |
| `try_count` | `number \| string \| null` | No | — |
| `last_returned_code` | `number \| string \| null` | No | — |
| `data` | `object \| null` | No | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   title?: string | null,
>   description?: string | null,
>   text_description?: string | null,
>   amount?: number | string | null,
>   currency?: string | null,
>   probability?: number | string | null,
>   reminder_at?: any | null,
>   reminder_duration?: any | null,
>   updated_at?: string | null,
>   created_at?: string | null,
>   starred?: any | null,
>   status?: string | null,
>   step?: string | null,
>   tags?: (string | null)[] | null,
>   first_contact_email?: string | null,
>   all_contact_emails?: (string | null)[] | null,
>   permalink?: string | null,
>   fields?: {
>     email?: string | null,
>     phone?: string | null,
>     mobile?: any | null,
>     address?: any | null,
>     web?: any | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     full_name?: any | null,
>     job?: any | null,
>     fax?: any | null,
>     vat?: any | null
>   } | null,
>   comment_count?: number | string | null,
>   bcc_count?: number | string | null,
>   team?: {
>     id?: number | string | null,
>     name?: string | null,
>     users?: Record<string, any>[] | null,
>     updated_at?: string | null,
>     created_at?: string | null
>   } | null,
>   user?: {
>     id?: number | string | null,
>     lastname?: string | null,
>     firstname?: string | null,
>     email?: string | null
>   } | null,
>   client_folder?: {
>     id?: number | string | null,
>     name?: string | null,
>     description?: string | null,
>     is_active?: boolean | null,
>     created_at?: string | null
>   } | null
> } | null
> ```

***

### list

`webhookEvents.list`

Return the list of all events already sent, going back up to 10 days. This request is only available for admin users.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.webhookEvents.list({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   event?: string | null,
>   signature?: string | null,
>   has_succeeded?: boolean | null,
>   try_count?: number | string | null,
>   last_returned_code?: number | string | null,
>   data?: {
>     id?: number | string | null,
>     title?: string | null,
>     description?: string | null,
>     text_description?: string | null,
>     amount?: number | string | null,
>     currency?: string | null,
>     probability?: number | string | null,
>     reminder_at?: any | null,
>     reminder_duration?: any | null,
>     updated_at?: string | null,
>     created_at?: string | null,
>     starred?: boolean | null,
>     status?: string | null,
>     step?: string | null,
>     tags?: (string | null)[] | null,
>     contact_email?: string | null,
>     first_contact_email?: string | null,
>     all_contact_emails?: (string | null)[] | null,
>     permalink?: string | null,
>     fields?: {
>       email?: string | null,
>       phone?: any | null,
>       mobile?: string | null,
>       address?: any | null,
>       web?: any | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       full_name?: string | null,
>       job?: any | null,
>       fax?: any | null,
>       vat?: any | null
>     } | null,
>     comment_count?: number | string | null,
>     bcc_count?: number | string | null,
>     team?: {
>       id?: number | string | null,
>       name?: string | null,
>       users?: Record<string, any>[] | null,
>       updated_at?: string | null,
>       created_at?: string | null
>     } | null,
>     user?: {
>       id?: number | string | null,
>       lastname?: string | null,
>       firstname?: string | null,
>       email?: string | null
>     } | null,
>     client_folder?: any | null
>   } | null
> }[]
> ```

***

## Webhooks

### activate

`webhooks.activate`

Activate the webhook specified by its id.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.webhooks.activate({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The id of the webhook |

**Output:** `any`

***

### create

`webhooks.create`

Create a webhook or a notification in the account.

**Risk:** `write`

```ts theme={null}
await corsair.nocrm.api.webhooks.create({ event: 'lead.status.changed.to.won', targetType: 'url', target: 'https://example.com/nocrm' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `event` | `string` | Yes | Event name to subscribe. The list of event depends on your edition, some events are only available in advanced features. |
| `targetType` | `string` | Yes | Kind of webhook you want to create. Can be url (webhook) or email (notification). |
| `target` | `string` | Yes | A url in case of webhook or an email address in case of notification |
| `name` | `string` | No | Name of the webhook |
| `addToLeadActionMenu` | `boolean` | No | Only application for the event lead.manual.trigger to add the webhook as an action menu automatically |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |
| `event` | `string \| null` | No | — |
| `target` | `string \| null` | No | — |
| `target_type` | `string \| null` | No | — |
| `params` | `any \| null` | No | — |
| `name` | `string \| null` | No | — |

***

### disable

`webhooks.disable`

Disable the webhook specified by its id. DELETE /api/v2/webhooks/\{id}; webhooks.activate turns it back on.

**Risk:** `destructive`

```ts theme={null}
await corsair.nocrm.api.webhooks.disable({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The id of the webhook |

DELETE /api/v2/webhooks/\{id}. webhooks.activate turns it back on.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number \| string \| null` | No | — |

***

### list

`webhooks.list`

Retrieve all the webhooks and notifications created in the account.

**Risk:** `read`

```ts theme={null}
await corsair.nocrm.api.webhooks.list({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: number | string | null,
>   event?: string | null,
>   target?: string | null,
>   target_type?: string | null,
>   params?: any | null,
>   name?: string | null,
>   is_disabled?: boolean | null
> }[]
> ```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.