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

# Unlink an ad account

> Disconnects one ad account from the workspace. The link is kept as history (names already resolved under it stay), so linking the same account again later revives it. Ads stop getting new names from this account.

**Account-wide credential only**; OAuth/MCP tokens need `integrations:manage`. An account that was never linked, was already unlinked, or belongs to another workspace answers `404 NOT_FOUND`.



## OpenAPI

````yaml openapi.json DELETE /v1/ads/accounts/{adAccountId}
openapi: 3.1.0
info:
  title: Pilot Status API
  version: 1.0.0
  license:
    name: Pilot Status Terms of Service
    url: https://pilotstatus.com.br/terms
  description: >-
    Public REST API for Pilot Status. Authenticate with the `x-api-key: ps_...`
    header (or `x-api-key-id`). Base URL: https://pilotstatus.com.br
servers:
  - url: https://pilotstatus.com.br
security:
  - apiKey: []
  - apiKeyId: []
paths:
  /v1/ads/accounts/{adAccountId}:
    delete:
      tags:
        - Ads
      summary: Unlink an ad account
      description: >-
        Disconnects one ad account from the workspace. The link is kept as
        history (names already resolved under it stay), so linking the same
        account again later revives it. Ads stop getting new names from this
        account.


        **Account-wide credential only**; OAuth/MCP tokens need
        `integrations:manage`. An account that was never linked, was already
        unlinked, or belongs to another workspace answers `404 NOT_FOUND`.
      operationId: delete_ads-account
      parameters:
        - name: adAccountId
          in: path
          required: true
          description: Meta ad account id (`act_<digits>`).
          schema:
            type: string
          example: act_1234567890
      responses:
        '200':
          description: Ad account unlinked
          content:
            application/json:
              example:
                unlinked: true
                adAccountId: act_1234567890
        '400':
          description: '`adAccountId` is not `act_<digits>` (`VALIDATION_FAILED`)'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Validation failed | Falha na validação
                code: VALIDATION_FAILED
        '401':
          description: Missing or invalid `x-api-key` / `x-api-key-id` header
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Unauthorized
        '403':
          description: >-
            Number-scoped key (this endpoint needs an account-wide credential),
            or an OAuth token whose workspace role lacks `integrations:manage`
            (`PERMISSION_DENIED`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: This endpoint requires a tenant-scoped API key
                code: NUMBER_SCOPE_NOT_ALLOWED
        '404':
          description: No active link of this workspace for that account
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  Ad account link not found | Vínculo da conta de anúncios não
                  encontrado
                code: NOT_FOUND
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Internal server error | Erro interno do servidor
                code: INTERNAL_ERROR
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your ps_ API key
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: API key id (alternative to x-api-key)

````

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