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

# Update Subaccount

> Updates the Subaccount with the given id.
This does not include updating the logo: there are separate endpoints for doing so.
Aside from the logo, all properties should be included in the request body.
Not including the default portfolio id in the update request will have the effect of making the subaccount not
have an explicit default portfolio (making it inherit the default portfolio from the parent user).




## OpenAPI

````yaml api-reference/openapi.yaml put /subaccounts/{id}
openapi: 3.1.0
info:
  title: CNaught Carbon Credits API Documentation
  contact:
    email: support@cnaught.com
    name: CNaught
    url: https://cnaught.com/
  version: v1
  description: |
    Carbon Credits API Documentation
  termsOfService: https://cnaught.com/terms
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT.html
servers:
  - url: https://api.cnaught.com/v1
    description: CNaught API
security:
  - ApiKey: []
tags:
  - name: Orders
    description: Endpoints for placing orders and retrieving information about orders
  - name: Quotes
    description: Endpoints for obtaining price quotes for orders
  - name: Climate Impact
    description: >-
      Endpoints for retrieving climate impact data and hosted public impact page
      configuration
  - name: Subaccounts
    description: Endpoints for creating and retrieving information about subaccounts
paths:
  /subaccounts/{id}:
    parameters:
      - name: id
        in: path
        description: ID of subaccount to return / modify
        required: true
        schema:
          type: string
          examples:
            - 5nubL0NS
    put:
      tags:
        - Subaccounts
      summary: Update Subaccount
      description: >
        Updates the Subaccount with the given id.

        This does not include updating the logo: there are separate endpoints
        for doing so.

        Aside from the logo, all properties should be included in the request
        body.

        Not including the default portfolio id in the update request will have
        the effect of making the subaccount not

        have an explicit default portfolio (making it inherit the default
        portfolio from the parent user).
      operationId: UpdateSubaccount
      requestBody:
        description: Subaccount Update Parameters
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubaccountUpdateParams'
            examples:
              Example:
                value:
                  name: Operations Department
                  email: jane.doe@example.com
                  default_portfolio_id: eWvNvC12
      responses:
        '200':
          description: Subaccount Details after update
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subaccount'
              examples:
                Updated Subaccount:
                  value:
                    id: 5nubL0NS
                    name: Operations Department
                    email: jane.doe@example.com
                    default_portfolio_id: eWvNvC12
                    logo_url: >-
                      https://customer-assets.cnaught.com/fe0df075-30e2-4e58-9feb-154e72a9205f/subaccount_logo.png
        '400':
          description: Invalid default portfolio ID
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/BadRequestProblemDetails'
              example:
                errors:
                  default_portfolio_id:
                    - Portfolio 'eGy2vWbq' does not exist
                type: https://api.cnaught.com/v1/errors/invalid-parameters
                title: Your request parameters didn't validate
                status: 400
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    SubaccountUpdateParams:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Name for the subaccount
          maxLength: 512
        email:
          type:
            - string
            - 'null'
          description: >
            Optional email associated with the subaccount. If not specified,
            will remove the email

            from the subaccount.
          examples:
            - jane.doe@example.com
        default_portfolio_id:
          type:
            - string
            - 'null'
          description: >
            Optional ID of the default portfolio to use for fulfilling orders
            placed for this subaccount. If not specified,

            the parent account's default portfolio will be the default portfolio
            for the subaccount.
          examples:
            - a23bF6
    Subaccount:
      type: object
      properties:
        id:
          type: string
          description: Identifier that can be used to retrieve the subaccount details
          examples:
            - 5nubL0NS
        created_on:
          type: string
          description: Timestamp of when the subaccount was created (in UTC)
        name:
          type: string
          description: Name of the subaccount
          maxLength: 512
        email:
          type:
            - string
            - 'null'
          description: Optional email associated with the subaccount.
          examples:
            - jane.doe@example.com
        default_portfolio_id:
          type:
            - string
            - 'null'
          description: >
            Optional ID of the default portfolio used to fulfilling orders
            placed for this subaccount. If not specified,

            the parent account's default portfolio is the default portfolio for
            the subaccount.
          examples:
            - a23bF6
        logo_url:
          type:
            - string
            - 'null'
          description: >
            Optional URL for the logo used for this subaccount, if any. This URL
            is for the logo as stored on CNaught's hosting.
    BadRequestProblemDetails:
      allOf:
        - $ref: '#/components/schemas/BaseProblemDetails'
        - type: object
          properties:
            errors:
              description: >-
                Invalid properties object where each property is the key, mapped
                to a list of reasons why the property is invalid
              type:
                - object
                - 'null'
              additionalProperties:
                type: array
                items:
                  type: string
    BaseProblemDetails:
      type: object
      description: Problem details object returned on errors
      properties:
        title:
          type: string
          description: Short, human-readable summary of the problem
        details:
          type: string
          description: Longer, human-readable description of the problem
        type:
          type: string
          description: URI that identifies the problem type
        status:
          type: integer
          description: HTTP status code of the error
  responses:
    Unauthorized:
      description: Request Unauthorized
      content:
        application/problem+json:
          schema:
            properties:
              title:
                type: string
                description: Short, human-readable summary of the problem type
              status:
                type: integer
                description: HTTP status code of the error
          example:
            title: Authorization has been denied for this request
            status: 401
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer

````