Profiles

List Profiles

Get all profiles and their connected platforms

Endpoint

GET /profiles

Request

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

const { profiles } = await response.json();
console.log(`You have ${profiles.length} profiles`);
import os
import requests

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

profiles = response.json()['profiles']
print(f'You have {len(profiles)} profiles')

Response

{
  "profiles": [
    {
      "profileKey": "prof_abc123def456",
      "profileName": "User: john@example.com",
      "createdAt": "2025-01-01T12:00:00Z",
      "connectedPlatforms": [
        {
          "platform": "linkedin",
          "displayName": "John Doe",
          "username": "johndoe",
          "connectedAt": "2025-01-01T12:30:00Z",
          "expiresAt": "2025-03-02T12:30:00Z",
          "daysUntilExpiry": 55,
          "needsReconnect": false
        },
        {
          "platform": "bluesky",
          "displayName": "johndoe.bsky.social",
          "username": "johndoe.bsky.social",
          "connectedAt": "2025-01-02T10:00:00Z",
          "expiresAt": null,
          "daysUntilExpiry": null,
          "needsReconnect": false
        }
      ]
    }
  ]
}

Status Code: 200 OK

Response Fields

Profile Object:

FieldTypeDescription
profileKeystringUnique profile identifier
profileNamestring | nullOptional profile name
createdAtstringISO 8601 timestamp
connectedPlatformsarrayArray of platform connections

Connected Platform Object:

FieldTypeDescription
platformstringPlatform name (linkedin, bluesky)
displayNamestringUser's display name on platform
usernamestringPlatform username/handle
connectedAtstringWhen connection was made
expiresAtstring | nullToken expiry date (LinkedIn only)
daysUntilExpirynumber | nullDays until expiry (LinkedIn only)
needsReconnectbooleanWhether token needs refresh

Empty Response

If you haven't created any profiles yet:

{
  "profiles": []
}

Monitoring Token Expiry

LinkedIn tokens expire after 60 days. Monitor the needsReconnect and daysUntilExpiry fields:

const { profiles } = await fetch('https://api.postcore.dev/profiles', {
  headers: { 'x-api-key': process.env.POSTCORE_API_KEY }
}).then(r => r.json());

profiles.forEach(profile => {
  profile.connectedPlatforms.forEach(platform => {
    if (platform.needsReconnect) {
      console.warn(
        `${platform.platform} needs reconnection!`,
        `Expired: ${platform.expiresAt}`
      );
      // Send email/notification to user
    } else if (platform.daysUntilExpiry && platform.daysUntilExpiry < 7) {
      console.warn(
        `${platform.platform} expires soon!`,
        `Days left: ${platform.daysUntilExpiry}`
      );
      // Warn user to reconnect
    }
  });
});
response = requests.get(
    'https://api.postcore.dev/profiles',
    headers={'x-api-key': os.getenv('POSTCORE_API_KEY')}
)

profiles = response.json()['profiles']

for profile in profiles:
    for platform in profile['connectedPlatforms']:
        if platform['needsReconnect']:
            print(f"{platform['platform']} needs reconnection!")
            print(f"Expired: {platform['expiresAt']}")
            # Send notification to user
        elif platform['daysUntilExpiry'] and platform['daysUntilExpiry'] < 7:
            print(f"{platform['platform']} expires soon!")
            print(f"Days left: {platform['daysUntilExpiry']}")
            # Warn user

Best Practice: Check for expiring tokens regularly (e.g., daily background job) and notify users proactively before tokens expire.


Get Single Profile

To get details for a specific profile:

Endpoint:

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

const { profile, connectedPlatforms } = await response.json();
response = requests.get(
    f'https://api.postcore.dev/profiles/{profile_key}',
    headers={'x-api-key': os.getenv('POSTCORE_API_KEY')}
)

data = response.json()
profile = data['profile']
platforms = data['connectedPlatforms']

Response:

{
  "profile": {
    "profileKey": "prof_abc123",
    "profileName": "User: john@example.com",
    "createdAt": "2025-01-01T12:00:00Z"
  },
  "connectedPlatforms": [
    {
      "platform": "linkedin",
      "displayName": "John Doe",
      "username": "johndoe",
      "connectedAt": "2025-01-01T12:30:00Z",
      "expiresAt": "2025-03-02T12:30:00Z",
      "daysUntilExpiry": 55,
      "needsReconnect": false
    }
  ]
}

Status Code: 200 OK


Common Use Cases

Check Which Platforms Are Connected

const { profiles } = await fetch("https://api.postcore.dev/profiles", {
  headers: { "x-api-key": apiKey },
}).then((r) => r.json());

const allPlatforms = profiles.flatMap((p) =>
  p.connectedPlatforms.map((cp) => cp.platform)
);

console.log("Connected platforms:", [...new Set(allPlatforms)]);
// Output: ['linkedin', 'bluesky']

Find Profiles By Platform

const { profiles } = await fetch("https://api.postcore.dev/profiles", {
  headers: { "x-api-key": apiKey },
}).then((r) => r.json());

const linkedinProfiles = profiles.filter((p) =>
  p.connectedPlatforms.some((cp) => cp.platform === "linkedin")
);

console.log(`${linkedinProfiles.length} profiles have LinkedIn connected`);

Check If User Has Connected Any Platforms

const { profiles } = await fetch("https://api.postcore.dev/profiles", {
  headers: { "x-api-key": apiKey },
}).then((r) => r.json());

const userProfile = profiles.find((p) => p.profileKey === userProfileKey);

if (!userProfile || userProfile.connectedPlatforms.length === 0) {
  // Show "Connect your first platform" UI
} else {
  // Show platform management UI
}

Error Responses

Invalid API Key

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

Status: 401 Unauthorized

Profile Not Found (Single Profile Endpoint)

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

Status: 404 Not Found

This error only occurs when using GET /profiles/:profileKey with an invalid profileKey.