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

# Update Social Media URLs

> Admin endpoint to update social media URLs. Requires BACKEND_SECRET for authentication.

Admin endpoint to update social media profile URLs for Facebook, Instagram, LinkedIn, and Twitter.

<Warning>
  This is an administrative endpoint that requires authentication via the `BACKEND_SECRET`.
  Only authorized administrators should have access to this endpoint.
</Warning>

## Authentication

This endpoint requires the `x-backend-secret` header with a value matching the
`BACKEND_SECRET` environment variable configured on the server.

```bash theme={null}
x-backend-secret: your-backend-secret-here
```

## Optional Headers

* `x-user-id`: User ID of the administrator making the change (defaults to "admin")

## Request Body

All fields are optional. Only include the URLs you want to update:

* `facebook`: Facebook page URL (must be valid URL)
* `instagram`: Instagram profile URL (must be valid URL)
* `linkedin`: LinkedIn company page URL (must be valid URL)
* `twitter`: Twitter/X profile URL (must be valid URL)

## Validation

* All URLs must be properly formatted (start with http\:// or https\://)
* Invalid URLs will return a 400 Bad Request error

## Example

### Update Twitter URL to X.com

```bash cURL theme={null}
curl -X PATCH 'https://api.handauncle.com/app/config/social-media-urls' \
  -H 'Content-Type: application/json' \
  -H 'x-backend-secret: sk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' \
  -H 'x-user-id: admin@handauncle.com' \
  -d '{
    "twitter": "https://x.com/handauncle"
  }'
```

```javascript Node.js theme={null}
const response = await fetch('https://api.handauncle.com/app/config/social-media-urls', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    'x-backend-secret': process.env.BACKEND_SECRET,
    'x-user-id': 'admin@handauncle.com'
  },
  body: JSON.stringify({
    twitter: 'https://x.com/handauncle'
  })
});

const result = await response.json();
console.log(result.data.message);
```

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

response = requests.patch(
    'https://api.handauncle.com/app/config/social-media-urls',
    headers={
        'Content-Type': 'application/json',
        'x-backend-secret': os.environ['BACKEND_SECRET'],
        'x-user-id': 'admin@handauncle.com'
    },
    json={'twitter': 'https://x.com/handauncle'}
)

result = response.json()
print(f"Status: {result['success']}")
print(f"Twitter URL: {result['data']['socialMediaUrls']['twitter']}")
```

### Response

```json theme={null}
{
  "success": true,
  "data": {
    "message": "Social media URLs updated successfully",
    "socialMediaUrls": {
      "facebook": "https://facebook.com/handauncle",
      "instagram": "https://instagram.com/handauncle",
      "linkedin": "https://www.linkedin.com/company/handauncle",
      "twitter": "https://x.com/handauncle"
    }
  },
  "meta": {
    "timestamp": "2025-12-10T14:38:27.891Z",
    "request_id": "req_674e311bd3c5e6f7a8b9c0d1"
  }
}
```

## Update Multiple URLs at Once

```bash cURL theme={null}
curl -X PATCH 'https://api.handauncle.com/app/config/social-media-urls' \
  -H 'Content-Type: application/json' \
  -H 'x-backend-secret: sk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' \
  -H 'x-user-id: marketing@handauncle.com' \
  -d '{
    "facebook": "https://facebook.com/handauncle.official",
    "instagram": "https://instagram.com/handauncle.official",
    "twitter": "https://x.com/handauncle",
    "linkedin": "https://www.linkedin.com/company/handa-uncle"
  }'
```

```javascript Node.js theme={null}
const updates = {
  facebook: 'https://facebook.com/handauncle.official',
  instagram: 'https://instagram.com/handauncle.official',
  twitter: 'https://x.com/handauncle',
  linkedin: 'https://www.linkedin.com/company/handa-uncle'
};

const response = await fetch('https://api.handauncle.com/app/config/social-media-urls', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    'x-backend-secret': process.env.BACKEND_SECRET,
    'x-user-id': 'marketing@handauncle.com'
  },
  body: JSON.stringify(updates)
});

