# ATProto Upserts Example repo showing you how to upsert data to the PDS. This will have an attached leaflet I'll add later. Setup Make a copy of [.env.template](.env.template) and rename it to .env. Fill it out. Make sure to use your handle. ```bash (p)npm install # Runs the tid example (p)npm run eample:tid # Runs the upsert example (p)npm run example:upsert ``` [./tid.js](./tid.js) Shows how you can create a TID from a datetime and convert it back ```shell Its 1/15/2026, 9:57:18 PM or 1768535838046 TID: 3mcj7faghtk2r Converted back: 1/15/2026, 9:57:18 PM or 1768535838046 ``` [./upsert.js](./upsert.js) Shows how you can upsert data to the PDS using the TID from a known date to upsert. ```shell You just finished a run. Uploading it to the PDS. Uploaded activity with rkey: 3mcj75qpg7c2r The PDS shows you went on a run at 2026-01-16T03:53:06.681Z. You just finished a walk. Uploading it to the PDS. Uploaded activity with rkey: 3mcj75qpg7c2r Uploaded activity with rkey: 3mcj75qspoc2r Since you did an upsert you should only have 2 records even tho you uploaded 3. You have 2 activities The PDS shows you went on a walk at 2026-01-16T03:53:06.789Z. The PDS shows you went on a run at 2026-01-16T03:53:06.681Z. ```