> ## 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.

# API

> API reference for PhantomBuster: every `phantombuster.api.*` operation with input and output types.

Every `phantombuster.api.*` operation is listed below with parameter shapes and return types from the plugin Zod schemas.

<Info>
  **New to Corsair?** See [API access](/concepts/api), [authentication](/concepts/auth), and [error handling](/concepts/error-handling).
</Info>

## Agents

### delete

`agents.delete`

Delete a PhantomBuster agent by ID

**Risk:** `destructive`

```ts theme={null}
await corsair.phantombuster.api.agents.delete({});
```

**Input**

| Name | Type     | Required | Description |
| ---- | -------- | -------- | ----------- |
| `id` | `string` | Yes      | —           |

**Output:** *empty object*

***

### fetch

`agents.fetch`

Get details for a specific PhantomBuster agent by ID

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.agents.fetch({});
```

**Input**

| Name | Type     | Required | Description |
| ---- | -------- | -------- | ----------- |
| `id` | `string` | Yes      | —           |

**Output**

| Name            | Type                                                                                                | Required | Description |
| --------------- | --------------------------------------------------------------------------------------------------- | -------- | ----------- |
| `id`            | `string`                                                                                            | Yes      | —           |
| `scriptOrgName` | `string`                                                                                            | No       | —           |
| `scriptId`      | `string`                                                                                            | No       | —           |
| `script`        | `string`                                                                                            | No       | —           |
| `branch`        | `string`                                                                                            | No       | —           |
| `environment`   | `staging \| release`                                                                                | No       | —           |
| `argument`      | `string`                                                                                            | No       | —           |
| `lastEndType`   | `finished \| killed \| global timeout \| org timeout \| agent timeout \| unknown \| no log timeout` | No       | —           |

***

### fetchAll

`agents.fetchAll`

Get all PhantomBuster agents (Phantoms) in the organization

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.agents.fetchAll({});
```

**Input:** *empty object*

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      name?: string | null,
      scriptId?: string | null,
      scriptName?: string | null,
      status?: idle | running | launching | error,
      nbLaunches?: number,
      fileMgmt?: string,
      fileMgmtValue?: number,
      launchType?: string,
      launchTimes?: string[],
      launchTimezone?: string | null,
      cronString?: string | null,
      loadChrome?: boolean,
      disableWebSecurity?: boolean,
      ignoreSslErrors?: boolean,
      argument?: string | {
      },
      createdAt?: string,
      updatedAt?: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### fetchDeleted

`agents.fetchDeleted`

Get all deleted agents in the organization

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.agents.fetchDeleted({});
```

**Input:** *empty object*

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      name?: string | null,
      createdAt: number,
      deletedAt: number,
      deletedBy?: string | null,
      nbContainersRunning: number
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### fetchOutput

`agents.fetchOutput`

Get the output of the most recent container for an agent, including status, progress, console log, and result object

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.agents.fetchOutput({});
```

**Input**

| Name                    | Type                                                                           | Required | Description |
| ----------------------- | ------------------------------------------------------------------------------ | -------- | ----------- |
| `id`                    | `string`                                                                       | Yes      | —           |
| `fromOutputPos`         | `number`                                                                       | No       | —           |
| `prevContainerId`       | `string`                                                                       | No       | —           |
| `prevStatus`            | `starting \| running \| finished \| unknown \| launch error \| never launched` | No       | —           |
| `prevRuntimeEventIndex` | `number`                                                                       | No       | —           |

**Output**

| Name                | Type                                                                           | Required | Description |
| ------------------- | ------------------------------------------------------------------------------ | -------- | ----------- |
| `containerId`       | `string`                                                                       | No       | —           |
| `status`            | `starting \| running \| finished \| unknown \| launch error \| never launched` | Yes      | —           |
| `output`            | `string`                                                                       | No       | —           |
| `outputPos`         | `number`                                                                       | No       | —           |
| `mostRecentEndedAt` | `number`                                                                       | No       | —           |
| `progress`          | `number`                                                                       | No       | —           |
| `progressLabel`     | `string`                                                                       | No       | —           |
| `isAgentRunning`    | `boolean`                                                                      | Yes      | —           |
| `canSoftAbort`      | `boolean`                                                                      | Yes      | —           |

***

### launch

`agents.launch`

