> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.useroot.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.useroot.com/_mcp/server.

# Rename a subaccount

PATCH https://api.useroot.com/api/subaccounts/{subaccount_id}
Content-Type: application/json

Renames an existing subaccount by updating its display name.

## Path Parameters

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `subaccount_id` | UUID | Yes | ID of the subaccount to rename |

## Request Body

| Field | Type | Required | Description | Validation Rules |
|-------|------|----------|-------------|-----------------|
| `name` | String | Yes | New display name of the subaccount | Must be between 1 and 100 characters |

## Response Body

| Field | Type | Description |
|-------|------|-------------|
| `id` | UUID | Unique identifier of the subaccount |
| `name` | String | Updated subaccount name |
| `account_number` | String | Account number for deposits |
| `routing_number` | String | Deprecated: use `routing_numbers.ach`. Kept for backward compatibility |
| `routing_numbers` | Object | Routing numbers per rail |
| `routing_numbers.ach` | String | ACH routing number for ACH transfers |
| `routing_numbers.wire` | String | Wire routing number for wire transfers |
| `total_incoming_in_minor_units` | Integer | Total incoming funds in the smallest unit of the account's currency |
| `total_outgoing_in_minor_units` | Integer | Total outgoing funds in the smallest unit of the account's currency |
| `created_at` | DateTime | ISO 8601 timestamp when the subaccount was created |
| `updated_at` | DateTime | ISO 8601 timestamp when the subaccount was last updated |

## Notes

- Subaccount `name` values are allowed to duplicate within the same entity.
- If `name` is unchanged, the endpoint is idempotent and returns `200` with the current subaccount state.

Reference: https://docs.useroot.com/api-reference/subaccounts-api/rename-subaccount

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: '[Code Generated] Root - Instant Account to Account Money Movement'
  version: 1.0.0
paths:
  /api/subaccounts/{subaccount_id}:
    patch:
      operationId: rename-subaccount
      summary: Rename a subaccount
      description: >-
        Renames an existing subaccount by updating its display name.


        ## Path Parameters


        | Field | Type | Required | Description |

        |-------|------|----------|-------------|

        | `subaccount_id` | UUID | Yes | ID of the subaccount to rename |


        ## Request Body


        | Field | Type | Required | Description | Validation Rules |

        |-------|------|----------|-------------|-----------------|

        | `name` | String | Yes | New display name of the subaccount | Must be
        between 1 and 100 characters |


        ## Response Body


        | Field | Type | Description |

        |-------|------|-------------|

        | `id` | UUID | Unique identifier of the subaccount |

        | `name` | String | Updated subaccount name |

        | `account_number` | String | Account number for deposits |

        | `routing_number` | String | Deprecated: use `routing_numbers.ach`.
        Kept for backward compatibility |

        | `routing_numbers` | Object | Routing numbers per rail |

        | `routing_numbers.ach` | String | ACH routing number for ACH transfers
        |

        | `routing_numbers.wire` | String | Wire routing number for wire
        transfers |

        | `total_incoming_in_minor_units` | Integer | Total incoming funds in
        the smallest unit of the account's currency |

        | `total_outgoing_in_minor_units` | Integer | Total outgoing funds in
        the smallest unit of the account's currency |

        | `created_at` | DateTime | ISO 8601 timestamp when the subaccount was
        created |

        | `updated_at` | DateTime | ISO 8601 timestamp when the subaccount was
        last updated |


        ## Notes


        - Subaccount `name` values are allowed to duplicate within the same
        entity.

        - If `name` is unchanged, the endpoint is idempotent and returns `200`
        with the current subaccount state.
      tags:
        - subaccountsApi
      parameters:
        - name: subaccount_id
          in: path
          description: The ID of the subaccount to rename
          required: true
          schema:
            type: string
            format: uuid
        - name: x-api-key
          in: header
          description: >-
            RootPay API key sent in the x-api-key header. Keys are
            environment-scoped: live_* for production, test_* for sandbox.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Subaccount renamed successfully
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubaccountRenameRequest'
servers:
  - url: https://api.useroot.com
    description: Production
components:
  schemas:
    SubaccountRenameRequest:
      type: object
      properties:
        name:
          type: string
          description: New display name of the subaccount
      required:
        - name
      description: Request to rename a subaccount.
      title: SubaccountRenameRequest
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        RootPay API key sent in the x-api-key header. Keys are
        environment-scoped: live_* for production, test_* for sandbox.

```

## Examples



**Request**

```json
{
  "name": "Nike Store Operations - Renamed"
}
```

**Response**

```json
{
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "name": "Nike Store Operations - Renamed",
    "account_number": "1234567890",
    "routing_number": "111000025",
    "routing_numbers": {
      "ach": "111000025",
      "wire": "111000025"
    },
    "currency_code": "USD",
    "total_incoming_cents": 0,
    "total_outgoing_cents": 0,
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T12:00:00Z"
  }
}
```

**SDK Code**

```python Basic subaccount rename
import requests

url = "https://api.useroot.com/api/subaccounts/subaccount_id"

payload = { "name": "Nike Store Operations - Renamed" }
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Basic subaccount rename
const url = 'https://api.useroot.com/api/subaccounts/subaccount_id';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Nike Store Operations - Renamed"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Basic subaccount rename
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/subaccounts/subaccount_id"

	payload := strings.NewReader("{\n  \"name\": \"Nike Store Operations - Renamed\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Basic subaccount rename
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/subaccounts/subaccount_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Nike Store Operations - Renamed\"\n}"

response = http.request(request)
puts response.read_body
```

```java Basic subaccount rename
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.useroot.com/api/subaccounts/subaccount_id")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Nike Store Operations - Renamed\"\n}")
  .asString();
```

```php Basic subaccount rename
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.useroot.com/api/subaccounts/subaccount_id', [
  'body' => '{
  "name": "Nike Store Operations - Renamed"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Basic subaccount rename
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/subaccounts/subaccount_id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Nike Store Operations - Renamed\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Basic subaccount rename
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["name": "Nike Store Operations - Renamed"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/subaccounts/subaccount_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```