const result = await response.json();
console.log('All social URLs updated:', result.data.socialMediaUrls);
```

## Error Responses

### 401 Unauthorized

Missing or invalid backend secret:

```json theme={null}
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid backend secret"
  }
}
```

### 400 Bad Request

Invalid URL format:

```json theme={null}
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "facebook must be a valid URL"
  }
}
```

## Audit Trail

All updates are logged with:

* Timestamp of the change
* User ID who made the change (from `x-user-id` header)
* Fields that were modified

You can query the MongoDB `app_configuration` collection to see the audit trail:

```javascript theme={null}
db.app_configuration.findOne({ config_key: 'social_media_urls' })
```

## See Also

* [Get Social Media URLs](/api-reference/endpoint/app-config-social-urls) - Retrieve current social media URLs
* [Update System URLs](/api-reference/endpoint/app-config-update-system-urls) - Update system URLs


## OpenAPI

````yaml PATCH /app/config/social-media-urls
openapi: 3.1.0
info:
  title: Handa Uncle API
  version: 1.0.0
  description: Public specification for the Handa Uncle web and mobile APIs.
  contact:
    name: Handa Uncle Engineering
    email: hello@handauncle.com
servers:
  - url: https://handauncle-backend-prod-205012263523.asia-south1.run.app
    description: Prod API base (Cloud Run)
  - url: https://api.handauncle.com
    description: Production
  - url: https://staging-api.handauncle.com
    description: Staging
  - url: http://localhost:8080
    description: Local development
security: []
tags:
  - name: Mobile App
    description: Endpoints used by the native Handa Uncle app.
  - name: Platform
    description: Cross-service operational endpoints.
  - name: Auth
    description: Authentication endpoints handled by the backend adapter.
  - name: AI
    description: LLM chat endpoints supporting streaming and device-auth guests.
  - name: OTP
    description: Phone OTP lifecycle powered by Exotel.
  - name: Webhooks
    description: Server-to-server hooks invoked by Auth0.
  - name: Conversations
    description: Authenticated user conversation management.
  - name: Chat Share
    description: Create, manage, and consume shared conversations.
  - name: Files
    description: Upload, list, and delete user files.
  - name: Prompt management
    description: Admin and public APIs for managing masked pre-prompts.
  - name: User Profile
    description: Profile card collection and user data for personalized AI responses.
  - name: Visual Embeds
    description: Manage visual embed images that attach to AI chat responses.
  - name: Second Opinion
    description: Admin and public APIs for Second Opinion suggestion cards.
  - name: Profile Cards
    description: >-
      APIs for managing profile card questions used in onboarding and
      personalization.
paths:
  /app/config/social-media-urls:
    patch:
      tags:
        - Mobile App
      summary: Update social media URLs configuration
      description: >-
        Admin endpoint to update social media URLs. Requires BACKEND_SECRET for
        authentication.
      operationId: updateSocialMediaUrls
      parameters:
        - name: x-backend-secret
          in: header
          required: true
          description: Backend secret for authentication
          schema:
            type: string
        - name: x-user-id
          in: header
          required: false
          description: User ID performing the update (optional, defaults to 'admin')
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSocialMediaUrlsRequest'
      responses:
        '200':
          description: Social media URLs updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateSocialMediaUrlsResponseEnvelope'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    UpdateSocialMediaUrlsRequest:
      type: object
      properties:
        facebook:
          type: string
          format: uri
        instagram:
          type: string
          format: uri
        linkedin:
          type: string
          format: uri
        twitter:
          type: string
          format: uri
      example:
        twitter: https://x.com/handauncle
        instagram: https://instagram.com/handauncle.official
    UpdateSocialMediaUrlsResponseEnvelope:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/UpdateSocialMediaUrlsResponseData'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      required:
        - success
        - data
        - meta
      example:
        success: true
        data:
          message: Social media URLs updated successfully
          socialMediaUrls:
            facebook: https://www.facebook.com/handauncle
            instagram: https://instagram.com/handauncle.official
            linkedin: https://www.linkedin.com/company/handauncle
            twitter: https://x.com/handauncle
        meta:
          requestId: req_674e2f8e2g5f7h9i1d4e6f8g
          timestamp: '2025-12-10T14:36:14.890Z'
    UpdateSocialMediaUrlsResponseData:
      type: object
      properties:
        message:
          type: string
        socialMediaUrls:
          $ref: '#/components/schemas/SocialMediaUrls'
      required:
        - message
        - socialMediaUrls
      example:
        message: Social media URLs updated successfully
        socialMediaUrls:
          facebook: https://www.facebook.com/handauncle
          instagram: https://instagram.com/handauncle.official
          linkedin: https://www.linkedin.com/company/handauncle
          twitter: https://x.com/handauncle
    ResponseMeta:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
        requestId:
          type: string
          description: Server generated correlation identifier.
      required:
        - timestamp
        - requestId
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          $ref: '#/components/schemas/ErrorObject'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      required:
        - success
        - error
        - meta
    SocialMediaUrls:
      type: object
      properties:
        facebook:
          type: string
          format: uri
        instagram:
          type: string
          format: uri
        linkedin:
          type: string
          format: uri
        twitter:
          type: string
          format: uri
      required:
        - facebook
        - instagram
        - linkedin
        - twitter
      example:
        facebook: https://www.facebook.com/handauncle
        instagram: https://www.instagram.com/handauncle
        linkedin: https://www.linkedin.com/company/handauncle
        twitter: https://twitter.com/handauncle
    ErrorObject:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message describing the issue.
          example: Please enter a valid 10-digit phone number (e.g., 9876543210)
        code:
          type: string
          description: Error code for programmatic handling.
          example: VALIDATION_ERROR
        details:
          type: array
          description: >-
            Array of field-specific validation errors (for VALIDATION_ERROR
            responses).
          items:
            type: object
            properties:
              field:
                type: string
                description: Field name that failed validation.
                example: phone
              message:
                type: string
                description: Specific validation error message for this field.
                example: Please enter a valid 10-digit phone number (e.g., 9876543210)
            required:
              - field
              - message
      required:
        - message
  responses:
    ValidationError:
      description: The request payload or headers were invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UnauthorizedError:
      description: Authentication failed or is missing.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'

````