Skip to content

Working with Records

When you're working with the AT Protocol, you'll often need to create, read, update, or delete records in a repo. This page provides an overview of how to work with records in the AT Protocol.

Our examples will assume that you have already resolved the PDS of the Repo you want to work with. For write operations, you'll also need to have an authenticated session with the PDS. See the OAuth section for more details on how to create an authenticated session.

Reading a Record

To read a record, you perform the com.atproto.repo.getRecord XRPC procedure. This requires the collection and rkey of the record you want to read.

ts
const PDS = "https://example.com";
const rpc = new Client({ handler: simpleFetchHandler({ service: PDS }) });

const response = await rpc.get("com.atproto.repo.getRecord", {
	params: {
		repo: "did:plc:ir2qabq56znbbinhktehjmc6",
		collection: "xyz.statusphere.status",
		rkey: "3mfjss76fysxr"
	},
});

console.log(ok(response));
// {
//   "$type": "xyz.statusphere.status",
//   "status": "🌸",
//   "createdAt": "2026-02-23T14:00:08.919Z"
// }
ts
const response = await client.get(xyz.statusphere.status, {
	rkey: "3mfjss76fysxr"
});

console.log(response);
// {
//   "$type": "xyz.statusphere.status",
//   "status": "🌸",
//   "createdAt": "2026-02-23T14:00:08.919Z"
// }
sh
PDS=https://example.com
curl -G ${PDS}/xrpc/com.atproto.repo.getRecord \
  -d "repo=did:plc:ir2qabq56znbbinhktehjmc6" \
  -d "collection=xyz.statusphere.status" \
  -d "rkey=3mfjss76fysxr" 

# {
#   "$type": "xyz.statusphere.status",
#   "status": "🌸",
#   "createdAt": "2026-02-23T14:00:08.919Z"
# }