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

# Delete Connection

> Remove a connected ad platform account and revoke access tokens.

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.adrelay.dev/v1/connections/conn_abc123" \
    -H "X-API-Key: $ADRELAY_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api.adrelay.dev/v1/connections/conn_abc123",
    {
      method: "DELETE",
      headers: { "X-API-Key": process.env.ADRELAY_API_KEY },
    }
  );

  if (response.status === 204) {
    console.log("Connection deleted successfully.");
  }
  ```

  ```python Python theme={null}
  import requests

  response = requests.delete(
      "https://api.adrelay.dev/v1/connections/conn_abc123",
      headers={"X-API-Key": "your-api-key-here"},
  )

  if response.status_code == 204:
      print("Connection deleted successfully.")
  ```
</RequestExample>

<ResponseExample>
  ```json 204 theme={null}
  ```

  ```json 404 theme={null}
  {
    "error": "Connection not found.",
    "code": "NOT_FOUND",
    "timestamp": 1711036800,
    "request_id": "req_abc123"
  }
  ```
</ResponseExample>

Deleting a connection revokes AdRelay's OAuth tokens for that platform account. Existing campaigns on the platform are not affected -- they will continue running but can no longer be managed through AdRelay.


## OpenAPI

````yaml DELETE /v1/connections/{connectionId}
openapi: 3.1.0
info:
  title: Adrelay API
  version: 0.1.0
  description: >-
    Unified Ad Platform API — proxy and normalize campaigns across Google Ads,
    Meta, TikTok, and more.
servers:
  - url: https://api.adrelay.dev/v1
    description: Production
  - url: http://localhost:3001
    description: Local
security: []
paths:
  /v1/connections/{connectionId}:
    delete:
      summary: Delete connection
      description: Revokes and deletes a connection.
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: connectionId
          in: path
      responses:
        '204':
          description: Connection deleted
        '404':
          description: Connection not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - apiKey: []
components:
  schemas:
    ErrorEnvelope:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              $ref: '#/components/schemas/ErrorCode'
            message:
              type: string
            platform:
              type: string
            retryable:
              type: boolean
            requestId:
              type: string
              format: uuid
            platformError:
              $ref: '#/components/schemas/PlatformErrorDetail'
          required:
            - code
            - message
            - retryable
            - requestId
      required:
        - error
    ErrorCode:
      type: string
      enum:
        - BAD_REQUEST
        - UNAUTHORIZED
        - FORBIDDEN
        - NOT_FOUND
        - CONFLICT
        - RATE_LIMITED
        - RATE_LIMIT_EXCEEDED
        - PLATFORM_ERROR
        - NOT_SUPPORTED
        - TOKEN_EXPIRED
        - INTERNAL_ERROR
    PlatformErrorDetail:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        field:
          type: string
      required:
        - message
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key

````