# The repository's records The `com.atproto.repo` methods: `createRecord`, `putRecord`, `deleteRecord`, `applyWrites`, `getRecord`, `listRecords` and `describeRepo`. What every method shares, and how the server is checked, is in [`PDS.md`](PDS.md). The repository is an atproto repository as `atproto/repository.md` defines it: records in an MST, encoded as DAG-CBOR (`atproto/data-model.md`), in signed version 3 commits (`atproto/cryptography.md`), served from `getRepo` as a CAR file (`SYNC.md`). A record of a type whose lexicon the server knows is checked against it, as [`VALIDATION.md`](VALIDATION.md) says, which also says what `validate` and `validationStatus` are, and what `createRecord` of a like, repost, follow or block that duplicates another deletes. ## What the reference does that the specs leave open - `listRecords` lists newest first, by record key descending; `reverse: true` lists in key order. It answers a `cursor` whenever the page has records, not only when it is full. - `getRecord` and `listRecords` check the syntax of `collection` and `rkey` first: a bad one is `400 InvalidRequest`, not `RecordNotFound`. - A record without `$type` is stored with `$type` set to its collection, which is part of what its CID covers. A `$type` other than the collection is `400 InvalidRequest`, as are values outside the data model, such as floats. - `createRecord` of a key that exists is `500 InternalServerError`, and so is an `applyWrites` whose update or delete names a record that does not exist. - `deleteRecord` of a record that does not exist answers `200 {}`, makes no commit, and checks no `swapRecord`. Its answer otherwise is `{commit}` alone. - `putRecord` of exactly the record already stored changes nothing: it makes no commit, answers `{uri, cid, validationStatus}` without `commit`, and checks no `swapRecord`. An `applyWrites` update to exactly the record stored does make a commit. - `describeRepo` of a repository the server does not hold is `400 RepoNotFound`. - An `applyWrites` of more than 200 writes is `400 InvalidRequest`, and a `createRecord`, `putRecord` or `applyWrites` body of more than 1000000 bytes, or a `deleteRecord` body of more than 153600, is `413 PayloadTooLargeError` (`LIMITS.md`). - `validate` is as `VALIDATION.md` says: `true` on a record of a type the server knows no lexicon for is `400 InvalidRequest`, and with `false` the write is made unchecked, and its answer, or each `applyWrites` result, has no `validationStatus`. One thing the reference does is a fault, and the server does not copy it. In one `applyWrites`, if a write gives a record exactly the content that another write in the same batch replaces or deletes, the reference drops the first record from its index: `getRecord` answers `RecordNotFound` and `listRecords` leaves it out, though it is in the repository. The harness keeps the values in a batch distinct, so it never sends such a batch. ## How it is checked Each method's answers are held to the reference's, as `PDS.md` says. A record created without a key must get a TID (`atproto/tid.md`) later than the last.