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

# Atualizar ou suspender uma subconta

> Renomeie uma subconta, altere seus limites, ou suspenda e retome-a.



## OpenAPI

````yaml PATCH /v1/sub-accounts/{id}
openapi: 3.1.0
info:
  title: querying.ai
  description: >-
    One API for every AI answer engine. Every task is asynchronous: submit, then
    collect the result via webhook or polling.
  version: 1.0.0
servers:
  - url: https://api.querying.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/sub-accounts/{id}:
    patch:
      tags:
        - Sub-accounts
      summary: Update or suspend a sub-account
      description: >-
        Change its name, externalId or limits (null removes a limit), or set
        status. Suspending stops its keys within five seconds (401), stops its
        monitors and ends its batch items that have not started; tasks already
        queued or running finish and are charged. Setting status back to active
        restores the keys and monitors.
      operationId: updateSubAccount
      parameters:
        - name: id
          in: path
          required: true
          description: The sub-account id.
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubAccountUpdateRequest'
            example:
              status: suspended
      responses:
        '200':
          description: The updated sub-account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubAccountResponse'
        '400':
          description: A field is missing, out of range or unknown.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: >-
                    unknown field creditLimit; allowed: name, externalId,
                    monthlyCreditLimit, concurrencyLimit
                  timestamp: '2026-10-09T09:00:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            The key cannot manage sub-accounts: it has an engine scope or a
            daily credit limit, it is a sub-account's key, or it is an operator
            key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: SUB_ACCOUNT_FORBIDDEN
                  message: >-
                    Managing sub-accounts needs an API key without an engine
                    scope or a daily credit limit
                  timestamp: '2026-10-09T09:00:00.000Z'
        '404':
          description: No sub-account with this id belongs to your account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: No sub-account with that id
                  timestamp: '2026-10-09T09:00:00.000Z'
        '409':
          description: Another of your sub-accounts already has this externalId.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: SUB_ACCOUNT_EXISTS
                  message: Another sub-account already has that externalId
                  timestamp: '2026-10-09T09:00:00.000Z'
components:
  schemas:
    SubAccountUpdateRequest:
      type: object
      minProperties: 1
      additionalProperties: false
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 128
        externalId:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 128
        monthlyCreditLimit:
          type:
            - number
            - 'null'
          minimum: 0.01
          multipleOf: 0.01
          maximum: 20000000
          description: Null removes the cap.
        concurrencyLimit:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 100000
          description: Null removes the cap.
        status:
          type: string
          enum:
            - active
            - suspended
    SubAccountResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          const: true
        data:
          $ref: '#/components/schemas/SubAccount'
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
        error:
          $ref: '#/components/schemas/ErrorDetail'
    SubAccount:
      type: object
      required:
        - id
        - name
        - externalId
        - status
        - monthlyCreditLimit
        - concurrencyLimit
        - createdAt
        - suspendedAt
        - usage
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        externalId:
          type:
            - string
            - 'null'
          description: Your id for this customer, unique among your sub-accounts.
        status:
          type: string
          enum:
            - active
            - suspended
        monthlyCreditLimit:
          type:
            - number
            - 'null'
          minimum: 0.01
          multipleOf: 0.01
          maximum: 20000000
          description: Credits it may be charged per UTC calendar month. Null means no cap.
        concurrencyLimit:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 100000
          description: >-
            Its queued and running tasks, inside your own limit. Null means it
            shares your limit.
        createdAt:
          type: string
          format: date-time
        suspendedAt:
          type:
            - string
            - 'null'
          format: date-time
        usage:
          type: object
          required:
            - month
            - credits
            - tasks
            - reservedCredits
          description: This UTC month.
          properties:
            month:
              type: string
              description: YYYY-MM, UTC.
            credits:
              type: number
              description: Credits charged this month.
            tasks:
              type: integer
              description: Tasks charged this month.
            reservedCredits:
              type: number
              description: >-
                Credits held by its tasks still queued or running. The monthly
                limit counts these too.
    ErrorDetail:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable, safe to branch on. See the Errors guide for the full list.
        message:
          type: string
          description: For humans. May change.
        details:
          description: >-
            Context for the error. An array of `{field, message}` on most
            `VALIDATION_ERROR`s; an object elsewhere (for example `{id}` on
            `RESOURCE_NOT_FOUND`, `retryAfterSec` on 429 and 503 codes). Omitted
            when there is nothing to add.
          oneOf:
            - type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
            - type: object
              additionalProperties: true
        timestamp:
          type: string
          format: date-time
  responses:
    Unauthorized:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: MISSING_API_KEY
              message: Missing or invalid API key
              timestamp: '2026-07-09T04:12:00.000Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your API key, sent as `Authorization: Bearer <key>`.'

````

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