Python SDK
Accounts
Manage connected social media accounts with the Late Python SDK
The Accounts resource provides access to your connected social media accounts. Accounts are the individual platform connections (e.g., a Twitter account, an Instagram account) that belong to profiles.
List Accounts
List All Accounts
from late import Late
client = Late(api_key="your_api_key")
# Get all connected accounts
response = client.accounts.list()
for account in response.accounts:
print(f"{account.platform}: {account.username} ({account.field_id})")
# Check analytics access
if response.hasAnalyticsAccess:
print("Analytics add-on is active")Filter by Profile
# Get accounts for a specific profile
response = client.accounts.list(profile_id="prof_123")
for account in response.accounts:
print(f"{account.platform}: {account.username}")Get a Single Account
response = client.accounts.get("acc_123")
print(f"Platform: {response.account.platform}")
print(f"Username: {response.account.username}")
print(f"Connected: {response.account.connected}")
print(f"Profile ID: {response.account.profileId}")Get Follower Statistics
Follower statistics require the Analytics add-on. Check hasAnalyticsAccess in the list response.
# Get follower stats for all accounts
response = client.accounts.get_follower_stats()
for account in response.accounts:
print(f"{account.field_id}: {account.followers} followers")
# Get stats for specific accounts
response = client.accounts.get_follower_stats(
account_ids=["acc_123", "acc_456"]
)Async Methods
All methods have async versions:
import asyncio
from late import Late
async def manage_accounts():
async with Late(api_key="your_api_key") as client:
# List accounts
result = await client.accounts.alist()
# Filter by profile
result = await client.accounts.alist(profile_id="prof_123")
# Get single account
account = await client.accounts.aget("acc_123")
# Get follower stats
stats = await client.accounts.aget_follower_stats()
asyncio.run(manage_accounts())API Reference
accounts.list()
List connected accounts.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
profile_id | str | No | None | Filter by profile ID |
Returns: AccountsListResponse
response = client.accounts.list()
response.accounts # list[SocialAccount]
response.hasAnalyticsAccess # boolaccounts.get()
Get a single account by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | str | Yes | The account ID |
Returns: AccountGetResponse
response = client.accounts.get("acc_123")
response.account.field_id
response.account.platform
response.account.username
response.account.connectedaccounts.get_follower_stats()
Get follower statistics for accounts. Requires Analytics add-on.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
account_ids | list[str] | No | None | Filter to specific account IDs |
Returns: FollowerStatsResponse
response = client.accounts.get_follower_stats()
for account in response.accounts:
print(account.followers)SocialAccount Object
| Field | Type | Description |
|---|---|---|
field_id | string | Unique account identifier |
platform | string | Platform type (twitter, instagram, etc.) |
username | string | Account username/handle |
displayName | string | Display name |
profileImageUrl | string | Avatar URL |
connected | bool | Whether the account is currently connected |
profileId | string | Parent profile ID |
createdAt | datetime | When the account was connected |
lastUsedAt | datetime | Last time the account was used for posting |