Skip to main content

Overview

The com.atproto.admin namespace provides lexicons for administrative operations on a Personal Data Server (PDS). These operations are restricted to server administrators.

Key Concepts

  • Admin Authentication: Operations require admin-level credentials
  • Account Management: Administrative account operations
  • Subject Status: Moderation status of accounts and content
  • Invite System: Managing invite codes
  • Email Management: Administrative email operations

Account Queries

getAccountInfo

Get detailed information about an account. Endpoint: com.atproto.admin.getAccountInfo Authentication: Admin required
did
string
required
DID of the account
Response:
did
string
required
Account DID
handle
string
required
Account handle
email
string
Account email address
Related records
indexedAt
string
required
When account was indexed
invitedBy
object
Invite code used to create account
invites
array
Invite codes created by this account
invitesDisabled
boolean
Whether invite creation is disabled
emailConfirmedAt
string
When email was confirmed
inviteNote
string
Note about the account’s invitation
deactivatedAt
string
When account was deactivated
Example:
const response = await agent.com.atproto.admin.getAccountInfo({
  did: 'did:plc:z72i7hdynmk6r22z27h6tvur'
})

console.log('Email:', response.data.email)
console.log('Invites disabled:', response.data.invitesDisabled)

getAccountInfos

Get information about multiple accounts. Endpoint: com.atproto.admin.getAccountInfos Authentication: Admin required
dids
array
required
Array of DIDs to query
Response: Array of account information objects

searchAccounts

Search for accounts. Endpoint: com.atproto.admin.searchAccounts Authentication: Admin required
email
string
Search by email address
cursor
string
Pagination cursor
limit
integer
Maximum results (1-100, default 50)
Response:
cursor
string
Next page cursor
accounts
array
required
Array of account information

Account Management

deleteAccount

Permanently delete an account. Endpoint: com.atproto.admin.deleteAccount Authentication: Admin required
did
string
required
DID of the account to delete
Example:
await agent.com.atproto.admin.deleteAccount({
  did: 'did:plc:z72i7hdynmk6r22z27h6tvur'
})

updateAccountEmail

Update an account’s email address. Endpoint: com.atproto.admin.updateAccountEmail Authentication: Admin required
account
string
required
DID or handle of the account
email
string
required
New email address

updateAccountHandle

Update an account’s handle. Endpoint: com.atproto.admin.updateAccountHandle Authentication: Admin required
did
string
required
DID of the account
handle
string
required
New handle

updateAccountPassword

Update an account’s password. Endpoint: com.atproto.admin.updateAccountPassword Authentication: Admin required
did
string
required
DID of the account
password
string
required
New password

updateAccountSigningKey

Update an account’s signing key. Endpoint: com.atproto.admin.updateAccountSigningKey Authentication: Admin required
did
string
required
DID of the account
signingKey
string
required
New signing key

Invite Management

disableAccountInvites

Disable invite code creation for an account. Endpoint: com.atproto.admin.disableAccountInvites Authentication: Admin required
account
string
required
DID or handle of the account
note
string
Note about why invites were disabled

enableAccountInvites

Enable invite code creation for an account. Endpoint: com.atproto.admin.enableAccountInvites Authentication: Admin required
account
string
required
DID or handle of the account
note
string
Note about enabling invites

getInviteCodes

Get invite codes. Endpoint: com.atproto.admin.getInviteCodes Authentication: Admin required
sort
string
Sort order: recent or usage
limit
integer
Maximum codes to return (1-500, default 100)
cursor
string
Pagination cursor
Response:
cursor
string
Next page cursor
codes
array
required
Array of invite codes

disableInviteCodes

Disable one or more invite codes. Endpoint: com.atproto.admin.disableInviteCodes Authentication: Admin required
codes
array
required
Array of invite codes to disable
accounts
array
Disable all codes for these accounts

Subject Status

getSubjectStatus

