# Update a connected account

**Documentation:** /reference/api-reference/connected-accounts/patchConnectedAccountsByNanoid

Update a connected account. Supports updating the alias and/or credentials. Only specified fields will be updated. Set a credential field to null to remove it. Alias must be unique within the same project, entity, and toolkit scope.

---

## PATCH `/api/v3/connected_accounts/{nanoid}`

**Endpoint:** `https://backend.composio.dev/api/v3/connected_accounts/{nanoid}`

**Summary:** Update a connected account

Update a connected account. Supports updating the alias and/or credentials. Only specified fields will be updated. Set a credential field to null to remove it. Alias must be unique within the same project, entity, and toolkit scope.

### Authentication

**ApiKeyAuth** - API Key in `header` header `x-api-key` OR **UserApiKeyAuth** - API Key in `header` header `x-user-api-key`

### Path Parameters

- `nanoid` (string (connectedAccountId)) *(required)*: The unique identifier (nanoid) of the connected account

### Request Body

**Schema:**

- `alias` (string): A human-readable alias for this connected account. Pass an empty string to clear the alias. Must be unique per entity and toolkit within the project.
- `connection` (object)
  - `state` (object) *(required)*
    - `authScheme` (enum: "BEARER_TOKEN" | "API_KEY" | "BASIC" | ...) *(required)*: The auth scheme of the connected account. Must match the connection's actual auth scheme.
    - `val` (object) *(required)*: Credential fields to update. Only provided fields are changed — omitted fields are preserved. Set a field to null to remove it.
      - `subdomain` (string,null)
      - `your-domain` (string,null)
      - `region` (string,null)
      - `shop` (string,null)
      - `account_url` (string,null)
      - `COMPANYDOMAIN` (string,null)
      - `extension` (string,null)
      - `form_api_base_url` (string,null)
      - `instanceEndpoint` (string,null)
      - `api_url` (string,null)
      - `borneo_dashboard_url` (string,null)
      - `proxy_username` (string,null)
      - `proxy_password` (string,null)
      - `domain` (string,null)
      - `version` (string,null)
      - `dc` (string,null)
      - `site_name` (string,null)
      - `instanceName` (string,null)
      - `account_id` (string,null)
      - `your_server` (string,null)
      - `server_location` (string,null)
      - `base_url` (string,null)
      - `token` (string,null)
      - `generic_api_key` (string,null)
      - `api_key` (string,null)
      - `bearer_token` (string,null)
      - `basic_encoded` (string,null)
      - `username` (string,null)
      - `password` (string,null)
      - `credentials_json` (string,null)
      - `application_id` (string,null)
      - `installation_id` (string,null)
      - `private_key` (string,null)
      - `[key: string]` (any)

**Example:**

```json
{
  "alias": "string",
  "connection": {
    "state": {
      "authScheme": "BEARER_TOKEN",
      "val": {
        "subdomain": "...",
        "your-domain": "...",
        "region": "...",
        "shop": "...",
        "account_url": "...",
        "COMPANYDOMAIN": "...",
        "extension": "...",
        "form_api_base_url": "...",
        "instanceEndpoint": "...",
        "api_url": "...",
        "borneo_dashboard_url": "...",
        "proxy_username": "...",
        "proxy_password": "...",
        "domain": "...",
        "version": "...",
        "dc": "...",
        "site_name": "...",
        "instanceName": "...",
        "account_id": "...",
        "your_server": "...",
        "server_location": "...",
        "base_url": "...",
        "token": "...",
        "generic_api_key": "...",
        "api_key": "...",
        "bearer_token": "...",
        "basic_encoded": "...",
        "username": "...",
        "password": "...",
        "credentials_json": "...",
        "application_id": "...",
        "installation_id": "...",
        "private_key": "...",
        "key": "..."
      }
    }
  }
}
```

### Responses

#### 200 - Successfully updated connected account

**Response Schema:**

- `success` (boolean) *(required)*: Whether the update was successful
- `id` (string (connectedAccountId)) *(required)*: The unique identifier of the updated connected account
- `status` (string) *(required)*: The current status of the connected account after the update (ACTIVE, EXPIRED, INACTIVE, etc.)

**Example Response:**

```json
{
  "success": true,
  "id": "string",
  "status": "string"
}
```

#### 400 - Bad request - Invalid nanoid, duplicate alias, or invalid credential values

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 401 - Unauthorized - Authentication failed

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 403 - Forbidden - Insufficient permissions to update this connected account

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 404 - Not found - Connected account does not exist or was deleted

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 500 - Internal server error - Failed to update connected account

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

### Example cURL Request

```bash
curl -X PATCH "https://backend.composio.dev/api/v3/connected_accounts/string" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "alias": "string",
    "connection": {
      "state": {
        "authScheme": "BEARER_TOKEN",
        "val": {
          "subdomain": "...",
          "your-domain": "...",
          "region": "...",
          "shop": "...",
          "account_url": "...",
          "COMPANYDOMAIN": "...",
          "extension": "...",
          "form_api_base_url": "...",
          "instanceEndpoint": "...",
          "api_url": "...",
          "borneo_dashboard_url": "...",
          "proxy_username": "...",
          "proxy_password": "...",
          "domain": "...",
          "version": "...",
          "dc": "...",
          "site_name": "...",
          "instanceName": "...",
          "account_id": "...",
          "your_server": "...",
          "server_location": "...",
          "base_url": "...",
          "token": "...",
          "generic_api_key": "...",
          "api_key": "...",
          "bearer_token": "...",
          "basic_encoded": "...",
          "username": "...",
          "password": "...",
          "credentials_json": "...",
          "application_id": "...",
          "installation_id": "...",
          "private_key": "...",
          "key": "..."
        }
      }
    }
  }'
```