> For the complete documentation index, see [llms.txt](https://wpcloudplugins.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wpcloudplugins.gitbook.io/docs/developers/api/set_account_by_id.md).

# set\_account\_by\_id()

## Set Account for API calls

&#x20; <mark style="background-color:orange;">set\_account\_by\_id()</mark> &#x20;

This method will set the account to be used for other API calls.

### **Parameters**

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| `$account_id` | string | Cloud Account ID |

### **Return**

| Name       | Type        | Description                                             |
| ---------- | ----------- | ------------------------------------------------------- |
| `$account` | **Account** | The Account object corresponding to the set Account ID. |

### **Usage**

{% tabs %}
{% tab title="OneDrive" %}

```php
$account = WPCP_ONEDRIVE_API::set_account_by_id('8c9bacda0-d8d8-4b22-b634-7b5281687575');

// Username
$account->get_name();

// Primary emailaddress
$account->get_email();

// Profile image
$account->get_image();

// Kind of account
$account->get_type();

// Storage available & used.
$account->get_storage_info();
```

{% endtab %}

{% tab title="Google Drive" %}

```php
$account = WPCP_GDRIVE_API::set_account_by_id('201096615285735764133');

// Username
$account->get_name();

// Primary emailaddress
$account->get_email();

// Profile image
$account->get_image();

// Kind of account
$account->get_type();

// Storage available & used.
$account->get_storage_info();
```

{% endtab %}

{% tab title="Dropbox" %}

```php
$account = WPCP_DROPBOX_API::set_account_by_id('dbid:AADSy6JxzbgqCs4A43CAAAfO9xvZwpcsLU');

// Username
$account->get_name();

// Primary emailaddress
$account->get_email();

// Profile image
$account->get_image();

// Kind of account
$account->get_type();

// Storage available & used.
$account->get_storage_info();
```

{% endtab %}

{% tab title="Box" %}

```php
$account = WPCP_BOX_API::set_account_by_id('29232154182');

// Username
$account->get_name();

// Primary emailaddress
$account->get_email();

// Profile image
$account->get_image();

// Kind of account
$account->get_type();

// Storage available & used.
$account->get_storage_info();
```

{% endtab %}
{% endtabs %}
