> ## 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.

# Get List of Subaccounts

> Gets a list of subaccounts in reverse chronological order up to the provided `limit` number of subaccounts per call.
Pagination is supported by passing the first subaccount `id` from a previous call into `ending_before` to retrieve
the previous page, or the last subaccount `id` from a previous call into `starting_after` to retrieve the next page.




## OpenAPI

````yaml api-reference/openapi.yaml get /subaccounts
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:
    get:
      tags:
        - Subaccounts
      summary: Get List of Subaccounts
      description: >
        Gets a list of subaccounts in reverse chronological order up to the
        provided `limit` number of subaccounts per call.

        Pagination is supported by passing the first subaccount `id` from a
        previous call into `ending_before` to retrieve

        the previous page, or the last subaccount `id` from a previous call into
        `starting_after` to retrieve the next page.
      operationId: GetListOfSubaccounts
      parameters:
        - name: limit
          in: query
          schema:
            type:
              - integer
              - 'null'
            default: 20
            maximum: 100
            minimum: 1
          required: false
          description: Limits the number of subaccounts returned, default is 20, max is 100
        - name: starting_after
          in: query
          schema:
            type:
              - string
              - 'null'
          required: false
          description: >-
            If specified, returns subaccounts created before (earlier than) the
            subaccount with this id, exclusive (subaccount with this id is not
            included). Only one of starting_after and ending_before can be
            specified.
        - name: ending_before
          in: query
          schema:
            type:
              - string
              - 'null'
          required: false
          description: >-
            If specified, returns subaccounts created after (later than) the
            order with this id, exclusive (subaccount with this id is not
            included). Only one of starting_after and ending_before can be
            specified.
      responses:
        '200':
          description: List of Subaccounts
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListOfSubaccounts'
              example:
                data:
                  - id: 5nubL0NS
                    name: Marketing Department
                    email: jane.doe@example.com
                    default_portfolio_id: mHvNvWbq
                    created_on: '2023-08-01T18:00:00.000000Z'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestProblemDetails'
              examples:
                Invalid starting_after Subaccount Id:
                  value:
                    status: 400
                    type: https://api.cnaught.com/v1/errors/invalid-parameters
                    title: Invalid value for parameter starting_after was specified
                    detail: >-
                      The subaccount id specified by starting_after does not
                      exist.
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    ListOfSubaccounts:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Subaccount'
    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
    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.
    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

````