Profiles

Delete Profile

Remove a profile and all its data

Endpoint

DELETE /profiles/:profileKey

Request

curl -X DELETE https://api.postcore.dev/profiles/prof_abc123 \
  -H "x-api-key: YOUR_API_KEY"
const response = await fetch(
  `https://api.postcore.dev/profiles/${profileKey}`,
  {
    method: 'DELETE',
    headers: {
      'x-api-key': process.env.POSTCORE_API_KEY
    }
  }
);

const data = await response.json();
console.log(data.message); // "Profile deleted successfully"
import os
import requests

response = requests.delete(
    f'https://api.postcore.dev/profiles/{profile_key}',
    headers={'x-api-key': os.getenv('POSTCORE_API_KEY')}
)

data = response.json()
print(data['message'])  # "Profile deleted successfully"

Response

{
  "message": "Profile deleted successfully"
}

Status Code: 200 OK


What Gets Deleted

When you delete a profile, the following data is permanently removed:

Platform Connections:

  • All connected social media accounts for this profile
  • Stored credentials (encrypted app passwords, OAuth tokens)

Scheduled Posts:

  • All pending posts scheduled for this profile
  • Posts in "pending" status that haven't been published yet

Profile Data:

  • The profile itself and its metadata
  • Profile name and creation date

What Doesn't Get Deleted

Published Posts:

  • Posts that have already been published to social media platforms remain on those platforms
  • postcore cannot delete posts from LinkedIn, Bluesky, or other platforms after they're published
  • You must delete published posts directly on each platform

Important Warnings

Deletion is Permanent

Profile deletion cannot be undone. Once deleted:

  • You cannot recover the profile or its scheduled posts
  • You'll need to reconnect platforms if you want to use them again
  • All pending posts will be lost

Cascade Effect

Deleting a profile deletes all associated data:

// Before deletion
Profile "prof_abc123" {
  Connected: LinkedIn, Bluesky
  Pending Posts: 5
  Published Posts: 20 (on platforms)
}

// After deletion
- Profile: DELETED
- Platform connections: DELETED
- Pending posts (5): DELETED
- Published posts (20): STILL ON PLATFORMS

Use Cases

User Disconnects From Your App

When a user removes their account from your application:

async function deleteUserProfile(userId) {
  // Get the user's profileKey from your database
  const user = await db.users.findOne({ id: userId });

  if (user.postcoreProfileKey) {
    // Delete from postcore
    await fetch(
      `https://api.postcore.dev/profiles/${user.postcoreProfileKey}`,
      {
        method: "DELETE",
        headers: { "x-api-key": process.env.POSTCORE_API_KEY },
      }
    );

    // Clear from your database
    await db.users.update({ id: userId }, { postcoreProfileKey: null });
  }
}

Reconnecting Expired OAuth

You don't need to delete profiles to reconnect OAuth. Simply send the user through the OAuth flow again with the same profileKey:

// No need to delete - just reconnect
const reconnectUrl = `https://api.postcore.dev/profiles/connect?apiKey=${apiKey}&platform=linkedin&profileKey=${profileKey}&returnUrl=${returnUrl}`;

window.location.href = reconnectUrl;

Switching to a Different Account

To switch a user to a different social media account on the same platform:

  1. Delete the current profile (removes the old account connection)
  2. Create a new profile and connect the new account
// Delete old profile
await fetch(`https://api.postcore.dev/profiles/${oldProfileKey}`, {
  method: "DELETE",
  headers: { "x-api-key": apiKey },
});

// Create new profile
const { profileKey: newProfileKey } = await fetch(
  "https://api.postcore.dev/profiles/create",
  {
    method: "POST",
    headers: { "x-api-key": apiKey, "Content-Type": "application/json" },
    body: JSON.stringify({ profileName: "User: john@example.com" }),
  }
).then((r) => r.json());

// Connect new account
// ... OAuth or credentials flow

Error Responses

Profile Not Found

{
  "error": "PROFILE_NOT_FOUND",
  "message": "Profile not found"
}

Status: 404 Not Found

Common causes:

  • Invalid profileKey
  • Profile was already deleted
  • Profile belongs to a different account
  • Typo in the profileKey parameter

Invalid API Key

{
  "error": "INVALID_API_KEY",
  "message": "Invalid API key"
}

Status: 401 Unauthorized