Add a PhantomBuster agent to the launch queue

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.agents.launch({});
```

**Input**

| Name               | Type      | Required | Description |
| ------------------ | --------- | -------- | ----------- |
| `id`               | `string`  | Yes      | —           |
| `argument`         | `object`  | No       | —           |
| `arguments`        | `object`  | No       | —           |
| `bonusArgument`    | `object`  | No       | —           |
| `saveArgument`     | `boolean` | No       | —           |
| `saveArguments`    | `boolean` | No       | —           |
| `manualLaunch`     | `boolean` | No       | —           |
| `maxInstanceCount` | `number`  | No       | —           |

<AccordionGroup>
  <Accordion title="argument full type">
    ```ts theme={null}
    string | {
    }
    ```
  </Accordion>

  <Accordion title="arguments full type">
    ```ts theme={null}
    string | {
    }
    ```
  </Accordion>

  <Accordion title="bonusArgument full type">
    ```ts theme={null}
    string | {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name          | Type     | Required | Description |
| ------------- | -------- | -------- | ----------- |
| `containerId` | `string` | No       | —           |

***

### launchSoon

`agents.launchSoon`

Schedule a PhantomBuster agent to launch before a specific time

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.agents.launchSoon({});
```

**Input**

| Name            | Type      | Required | Description |
| --------------- | --------- | -------- | ----------- |
| `id`            | `string`  | Yes      | —           |
| `minutes`       | `number`  | Yes      | —           |
| `argument`      | `object`  | No       | —           |
| `arguments`     | `object`  | No       | —           |
| `saveArgument`  | `boolean` | No       | —           |
| `saveArguments` | `boolean` | No       | —           |

<AccordionGroup>
  <Accordion title="argument full type">
    ```ts theme={null}
    string | {
    }
    ```
  </Accordion>

  <Accordion title="arguments full type">
    ```ts theme={null}
    string | {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output:** *empty object*

***

### save

`agents.save`

Create a new agent or update an existing one

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.agents.save({});
```

**Input**

| Name                 | Type                                            | Required | Description |
| -------------------- | ----------------------------------------------- | -------- | ----------- |
| `id`                 | `string`                                        | No       | —           |
| `name`               | `string`                                        | No       | —           |
| `org`                | `string`                                        | No       | —           |
| `script`             | `string`                                        | No       | —           |
| `branch`             | `string`                                        | No       | —           |
| `environment`        | `staging \| release`                            | No       | —           |
| `argument`           | `object`                                        | No       | —           |
| `launchType`         | `manually \| repeatedly \| once \| after agent` | No       | —           |
| `launchTimes`        | `string[]`                                      | No       | —           |
| `launchTimezone`     | `string`                                        | No       | —           |
| `cronString`         | `string`                                        | No       | —           |
| `fileMgmt`           | `folders \| mix \| delete`                      | No       | —           |
| `fileMgmtValue`      | `number`                                        | No       | —           |
| `loadChrome`         | `boolean`                                       | No       | —           |
| `disableWebSecurity` | `boolean`                                       | No       | —           |
| `ignoreSslErrors`    | `boolean`                                       | No       | —           |

<AccordionGroup>
  <Accordion title="argument full type">
    ```ts theme={null}
    string | {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name | Type     | Required | Description |
| ---- | -------- | -------- | ----------- |
| `id` | `string` | Yes      | —           |

***

### stop

`agents.stop`

Stop a currently running PhantomBuster agent

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.agents.stop({});
```

**Input**

| Name                   | Type      | Required | Description |
| ---------------------- | --------- | -------- | ----------- |
| `id`                   | `string`  | Yes      | —           |
| `softAbort`            | `boolean` | No       | —           |
| `cascadeToAllSlaves`   | `boolean` | No       | —           |
| `dontLaunchSoon`       | `boolean` | No       | —           |
| `switchToManualLaunch` | `boolean` | No       | —           |

**Output**

| Name          | Type     | Required | Description |
| ------------- | -------- | -------- | ----------- |
| `containerId` | `string` | No       | —           |

***

### unscheduleAll

`agents.unscheduleAll`

Disable automatic launch for all agents in the organization

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.agents.unscheduleAll({});
```

**Input:** *empty object*

**Output:** *empty object*

***

## Branches

### create

`branches.create`

Create a new branch

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.branches.create({});
```

**Input**

| Name   | Type     | Required | Description |
| ------ | -------- | -------- | ----------- |
| `name` | `string` | Yes      | —           |

**Output**

| Name   | Type     | Required | Description |
| ------ | -------- | -------- | ----------- |
| `id`   | `string` | Yes      | —           |
| `name` | `string` | Yes      | —           |

***

### delete

`branches.delete`

Delete a branch by ID

**Risk:** `destructive`

```ts theme={null}
await corsair.phantombuster.api.branches.delete({});
```

**Input**

| Name | Type     | Required | Description |
| ---- | -------- | -------- | ----------- |
| `id` | `string` | Yes      | —           |

**Output:** *empty object*

***

### fetchAll

`branches.fetchAll`

Fetch all branches in the organization

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.branches.fetchAll({});
```

**Input:** *empty object*

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      name: string,
      created_at: number
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### fetchDiff

`branches.fetchDiff`

Get the staging/release diff for script branches

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.branches.fetchDiff({});
```

**Input**

| Name   | Type     | Required | Description |
| ------ | -------- | -------- | ----------- |
| `name` | `string` | Yes      | —           |

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      name: string,
      diffLength: number,
      stagingVisibility: private | semi public | public | semi open source | open source,
      releaseVisibility?: private | semi public | public | semi open source | open source,
      stagingAccessList?: string[] | null,
      releaseAccessList?: string[] | null
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### release

`branches.release`

Release a script branch

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.branches.release({});
```

**Input**

| Name        | Type       | Required | Description |
| ----------- | ---------- | -------- | ----------- |
| `name`      | `string`   | Yes      | —           |
| `scriptIds` | `string[]` | Yes      | —           |

**Output:** *empty object*

***

## Containers

### fetch

`containers.fetch`

Get details for a specific run container by ID

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.containers.fetch({});
```

**Input**

| Name                           | Type     | Required | Description |
| ------------------------------ | -------- | -------- | ----------- |
| `id`                           | `string` | Yes      | —           |
| `withResultObject`             | `string` | No       | —           |
| `withOutput`                   | `string` | No       | —           |
| `withRuntimeEvents`            | `string` | No       | —           |
| `withNewerAndOlderContainerId` | `string` | No       | —           |

**Output**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `id`           | `string` | Yes      | —           |
| `agentId`      | `string` | No       | —           |
| `status`       | `string` | No       | —           |
| `exitCode`     | `number` | No       | —           |
| `duration`     | `number` | No       | —           |
| `startTime`    | `number` | No       | —           |
| `endTime`      | `number` | No       | —           |
| `output`       | `string` | No       | —           |
| `resultObject` | `string` | No       | —           |

***

### fetchAll

`containers.fetchAll`

Get all run containers for a specific agent

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.containers.fetchAll({});
```

**Input**

| Name                | Type               | Required | Description |
| ------------------- | ------------------ | -------- | ----------- |
| `agentId`           | `string`           | Yes      | —           |
| `beforeEndedAt`     | `string`           | No       | —           |
| `limit`             | `string`           | No       | —           |
| `mode`              | `all \| finalized` | No       | —           |
| `withRuntimeEvents` | `string`           | No       | —           |

**Output**

| Name              | Type       | Required | Description |
| ----------------- | ---------- | -------- | ----------- |
| `maxLimitReached` | `boolean`  | Yes      | —           |
| `containers`      | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="containers full type">
    ```ts theme={null}
    {
      id: string,
      agentId?: string,
      status?: string,
      exitCode?: number | null,
      duration?: number | null,
      startTime?: number | null,
      endTime?: number | null,
      output?: string | null,
      resultObject?: string | null
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### fetchOutput

`containers.fetchOutput`

Get the console output for a specific container

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.containers.fetchOutput({});
```

**Input**

| Name   | Type          | Required | Description |
| ------ | ------------- | -------- | ----------- |
| `id`   | `string`      | Yes      | —           |
| `mode` | `json \| raw` | No       | —           |

**Output**

| Name     | Type     | Required | Description |
| -------- | -------- | -------- | ----------- |
| `output` | `string` | No       | —           |

***

### fetchResultObject

`containers.fetchResultObject`

Get the result object (JSON data) from a specific container

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.containers.fetchResultObject({});
```

**Input**

| Name | Type     | Required | Description |
| ---- | -------- | -------- | ----------- |
| `id` | `string` | Yes      | —           |

**Output**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `resultObject` | `string` | No       | —           |

***

## Identities

### generateToken

`identities.generateToken`

Generate an identity token

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.identities.generateToken({});
```

**Input:** *empty object*

**Output**

| Name    | Type     | Required | Description |
| ------- | -------- | -------- | ----------- |
| `token` | `string` | No       | —           |

***

### saveEvent

`identities.saveEvent`

Save an identity event

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.identities.saveEvent({});
```

**Input**

| Name            | Type     | Required | Description |
| --------------- | -------- | -------- | ----------- |
| `identity_type` | `string` | Yes      | —           |
| `profile_id`    | `string` | Yes      | —           |
| `event_type`    | `string` | Yes      | —           |
| `event_data`    | `object` | Yes      | —           |
| `timestamp`     | `number` | No       | —           |

<AccordionGroup>
  <Accordion title="event_data full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output:** *empty object*

***

## Leads

### deleteMany

`leads.deleteMany`

Delete multiple leads by their IDs

**Risk:** `destructive`

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

**Input**

| Name  | Type       | Required | Description |
| ----- | ---------- | -------- | ----------- |
| `ids` | `string[]` | Yes      | —           |

**Output**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `deletedCount` | `number` | Yes      | —           |

***

### fetchByList

`leads.fetchByList`

Fetch leads belonging to a specific lead list

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.leads.fetchByList({});
```

**Input**

| Name                     | Type       | Required | Description |
| ------------------------ | ---------- | -------- | ----------- |
| `listId`                 | `string`   | Yes      | —           |
| `paginationOptions`      | `object`   | No       | —           |
| `withLeadObjectsOfTypes` | `string[]` | No       | —           |
| `withCompanies`          | `boolean`  | No       | —           |

<AccordionGroup>
  <Accordion title="paginationOptions full type">
    ```ts theme={null}
    {
      paginationOrder?: ASC | DESC,
      paginationSize?: number,
      paginationOffset?: number,
      paginationProperty?: string,
      includeTotalCount?: boolean
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name         | Type       | Required | Description |
| ------------ | ---------- | -------- | ----------- |
| `leads`      | `object[]` | Yes      | —           |
| `totalCount` | `number`   | No       | —           |

<AccordionGroup>
  <Accordion title="leads full type">
    ```ts theme={null}
    {
      linkedinProfileUrl: string,
      firstName?: string,
      lastName?: string,
      companyName?: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### save

`leads.save`

Save a single lead to PhantomBuster org storage

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.leads.save({});
```

**Input**

| Name   | Type     | Required | Description |
| ------ | -------- | -------- | ----------- |
| `lead` | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="lead full type">
    ```ts theme={null}
    {
      linkedinProfileUrl: string,
      firstName?: string,
      lastName?: string,
      companyName?: string
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name                  | Type      | Required | Description |
| --------------------- | --------- | -------- | ----------- |
| `id`                  | `string`  | No       | —           |
| `linkedinProfileSlug` | `string`  | No       | —           |
| `isCreation`          | `boolean` | No       | —           |

***

### saveMany

`leads.saveMany`

Bulk-save multiple leads to PhantomBuster org storage

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.leads.saveMany({});
```

**Input**

| Name    | Type       | Required | Description |
| ------- | ---------- | -------- | ----------- |
| `leads` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="leads full type">
    ```ts theme={null}
    {
      linkedinProfileUrl: string,
      firstName?: string,
      lastName?: string,
      companyName?: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    (
      {
        linkedinProfileUrl: string,
        status: success,
        isCreation: boolean
      } | {
        linkedinProfileUrl: string,
        status: error,
        error: string
      }
    )[]
    ```
  </Accordion>
</AccordionGroup>

***

## Lists

### delete

`lists.delete`

Delete a lead list by ID

**Risk:** `destructive`

```ts theme={null}
await corsair.phantombuster.api.lists.delete({});
```

**Input**

| Name | Type     | Required | Description |
| ---- | -------- | -------- | ----------- |
| `id` | `string` | Yes      | —           |

**Output**

| Name | Type     | Required | Description |
| ---- | -------- | -------- | ----------- |
| `id` | `string` | Yes      | —           |

***

### fetch

`lists.fetch`

Get details for a specific lead list by ID

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.lists.fetch({});
```

**Input**

| Name | Type     | Required | Description |
| ---- | -------- | -------- | ----------- |
| `id` | `string` | Yes      | —           |

**Output**

| Name          | Type     | Required | Description |
| ------------- | -------- | -------- | ----------- |
| `id`          | `string` | Yes      | —           |
| `name`        | `string` | No       | —           |
| `description` | `string` | No       | —           |
| `totalLeads`  | `number` | No       | —           |
| `createdAt`   | `string` | No       | —           |
| `updatedAt`   | `string` | No       | —           |

***

### fetchAll

`lists.fetchAll`

Get all lead lists in the organization

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.lists.fetchAll({});
```

**Input:** *empty object*

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      name?: string,
      description?: string | null,
      totalLeads?: number,
      createdAt?: string,
      updatedAt?: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### save

`lists.save`

Create a new lead list or update an existing one

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.lists.save({});
```

**Input**

| Name          | Type     | Required | Description |
| ------------- | -------- | -------- | ----------- |
| `id`          | `string` | No       | —           |
| `name`        | `string` | Yes      | —           |
| `description` | `string` | No       | —           |

**Output**

| Name | Type     | Required | Description |
| ---- | -------- | -------- | ----------- |
| `id` | `string` | Yes      | —           |

***

## Misc

### fetchIpLocation

`misc.fetchIpLocation`

Retrieve the country of an IP address

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.misc.fetchIpLocation({});
```

**Input**

| Name | Type     | Required | Description |
| ---- | -------- | -------- | ----------- |
| `ip` | `string` | Yes      | —           |

**Output**

| Name      | Type     | Required | Description |
| --------- | -------- | -------- | ----------- |
| `country` | `string` | Yes      | —           |

***

### requestAiCompletion

`misc.requestAiCompletion`

Request a text completion from the AI module

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.misc.requestAiCompletion({});
```

**Input**

| Name          | Type                                                                        | Required | Description |
| ------------- | --------------------------------------------------------------------------- | -------- | ----------- |
| `messages`    | `object[]`                                                                  | Yes      | —           |
| `model`       | `gpt-35-turbo \| gpt-4 \| gpt-4o \| gpt-4o-mini \| gpt-4.1-mini \| gpt-5.1` | No       | —           |
| `temperature` | `number`                                                                    | No       | —           |

<AccordionGroup>
  <Accordion title="messages full type">
    ```ts theme={null}
    {
      role: system | assistant | user,
      content: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name          | Type       | Required | Description |
| ------------- | ---------- | -------- | ----------- |
| `choices`     | `string[]` | Yes      | —           |
| `creditsCost` | `number`   | Yes      | —           |

***

### solveHCaptcha

`misc.solveHCaptcha`

Solve an hCaptcha challenge

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.misc.solveHCaptcha({});
```

**Input**

| Name  | Type     | Required | Description |
| ----- | -------- | -------- | ----------- |
| `url` | `string` | Yes      | —           |
| `key` | `string` | Yes      | —           |

**Output**

| Name       | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `response` | `string` | Yes      | —           |

***

### solveRecaptcha

`misc.solveRecaptcha`

Solve a reCAPTCHA challenge (v2 or v3)

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.misc.solveRecaptcha({});
```

**Input**

| Name         | Type                | Required | Description |
| ------------ | ------------------- | -------- | ----------- |
| `url`        | `string`            | Yes      | —           |
| `key`        | `string`            | Yes      | —           |
| `type`       | `v2 \| v3`          | Yes      | —           |
| `minScore`   | `0.3 \| 0.7 \| 0.9` | No       | —           |
| `pageAction` | `string`            | No       | —           |
| `enterprise` | `boolean`           | No       | —           |

**Output**

| Name       | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `response` | `string` | Yes      | —           |

***

## Orgs

### exportAgentUsage

`orgs.exportAgentUsage`

Export agent usage CSV for the organization

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.orgs.exportAgentUsage({});
```

**Input**

| Name   | Type     | Required | Description |
| ------ | -------- | -------- | ----------- |
| `days` | `string` | Yes      | —           |

**Output:** `string`

***

### exportContainerUsage

`orgs.exportContainerUsage`

Export container usage CSV for the organization

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.orgs.exportContainerUsage({});
```

**Input**

| Name      | Type     | Required | Description |
| --------- | -------- | -------- | ----------- |
| `days`    | `string` | Yes      | —           |
| `agentId` | `string` | No       | —           |

**Output:** `string`

***

### fetch

`orgs.fetch`

Get the current organization info

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.orgs.fetch({});
```

**Input**

| Name                  | Type     | Required | Description |
| --------------------- | -------- | -------- | ----------- |
| `withGlobalObject`    | `string` | No       | —           |
| `withProxies`         | `string` | No       | —           |
| `withCrmIntegrations` | `string` | No       | —           |
| `withCustomPrompts`   | `string` | No       | —           |

**Output**

| Name   | Type     | Required | Description |
| ------ | -------- | -------- | ----------- |
| `id`   | `string` | No       | —           |
| `name` | `string` | No       | —           |

***

### fetchAgentGroups

`orgs.fetchAgentGroups`

Get agent groups and order for the organization

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.orgs.fetchAgentGroups({});
```

**Input:** *empty object*

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    (
      string | {
        id: string,
        name: string,
        agents: string[]
      }
    )[]
    ```
  </Accordion>
</AccordionGroup>

***

### fetchResources

`orgs.fetchResources`

Get the organization resource usage (slots, limits)

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.orgs.fetchResources({});
```

**Input:** *empty object*

**Output**

| Name                         | Type     | Required | Description |
| ---------------------------- | -------- | -------- | ----------- |
| `dailyExecutionTime`         | `number` | No       | —           |
| `dailyMail`                  | `number` | No       | —           |
| `dailyCaptcha`               | `number` | No       | —           |
| `dailyDiscoveredMail`        | `number` | No       | —           |
| `dailyAiCredit`              | `number` | No       | —           |
| `dailySerpCredits`           | `number` | No       | —           |
| `monthlyExecutionTime`       | `number` | No       | —           |
| `monthlyMail`                | `number` | No       | —           |
| `monthlyCaptcha`             | `number` | No       | —           |
| `monthlyDiscoveredMail`      | `number` | No       | —           |
| `monthlyAiCredit`            | `number` | No       | —           |
| `monthlySerpCredits`         | `number` | No       | —           |
| `s3Storage`                  | `number` | No       | —           |
| `agentCount`                 | `number` | No       | —           |
| `planName`                   | `string` | No       | —           |
| `dailyResourceNextResetAt`   | `number` | No       | —           |
| `monthlyResourceNextResetAt` | `number` | No       | —           |
| `planShouldCancelAt`         | `number` | No       | —           |

***

### fetchRunningContainers

`orgs.fetchRunningContainers`

Get the organization's running containers

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.orgs.fetchRunningContainers({});
```

**Input:** *empty object*

**Output**

| Name         | Type       | Required | Description |
| ------------ | ---------- | -------- | ----------- |
| `containers` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="containers full type">
    ```ts theme={null}
    {
      id: string,
      agentId: string,
      agentName?: string | null,
      createdAt: number,
      retryNumber: number,
      launchType: string,
      scriptSlug: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### saveAgentGroups

`orgs.saveAgentGroups`

Update agent groups and order for the organization

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.orgs.saveAgentGroups({});
```

**Input**

| Name          | Type       | Required | Description |
| ------------- | ---------- | -------- | ----------- |
| `agentGroups` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="agentGroups full type">
    ```ts theme={null}
    (
      string | {
        id: string,
        name: string,
        agents: string[]
      }
    )[]
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name          | Type       | Required | Description |
| ------------- | ---------- | -------- | ----------- |
| `agentGroups` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="agentGroups full type">
    ```ts theme={null}
    (
      string | {
        id: string,
        name: string,
        agents: string[]
      }
    )[]
    ```
  </Accordion>
</AccordionGroup>

***

## Scripts

### delete

`scripts.delete`

Delete a script by ID

**Risk:** `destructive`

```ts theme={null}
await corsair.phantombuster.api.scripts.delete({});
```

**Input**

| Name          | Type                 | Required | Description |
| ------------- | -------------------- | -------- | ----------- |
| `id`          | `string`             | Yes      | —           |
| `branch`      | `string`             | No       | —           |
| `environment` | `staging \| release` | No       | —           |

**Output:** *empty object*

***

### fetch

`scripts.fetch`

Fetch a script by ID

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.scripts.fetch({});
```

**Input**

| Name          | Type                 | Required | Description |
| ------------- | -------------------- | -------- | ----------- |
| `id`          | `string`             | Yes      | —           |
| `branch`      | `string`             | No       | —           |
| `environment` | `staging \| release` | No       | —           |
| `withCode`    | `staging \| release` | No       | —           |

**Output**

| Name          | Type                                                                  | Required | Description |
| ------------- | --------------------------------------------------------------------- | -------- | ----------- |
| `id`          | `string`                                                              | Yes      | —           |
| `name`        | `string`                                                              | Yes      | —           |
| `orgId`       | `string`                                                              | Yes      | —           |
| `orgSlug`     | `string`                                                              | Yes      | —           |
| `environment` | `staging \| release`                                                  | Yes      | —           |
| `visibility`  | `private \| semi public \| public \| semi open source \| open source` | Yes      | —           |
| `description` | `string`                                                              | No       | —           |
| `code`        | `string`                                                              | No       | —           |
| `branch`      | `string`                                                              | No       | —           |
| `branches`    | `object[]`                                                            | No       | —           |

<AccordionGroup>
  <Accordion title="branches full type">
    ```ts theme={null}
    {
      id: string,
      name: string,
      visibility: private | semi public | public | semi open source | open source
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### fetchAll

`scripts.fetchAll`

Fetch all scripts for the current user

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.scripts.fetchAll({});
```

**Input**

| Name        | Type                     | Required | Description |
| ----------- | ------------------------ | -------- | ----------- |
| `org`       | `string`                 | No       | —           |
| `branch`    | `string`                 | No       | —           |
| `exclude`   | `modules \| non-modules` | No       | —           |
| `scriptIds` | `string \| string[]`     | No       | —           |

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      name: string,
      orgId: string,
      orgSlug: string,
      environment: staging | release,
      visibility: private | semi public | public | semi open source | open source,
      description?: string | null,
      code?: string | null,
      branch?: string | null,
      branches?: {
        id: string,
        name: string,
        visibility: private | semi public | public | semi open source | open source
      }[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### fetchCode

`scripts.fetchCode`

Get the code of a script

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.scripts.fetchCode({});
```

**Input**

| Name          | Type                 | Required | Description |
| ------------- | -------------------- | -------- | ----------- |
| `script`      | `string`             | Yes      | —           |
| `org`         | `string`             | No       | —           |
| `branch`      | `string`             | No       | —           |
| `environment` | `staging \| release` | No       | —           |

**Output**

| Name   | Type     | Required | Description |
| ------ | -------- | -------- | ----------- |
| `code` | `string` | Yes      | —           |

***

### save

`scripts.save`

Create a new script or update an existing one

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.scripts.save({});
```

**Input**

| Name       | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `id`       | `string` | No       | —           |
| `name`     | `string` | No       | —           |
| `branch`   | `string` | No       | —           |
| `code`     | `string` | No       | —           |
| `markdown` | `string` | No       | —           |

**Output**

| Name   | Type     | Required | Description |
| ------ | -------- | -------- | ----------- |
| `id`   | `string` | Yes      | —           |
| `name` | `string` | Yes      | —           |

***

### updateAccessList

`scripts.updateAccessList`

Update a script's access list

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.scripts.updateAccessList({});
```

**Input**

| Name     | Type     | Required | Description |
| -------- | -------- | -------- | ----------- |
| `name`   | `string` | Yes      | —           |
| `branch` | `string` | Yes      | —           |
| `add`    | `string` | No       | —           |
| `remove` | `string` | No       | —           |

**Output:** *empty object*

***

### updateVisibility

`scripts.updateVisibility`

Update the visibility of a script

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.scripts.updateVisibility({});
```

**Input**

| Name         | Type                                                                  | Required | Description |
| ------------ | --------------------------------------------------------------------- | -------- | ----------- |
| `name`       | `string`                                                              | Yes      | —           |
| `branch`     | `string`                                                              | Yes      | —           |
| `visibility` | `private \| semi public \| public \| semi open source \| open source` | Yes      | —           |

**Output:** *empty object*

***

## Storage

### deleteLeadObjects

`storage.deleteLeadObjects`

Delete lead objects from organization storage

**Risk:** `destructive`

```ts theme={null}
await corsair.phantombuster.api.storage.deleteLeadObjects({});
```

**Input**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `type`         | `string` | No       | —           |
| `slug`         | `string` | No       | —           |
| `leadObjectId` | `string` | No       | —           |

**Output**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `deletedCount` | `number` | Yes      | —           |

***

### saveCompanyObject

`storage.saveCompanyObject`

Save a company object to organization storage

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.storage.saveCompanyObject({});
```

**Input**

| Name                | Type     | Required | Description |
| ------------------- | -------- | -------- | ----------- |
| `linkedinCompanyId` | `string` | Yes      | —           |
| `type`              | `string` | Yes      | —           |
| `slug`              | `string` | Yes      | —           |
| `properties`        | `object` | Yes      | —           |
| `id`                | `string` | No       | —           |
| `orgId`             | `string` | No       | —           |

<AccordionGroup>
  <Accordion title="properties full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name                | Type     | Required | Description |
| ------------------- | -------- | -------- | ----------- |
| `id`                | `string` | Yes      | —           |
| `linkedinCompanyId` | `string` | Yes      | —           |
| `type`              | `string` | Yes      | —           |
| `slug`              | `string` | Yes      | —           |
| `properties`        | `object` | Yes      | —           |
| `orgId`             | `string` | No       | —           |

<AccordionGroup>
  <Accordion title="properties full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### saveLeadObject

`storage.saveLeadObject`

Save a lead object to organization storage

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.storage.saveLeadObject({});
```

**Input**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `type`         | `string` | Yes      | —           |
| `slug`         | `string` | Yes      | —           |
| `properties`   | `object` | Yes      | —           |
| `agentId`      | `string` | Yes      | —           |
| `leadObjectId` | `string` | No       | —           |
| `leadId`       | `string` | No       | —           |
| `leadSlug`     | `string` | No       | —           |
| `leadUrn`      | `string` | No       | —           |

<AccordionGroup>
  <Accordion title="properties full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `orgId`      | `string` | Yes      | —           |
| `type`       | `string` | Yes      | —           |
| `slug`       | `string` | Yes      | —           |
| `properties` | `object` | Yes      | —           |
| `leadId`     | `string` | No       | —           |
| `leadSlug`   | `string` | No       | —           |
| `leadUrn`    | `string` | No       | —           |

<AccordionGroup>
  <Accordion title="properties full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### saveManyCompanyObjects

`storage.saveManyCompanyObjects`

Bulk-save company objects to organization storage

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.storage.saveManyCompanyObjects({});
```

**Input**

| Name      | Type       | Required | Description |
| --------- | ---------- | -------- | ----------- |
| `objects` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="objects full type">
    ```ts theme={null}
    {
      linkedinCompanyId: string,
      type: string,
      slug: string,
      properties: {
      }
    }[]
    ```
  </Accordion>
</AccordionGroup>

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    (
      {
        status: success,
        slug: string,
        result: {
          id: string,
          linkedinCompanyId: string,
          type: string,
          slug: string,
          properties: {
          },
          orgId?: string | null
        }
      } | {
        status: error,
        slug: string,
        error: string
      }
    )[]
    ```
  </Accordion>
</AccordionGroup>

***

### saveManyLeadObjects

`storage.saveManyLeadObjects`

Bulk-save lead objects to organization storage

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.storage.saveManyLeadObjects({});
```

**Input**

| Name      | Type       | Required | Description |
| --------- | ---------- | -------- | ----------- |
| `objects` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="objects full type">
    ```ts theme={null}
    {
      type: string,
      slug: string,
      properties: {
      },
      agentId: string,
      leadObjectId?: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    (
      {
        status: success,
        slug: string,
        id: string
      } | {
        status: error,
        slug: string,
        error: string
      }
    )[]
    ```
  </Accordion>
</AccordionGroup>

***

### searchCompanyObjects

`storage.searchCompanyObjects`

Search company objects in organization storage

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.storage.searchCompanyObjects({});
```

**Input**

| Name    | Type     | Required | Description |
| ------- | -------- | -------- | ----------- |
| `type`  | `string` | No       | —           |
| `limit` | `number` | No       | —           |

**Output:** `object`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      linkedinCompanyId: string,
      type: string,
      slug: string,
      properties: {
      },
      orgId?: string | null
    }[] | {
      companiesObjects: {
        id: string,
        linkedinCompanyId: string,
        type: string,
        slug: string,
        properties: {
        },
        orgId?: string | null
      }[],
      totalCount: number
    }
    ```
  </Accordion>
</AccordionGroup>

***

### searchLeadObjects

`storage.searchLeadObjects`

Search lead objects in organization storage

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.storage.searchLeadObjects({});
```

**Input**

| Name    | Type     | Required | Description |
| ------- | -------- | -------- | ----------- |
| `type`  | `string` | No       | —           |
| `limit` | `number` | No       | —           |

**Output:** `object`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      orgId: string,
      type: string,
      slug: string,
      properties: {
      },
      leadId?: string | null,
      leadSlug?: string | null,
      leadUrn?: string | null
    }[] | {
      leadsObjects: {
        id: string,
        orgId: string,
        type: string,
        slug: string,
        properties: {
        },
        leadId?: string | null,
        leadSlug?: string | null,
        leadUrn?: string | null
      }[],
      totalCount: number
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Users

### fetchMe

`users.fetchMe`

Get info about the currently authenticated PhantomBuster user

**Risk:** `read`

```ts theme={null}
await corsair.phantombuster.api.users.fetchMe({});
```

**Input**

| Name                | Type     | Required | Description |
| ------------------- | -------- | -------- | ----------- |
| `detailedOrgId`     | `string` | No       | —           |
| `withCustomPrompts` | `string` | No       | —           |

**Output**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `sessionId`    | `string` | Yes      | —           |
| `zendeskToken` | `string` | No       | —           |
| `user`         | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="user full type">
    ```ts theme={null}
    {
      id: string,
      email: string,
      firstName: string,
      lastName: string,
      newsletter: boolean,
      isEmailValidated: boolean,
      createdAt: number
    }
    ```
  </Accordion>
</AccordionGroup>

***

### updateMe

`users.updateMe`

Update the current user's info

**Risk:** `write`

```ts theme={null}
await corsair.phantombuster.api.users.updateMe({});
```

**Input**

| Name            | Type      | Required | Description |
| --------------- | --------- | -------- | ----------- |
| `firstName`     | `string`  | No       | —           |
| `lastName`      | `string`  | No       | —           |
| `phone`         | `string`  | No       | —           |
| `company`       | `string`  | No       | —           |
| `job`           | `string`  | No       | —           |
| `newsletter`    | `boolean` | No       | —           |
| `developerMode` | `boolean` | No       | —           |

**Output:** *empty object*

***
