BIO.RE
Creator

Disconnect Social Account

Remove a connected social account. Cascade-deletes the SocialMetrics row and recomputes totalFollowers across the creator's remaining linked accounts.

POST /api/v1/creators/social/disconnect — 🔑 Bearer · Rate limit: 30 req / hour

Deletes the SocialAccount row matching (userId, platform). Prisma's relational cascade drops the linked SocialMetrics row at the same time. After deletion, CreatorProfile.totalFollowers is recomputed from the remaining SocialMetrics rows so the dashboard counter stays accurate.

Disconnect is by platform, not by social account id. A creator can only have one connected account per platform — that's enforced at connect time — so the platform identifier is sufficient to select the row. The OAuth tokens stored at connect time are dropped along with the row.

Request

Body — DisconnectSocialDto

FieldTypeRequiredValidationNotes
platformstringIsString()Same platform identifier used at connect time (e.g. instagram, x, youtube)
HeaderRequiredNotes
Authorization: Bearer <accessToken>JWT from POST /auth/login

Response

200 OKSuccessOnlyResponseDto

{
  "success": true
}
FieldTypeNotes
successbooleanAlways true on 200

Errors

HTTPcode / i18nKeyReason
400(DTO validation)Missing platform
401(guard)Missing / invalid bearer token
404creator.social.not_foundNo SocialAccount exists for this user/platform pair
429(throttle)Rate limit exceeded (30 req/hour)

Side effects

  1. prisma.socialAccount.findFirst({ where: { userId, platform } }). If absent → not_found.
  2. prisma.socialAccount.delete({ where: { id } }) — cascade drops the linked SocialMetrics row.
  3. Sum every remaining SocialMetrics.followerCount for this user → CreatorProfile.totalFollowers (recompute).
  4. Audit log: [social] Disconnected {platform} for user {userId}.

Code samples

curl -X POST https://api.bio.re/api/v1/creators/social/disconnect \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"platform": "instagram"}'
async function disconnectSocial(accessToken: string, platform: string): Promise<void> {
  const res = await fetch('https://api.bio.re/api/v1/creators/social/disconnect', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${accessToken}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ platform }),
  });
  const json = await res.json();
  if (!res.ok || !json.success) {
    throw Object.assign(new Error(json?.error?.message ?? 'Social disconnect failed'), {
      code: json?.error?.code,
    });
  }
}
import { useMutation, useQueryClient } from '@tanstack/react-query';

export function useDisconnectSocial() {
  const qc = useQueryClient();
  return useMutation({
    mutationFn: async (platform: string) => {
      const res = await fetch('/api/v1/creators/social/disconnect', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ platform }),
      });
      const json = await res.json();
      if (!res.ok || !json.success) {
        throw Object.assign(new Error(json?.error?.message ?? 'Social disconnect failed'), {
          code: json?.error?.code,
          i18nKey: json?.error?.i18nKey,
        });
      }
    },
    onSuccess: () => {
      qc.invalidateQueries({ queryKey: ['creators', 'social'] });
      qc.invalidateQueries({ queryKey: ['creators', 'profile'] });
    },
  });
}

Try it

POST
/api/v1/creators/social/disconnect
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

platform*string

Social platform to disconnect

Response Body

application/json

application/json

application/json

curl -X POST "https://loading/api/v1/creators/social/disconnect" \  -H "Content-Type: application/json" \  -d '{    "platform": "instagram"  }'
{
  "success": true
}
{
  "success": false,
  "error": {
    "code": "AUTH_UNAUTHORIZED",
    "message": "Invalid credentials",
    "i18nKey": "auth.login.invalid_credentials",
    "i18nVars": {
      "field": "email"
    },
    "details": [
      {
        "message": "email must be an email"
      }
    ],
    "correlationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}
{
  "success": false,
  "error": {
    "code": "AUTH_UNAUTHORIZED",
    "message": "Invalid credentials",
    "i18nKey": "auth.login.invalid_credentials",
    "i18nVars": {
      "field": "email"
    },
    "details": [
      {
        "message": "email must be an email"
      }
    ],
    "correlationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}

Source

SourcePathLines
Controllerapps/api-core/src/modules/creator/creator.controller.ts73–83 (disconnectSocial)
DTO (request)apps/api-core/src/modules/creator/dto/creator-social.dto.ts30–33 (DisconnectSocialDto)
DTO (response)apps/api-core/src/common/dto/common-response.dto.tsSuccessOnlyResponseDto
Serviceapps/api-core/src/modules/creator/creator.service.ts265–282 (disconnectSocial)
Prisma modelspackages/prisma/prisma/schema.prismaSocialAccount, SocialMetrics (cascade), CreatorProfile.totalFollowers

On this page