Get moderation status of a subject (account or record). Endpoint: com.atproto.admin.getSubjectStatus Authentication: Admin required
did
string
DID of subject (for account status)
uri
string
AT-URI of subject (for record status)
blob
string
CID of blob
Response: Returns moderation status including any applied actions

updateSubjectStatus

Update moderation status of a subject. Endpoint: com.atproto.admin.updateSubjectStatus Authentication: Admin required
subject
object
required
Subject to update (account, record, or blob reference)
takedown
object
Takedown action to apply
deactivated
object
Deactivation status
Example:
// Takedown an account
await agent.com.atproto.admin.updateSubjectStatus({
  subject: {
    $type: 'com.atproto.admin.defs#repoRef',
    did: 'did:plc:z72i7hdynmk6r22z27h6tvur'
  },
  takedown: {
    applied: true,
    ref: 'violation-12345'
  }
})

Email Operations

sendEmail

Send an email to a user. Endpoint: com.atproto.admin.sendEmail Authentication: Admin required
recipientDid
string
required
DID of the recipient
content
string
required
Email content
subject
string
Email subject line
senderDid
string
DID of sender (defaults to system)
comment
string
Internal comment about the email

Type Definitions

accountView

Detailed account information for administrators.
did
string
required
Account DID
handle
string
required
Account handle
email
string
Email address
Related moderation records
indexedAt
string
required
Indexing timestamp
invitedBy
object
Invite code information
invites
array
Invite codes created by account
invitesDisabled
boolean
Whether invites are disabled
emailConfirmedAt
string
Email confirmation timestamp
inviteNote
string
Admin note about invitation
deactivatedAt
string
Deactivation timestamp

statusAttr

Status attribute for moderation.
applied
boolean
required
Whether the status is applied
ref
string
Reference ID for the status

repoRef

Reference to a repository (account).
did
string
required
DID of the repository

repoBlobRef

Reference to a blob in a repository.
did
string
required
DID of the repository
cid
string
required
CID of the blob
recordUri
string
AT-URI of the record containing the blob

Common Use Cases

Investigating an Account

// Get full account details
const account = await agent.com.atproto.admin.getAccountInfo({
  did: 'did:plc:z72i7hdynmk6r22z27h6tvur'
})

console.log('Email:', account.data.email)
console.log('Created via invite:', account.data.invitedBy?.code)
console.log('Has created invites:', account.data.invites.length)

// Check moderation status
const status = await agent.com.atproto.admin.getSubjectStatus({
  did: 'did:plc:z72i7hdynmk6r22z27h6tvur'
})

Managing Invite Codes

// Get all invite codes
const codes = await agent.com.atproto.admin.getInviteCodes({
  sort: 'recent',
  limit: 100
})

// Disable codes for a specific account
await agent.com.atproto.admin.disableAccountInvites({
  account: 'did:plc:z72i7hdynmk6r22z27h6tvur',
  note: 'Abuse of invite system'
})

Moderating Content

// Takedown a post
await agent.com.atproto.admin.updateSubjectStatus({
  subject: {
    $type: 'com.atproto.repo.strongRef',
    uri: 'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3k2y...',
    cid: 'bafyrei...'
  },
  takedown: {
    applied: true,
    ref: 'TOS-violation-2024-03-04'
  }
})

// Restore content
await agent.com.atproto.admin.updateSubjectStatus({
  subject: {
    $type: 'com.atproto.repo.strongRef',
    uri: 'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3k2y...',
    cid: 'bafyrei...'
  },
  takedown: {
    applied: false
  }
})

Bulk Account Management

// Search for accounts by email domain
const results = await agent.com.atproto.admin.searchAccounts({
  email: '@spam-domain.com'
})

// Get detailed info for all matches
const dids = results.data.accounts.map(a => a.did)
const accounts = await agent.com.atproto.admin.getAccountInfos({ dids })

// Process accounts
for (const account of accounts.data) {
  console.log('Found account:', account.handle)
}

Resources

Build docs developers (and LLMs) love