# Update a sub-account

URL: https://docs.sparklayer.io/ignite/api/update-an-existing-customer-sub-account
Operation: `PATCH /v1/{siteEnv}/{siteId}/sub-accounts/{customer_external_id}` (operationId `updateSubAccount`)
OpenAPI spec: https://docs.sparklayer.io/openapi/ignite.yaml

Update the details of an existing customer sub-account. This allows changing the account's first name, last name and role.
This does not allow for the email to be updated.

`PATCH /v1/{siteEnv}/{siteId}/sub-accounts/{customer_external_id}`

> This is an Ignite endpoint: your integration service implements it and SparkLayer calls it.

### Request SparkLayer sends

```http
PATCH /v1/live/bobs-store/sub-accounts/CUS1234 HTTP/1.1
Host: ignite.example.com
Content-Type: application/json

{
  "first_name": "Bob",
  "last_name": "Jones",
  "role": "limited-customer"
}
```

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `siteEnv` | string | Yes | The SparkLayer environment the request is for, such as `live`. Store it, with the site ID, when SparkLayer connects your platform. Example: `live` |
| `siteId` | string | Yes | The SparkLayer site ID the request is for, such as `bobs-store`. Store it, with the environment, when SparkLayer connects your platform. Length: min 1. Example: `bobs-store` |
| `customer_external_id` | string | Yes | The customer's ID on your platform. Length: min 1. Example: `CUS1234` |

### Request body (`application/json`) (required)

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `first_name` | string | | Length: min 1, max 128. |
| `last_name` | string | | Length: min 1, max 128. |
| `role` | string \| null | | A role that represents the users permissions |

```json
{
  "first_name": "Bob",
  "last_name": "Jones",
  "role": "limited-customer"
}
```

### Responses your service returns

#### 201: Successful operation

#### 400: Error handling request such as name too short

#### 401: Auth Failure

#### 500: System Exception
