Accounts
Profiles
Group the accounts of your workspace into named profiles, and filter accounts and posts by profile.
A profile is a named group of accounts in your workspace. You name a profile when you connect an account, and you filter accounts and posts by that name.
import { Configuration, ProfilesApi } from "@onepostly/sdk";
const profilesApi = new ProfilesApi(
new Configuration({ accessToken: process.env.ONEPOSTLY_API_KEY })
);
const response = await profilesApi.listProfiles();
console.log(response);{
"data": [
{
"name": "Default",
"accountCount": 2,
"createdAt": "2027-03-01T09:00:00.000Z",
"updatedAt": "2027-03-01T09:00:00.000Z"
},
{
"name": "Business",
"accountCount": 3,
"createdAt": "2027-03-01T10:00:00.000Z",
"updatedAt": "2027-03-01T10:00:00.000Z"
}
],
"nextCursor": null,
"hasMore": false
}How Profiles Work
| Rule | Detail |
|---|---|
| Identity | A profile has no id. Its name identifies it |
| Names | 1 to 60 characters, unique in any letter case |
| Reserved | none, the filter value for accounts without a profile |
| Membership | One profile per account, or none. The account's profile is the name or null |
accountCount | Connected accounts only |
The list is oldest first, 50 per page and up to 100 with limit. Pass nextCursor as cursor until hasMore is false. Any key can list profiles. Changes need a read_write key.
A key limited to some profiles lists only its own profiles and cannot change profiles.
The Default Profile
Every workspace starts with a profile named Default.
| You connect an account | It goes to |
|---|---|
With a profile name | That profile. It is created if it does not exist |
Without a profile | Default. It is created again if you deleted it |
This is the same in the dashboard and with an API key.
Create a Profile
You rarely need this call, because a connect with a new profile name creates the profile for you. Create one ahead of time when you want it to exist before its first account.
import { Configuration, ProfilesApi } from "@onepostly/sdk";
const profilesApi = new ProfilesApi(
new Configuration({ accessToken: process.env.ONEPOSTLY_API_KEY })
);
const response = await profilesApi.createProfile({
createProfileBody: {
"name": "Business"
},
});
console.log(response);{
"name": "Business",
"accountCount": 0,
"createdAt": "2027-03-15T09:00:00.000Z",
"updatedAt": "2027-03-15T09:00:00.000Z"
}The response is the new profile, with 201 and accountCount set to 0.
Add Accounts to a Profile
Send the profile name as profile when you connect the account.
| Connect method | Where profile goes |
|---|---|
| Connect session | The body of Create Connect Session |
| Bluesky | The body of Connect Bluesky |
An account keeps its profile when it is reconnected. There is no call that moves a connected account to another profile. To move one, disconnect it and connect it again with the new profile.
A key limited to some profiles connects only into one of them. See Profile Access.
Rename a Profile
Send the current name URL-encoded in the path, such as Client%20Team, and the new name in the body.
import { Configuration, ProfilesApi } from "@onepostly/sdk";
const profilesApi = new ProfilesApi(
new Configuration({ accessToken: process.env.ONEPOSTLY_API_KEY })
);
const response = await profilesApi.updateProfile({
name: "Business",
updateProfileBody: {
"name": "Acme Business"
},
});
console.log(response);{
"name": "Acme Business",
"accountCount": 3,
"createdAt": "2027-03-01T10:00:00.000Z",
"updatedAt": "2027-03-15T10:00:00.000Z"
}The accounts stay, and filters use the new name from then on. A rename can also change only the letter case.
Delete a Profile
import { Configuration, ProfilesApi } from "@onepostly/sdk";
const profilesApi = new ProfilesApi(
new Configuration({ accessToken: process.env.ONEPOSTLY_API_KEY })
);
const response = await profilesApi.deleteProfile({
name: "Business",
});
console.log(response);It returns 204. The accounts stay connected with profile set to null, and their posts do not change.
While an API key is limited to the profile, the delete returns 409 PROFILE_IN_USE. Delete those keys first.
Filter by Profile
| Request | Returns |
|---|---|
GET /v1/accounts?profile=Business | The profile's connected accounts |
GET /v1/posts?profile=Business | The profile's posts, disconnected accounts included |
GET /v1/accounts?profile=none | Accounts with no profile |
GET /v1/posts?profile=none | Posts of accounts with no profile |
The filter ignores letter case. A name that matches no profile returns an empty list, not an error.
Your App's Users
Profiles are meant for a few groups, not one per user of your app. To know which of your users owns an account, keep that link in your own database. See Link Accounts to Your Users.
Errors
| Code | HTTP | Cause | Fix |
|---|---|---|---|
VALIDATION_ERROR | 400 | The name is empty or over 60 characters | Send 1 to 60 characters |
FORBIDDEN | 403 | A read_only key, or a key limited to some profiles, tried a change | Use a read_write key with access to all profiles |
PROFILE_NOT_FOUND | 404 | No profile has this name | Use a current name |
PROFILE_NAME_TAKEN | 409 | The name is taken in any letter case, or is none | Choose another name |
PROFILE_IN_USE | 409 | An API key is limited to the profile | Delete those keys first |
See Errors for every other code.