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
| Field | Type | Required | Validation | Notes |
|---|---|---|---|---|
platform | string | ✓ | IsString() | Same platform identifier used at connect time (e.g. instagram, x, youtube) |
| Header | Required | Notes |
|---|---|---|
Authorization: Bearer <accessToken> | ✓ | JWT from POST /auth/login |
Response
200 OK — SuccessOnlyResponseDto
{
"success": true
}| Field | Type | Notes |
|---|---|---|
success | boolean | Always true on 200 |
Errors
| HTTP | code / i18nKey | Reason |
|---|---|---|
400 | (DTO validation) | Missing platform |
401 | (guard) | Missing / invalid bearer token |
404 | creator.social.not_found | No SocialAccount exists for this user/platform pair |
429 | (throttle) | Rate limit exceeded (30 req/hour) |
Side effects
prisma.socialAccount.findFirst({ where: { userId, platform } }). If absent →not_found.prisma.socialAccount.delete({ where: { id } })— cascade drops the linkedSocialMetricsrow.- Sum every remaining
SocialMetrics.followerCountfor this user →CreatorProfile.totalFollowers(recompute). - 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
Authorization
bearer In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
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
| Source | Path | Lines |
|---|---|---|
| Controller | apps/api-core/src/modules/creator/creator.controller.ts | 73–83 (disconnectSocial) |
| DTO (request) | apps/api-core/src/modules/creator/dto/creator-social.dto.ts | 30–33 (DisconnectSocialDto) |
| DTO (response) | apps/api-core/src/common/dto/common-response.dto.ts | SuccessOnlyResponseDto |
| Service | apps/api-core/src/modules/creator/creator.service.ts | 265–282 (disconnectSocial) |
| Prisma models | packages/prisma/prisma/schema.prisma | SocialAccount, SocialMetrics (cascade), CreatorProfile.totalFollowers |
Connect Social Account
Verify a creator's ownership of a social account via OAuth callback. Stores the link plus access/refresh tokens for later platform calls. Recomputes totalFollowers.
List Connected Social Accounts
Read up to 50 connected social accounts for the current creator. Returns platform, public username, verification flag, and connection timestamp. OAuth tokens are NOT exposed.