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

# Upsert custom connection accounts

> Push account records to a custom connection.



## OpenAPI

````yaml api-reference/platform-api.json post /v2/account-connections/{id}/accounts
openapi: 3.0.0
info:
  title: Range Platform API
  description: >-
    The Range Platform API for workspace management, counterparties, and
    operational tooling.
  version: 1.7.37
  contact: {}
servers:
  - url: https://api.range.org
    description: Range API Server
security:
  - Authorization: []
  - Authorization: []
tags:
  - name: Address Information
    description: Get information about a crypto address.
  - name: Transfer Enrichments
    description: Attach workspace-scoped notes and categories to transfers.
  - name: Counterparties
    description: Manage external entities, their addresses, bank accounts, and documents.
  - name: Parties
    description: >-
      The workspace entity register: the firm itself, its clients, and its
      counterparties.
paths:
  /v2/account-connections/{id}/accounts:
    post:
      tags:
        - Account Connections
      summary: Upsert accounts on a custom connection
      description: >-
        Creates or updates accounts on a custom connection. Kind `account` is
        keyed by `external_id`. Kind `books` is keyed by (`external_id`,
        network). Re-sending the same key updates in place. A second books
        account for one custodian wallet is 409 `wallet_has_books_account`.
      operationId: upsertAccounts
      parameters:
        - name: id
          required: true
          in: path
          description: Resource identifier.
          schema:
            type: string
            example: 550e8400-e29b-41d4-a716-446655440000
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertCustomAccountsDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertCustomAccountsResponseDto'
components:
  schemas:
    UpsertCustomAccountsDto:
      type: object
      properties:
        accounts:
          minItems: 1
          type: array
          items:
            $ref: '#/components/schemas/CustomAccountInputDto'
      required:
        - accounts
    UpsertCustomAccountsResponseDto:
      type: object
      properties:
        upserted:
          type: number
          example: 1
          description: Accounts created or updated.
        items:
          type: array
          items:
            $ref: '#/components/schemas/UpsertedCustomAccountDto'
        ambiguous_client_external_ids:
          description: >-
            External ids of ledger accounts that pair with more than one client
            custodian wallet, so no client was assigned and they stay on `self`.
          type: array
          items:
            type: string
      required:
        - upserted
        - items
        - ambiguous_client_external_ids
    CustomAccountInputDto:
      type: object
      properties:
        external_id:
          type: string
          maxLength: 256
          example: TRUST-1180
          description: Client id; unique on this connection
        name:
          type: string
          maxLength: 512
          example: Trust 1180 vault 3
        type:
          type: string
          enum:
            - eoa
            - multisig
            - contract
            - custodian
            - exchange
            - bank
            - defi
          description: Account type; defaults to the connection default (`bank`).
        network:
          type: string
          maxLength: 255
          example: ethereum
        address:
          type: string
          maxLength: 255
          example: 0xa0b8...
          description: >-
            Optional on-chain address. Does not turn this into an
            address-watched EOA.
        books:
          type: string
          enum:
            - house
            - client
          description: Which books this account sits on (`house` or `client`).
      required:
        - external_id
        - name
    UpsertedCustomAccountDto:
      type: object
      properties:
        external_id:
          type: string
          example: TRUST-1180
        account_id:
          type: string
          format: uuid
      required:
        - external_id
        - account_id
  securitySchemes:
    Authorization:
      type: apiKey
      in: header
      name: X-API-KEY
      description: Authorization method required to allow user to access the api endpoints.

````

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