> ## Documentation Index
> Fetch the complete documentation index at: https://docs.y.uno/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# 创建账户组

> 创建新的账户组，用于在组织内组织商户或业务部门

在您的组织内创建新的组（子组织）。账户组可用于在单个上级实体下组织不同的商户或业务部门。

传入 `account_codes`，即可在同一请求中将现有账户附加到该组。新组始终创建为根组；如需将其嵌套在另一个组下，请通过[更新账户组](https://docs.y.uno/zh-hans/reference/organizations/update-account-group.md)设置 `parent_code`。


## OpenAPI

````yaml openapi/zh-hans/organizations/create-account-group.json POST /organizations/account-groups
openapi: 3.1.0
info:
  title: Account Groups API - Create
  version: 1.0.0
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
paths:
  /organizations/account-groups:
    post:
      summary: 创建账户组
      description: 创建新的组（子组织）。
      operationId: create-account-group
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - merchant_id
              properties:
                name:
                  type: string
                  description: 账户组名称（min=1，max=255）。
                merchant_id:
                  type: string
                  description: 商户在其系统中使用的唯一标识符（min=1，max=255）。
                account_codes:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: >-
                    可选。要在同一事务中附加到新组的现有账户的
                    `id`。一个账户同一时间只能属于一个组，因此已在其他组中的账户会被移到新组。如果任何代码与组织的有效账户不匹配，整个请求都会失败，且不会创建组。默认为空列表。
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: 账户组的唯一标识符。
                  name:
                    type: string
                  merchant_id:
                    type: string
                  parent_code:
                    type:
                      - string
                      - 'null'
                    format: uuid
                    description: 该组所嵌套的父组的 `id`。创建时始终为 `null`：新组作为根组创建，之后再通过更新账户组进行嵌套。
                  created_at:
                    type: string
                    format: date-time
                  updated_at:
                    type: string
                    format: date-time
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: PUBLIC-API-KEY
      x-default: <Your PUBLIC-API-KEY>
    sec1:
      type: apiKey
      in: header
      name: PRIVATE-SECRET-KEY
      x-default: <Your PRIVATE-SECRET-KEY>

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.