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

# Connect or replace the tenant's Twitter/X bearer token

> Upserts the Twitter connection. The bearer token is encrypted at rest and masked in the response. Re-calling this endpoint replaces the stored credential and marks the connection active.



## OpenAPI

````yaml /api-reference/ai-cms/openapi.json put /ai/social/twitter/connect
openapi: 3.1.0
info:
  title: Blog API
  version: 1.0.0
servers:
  - url: https://api.octaviatech.app/cms
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Tags
    description: Tag management endpoints
paths:
  /ai/social/twitter/connect:
    put:
      tags:
        - AI
      summary: Connect or replace the tenant's Twitter/X bearer token
      description: >-
        Upserts the Twitter connection. The bearer token is encrypted at rest
        and masked in the response. Re-calling this endpoint replaces the stored
        credential and marks the connection active.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - bearerToken
              properties:
                bearerToken:
                  type: string
                  minLength: 20
                  description: Twitter API v2 bearer token used to authorize tweet posts
            examples:
              Basic:
                value:
                  bearerToken: >-
                    AAAAAAAAAAAAAAAAAAAAAMLheAAAAAAA0%2BuSeid%2BULvsea4JtiGRiSDSJSI%3DEUifiRBkKG5E2XzMDjRfl76ZC9Ub0wnz4XsNiRVBChTYbJcE3F
      responses:
        '200':
          description: OK (connected)
          content:
            application/json:
              example:
                success: true
                statusCode: 200
                message: Twitter connected
                data:
                  tenantId: '{{objectId}}'
                  provider: twitter
                  isActive: true
                  config:
                    bearerToken: AAAA...VBCh
                  updatedBy: '{{objectId}}'
                  updatedAt: '2025-10-01T12:00:00.000Z'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden (role not allowed)
        '406':
          description: Validation failed (bearerToken shorter than 20 characters)
        '500':
          description: Failed to store the connection
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````