Profiles
A profile is made up of a user's biographical information — display name, avatar, banner, and bio — along with their posts. This guide covers reading any user's profile and editing your own.
Viewing a profile
To learn how to fetch a user's posts, see the Viewing feeds tutorial under "Author feeds."
Fetching a user's profile info
- TypeScript
- Python
- Go
To fetch a user's profile info, you can call the app.bsky.actor.getProfile endpoint.
import { app } from '@bsky/sdk/lexicons'
const { did, displayName } = await client.call(app.bsky.actor.getProfile, {
actor: 'did:plc:...',
})
To fetch a user's profile info, you can use the get_profile method.
data = client.get_profile(actor='did:plc:...')
did = data.did
display_name = data.display_name
Use ActorGetProfile with a handle or DID.
profile, _ := appbsky.ActorGetProfile(ctx, client, "did:plc:...")
did := profile.Did
displayName := profile.DisplayName // *string
| Parameter | Type | Description | Required |
|---|---|---|---|
actor | string | The DID (or handle) of the user whose profile you'd like to fetch | Yes |
Fetching multiple profiles at once
Fetching multiple profiles is as easy as fetching a single profile:
- TypeScript
- Python
- Go
const { profiles } = await client.call(app.bsky.actor.getProfiles, {
actors: ['did:plc:...'],
})
data = client.get_profiles(actors=['did:plc:...', ...])
profiles = data.profiles
resp, _ := appbsky.ActorGetProfiles(ctx, client, []string{"did:plc:...", "..."})
profiles := resp.Profiles
| Parameter | Type | Description | Required |
|---|---|---|---|
actors | string[] | The DIDs (or handles) of the users whose profiles you'd like to fetch | Yes |
Editing a profile
An authenticated user can edit their profile, including updating their display name, avatar, banner image, and bio.
Editing a profile works as an "upsert" operation. If the profile does not exist, such as immediately after account creation, the profile will be created. And if the profile already exists, you must merge in new values manually and return result to be updated.
The TypeScript SDK provides a convenient upsertProfile action, shown below.
Where an SDK doesn't have an equivalent, edit your profile directly: read
the app.bsky.actor.profile record at rkey self, change the fields you want,
and write it back with a put-record call (in Go, build an appbsky.ActorProfile
and submit it with comatproto.RepoPutRecord).
- TypeScript
import { upsertProfile } from '@bsky/sdk'
await client.call(upsertProfile, existing => ({
...existing,
displayName: 'New display name who dis',
description: 'New bio who dis',
}))
Only accounts with a valid profile are indexed for search. When creating a new
account, we recommend creating a minimal profile with displayName set to the
user's handle.
Updating profile avatar or banner
Images are handled as separate records by Bluesky, so adding or updating an avatar or profile banner requires an additional step of uploading the image blob to your PDS.
- TypeScript
const avatar = 'data:image/png;base64,...'
await client.call(upsertProfile, async existing => {
const { body } = await client.uploadBlob(convertDataURIToUint8Array(avatar), {
encoding: 'image/png',
})
return { ...existing, avatar: body.blob }
})