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

# Update Connection

> Update a connection's label or other mutable properties.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH "https://api.adrelay.dev/v1/connections/conn_abc123" \
    -H "X-API-Key: $ADRELAY_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"label": "US Google Ads Account"}'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api.adrelay.dev/v1/connections/conn_abc123",
    {
      method: "PATCH",
      headers: {
        "X-API-Key": process.env.ADRELAY_API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ label: "US Google Ads Account" }),
    }
  );

  const connection = await response.json();
  ```

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

  response = requests.patch(
      "https://api.adrelay.dev/v1/connections/conn_abc123",
      headers={
          "X-API-Key": "your-api-key-here",
          "Content-Type": "application/json",
      },
      json={"label": "US Google Ads Account"},
  )

  connection = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "conn_abc123",
    "platform": "google_ads",
    "status": "ACTIVE",
    "label": "US Google Ads Account",
    "remote_account_id": "123-456-7890",
    "created_at": "2026-03-01T12:00:00Z",
    "last_synced_at": "2026-03-21T08:00:00Z"
  }
  ```

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

Use the `label` field to assign a human-readable name to your connections for easier identification when managing multiple accounts.


## OpenAPI

````yaml PATCH /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}:
    patch:
      summary: Update connection label
      description: Updates the label for a connection.
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: connectionId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                label:
                  type:
                    - string
                    - 'null'
                  maxLength: 100
              required:
                - label
      responses:
        '200':
          description: Updated connection
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionResponse'
        '404':
          description: Connection not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - apiKey: []
components:
  schemas:
    ConnectionResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
        platform:
          $ref: '#/components/schemas/Platform'
        platformAccountId:
          type: string
        platformAccountName:
          type:
            - string
            - 'null'
        label:
          type:
            - string
            - 'null'
        status:
          $ref: '#/components/schemas/ConnectionStatus'
        currency:
          type: string
        scopes:
          type: array
          items:
            type: string
        createdAt:
          type: string
        updatedAt:
          type: string
      required:
        - id
        - platform
        - platformAccountId
        - platformAccountName
        - label
        - status
        - currency
        - scopes
        - createdAt
        - updatedAt
    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
    Platform:
      type: string
      enum:
        - GOOGLE
        - META
        - TIKTOK
        - LINKEDIN
        - PINTEREST
        - REDDIT
    ConnectionStatus:
      type: string
      enum:
        - PENDING
        - ACTIVE
        - REVOKED
        - 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

````