# social.grain.repo.deleteRecord

> Delete a record from the logged-in account's repo, at its PDS, and from the index before answering. Called as social.grain.repo.createRecord is.

- Kind: procedure
- Authority: repo.grain.social
- Lexicon: 1
- Published by [grain.social](https://lexicon.garden/identity/did:plc:e7rftrdyz5e2rw4y6ocszew2), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:e7rftrdyz5e2rw4y6ocszew2/social.grain.repo.deleteRecord)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:e7rftrdyz5e2rw4y6ocszew2/social.grain.repo.deleteRecord/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:e7rftrdyz5e2rw4y6ocszew2/social.grain.repo.deleteRecord/analytics)

## Procedure (`social.grain.repo.deleteRecord`)

Type: procedure · POST

### Input (application/json)

- `collection` (string · nsid, required): A collection grain indexes.
- `rkey` (string · record-key, required)
  - Constraints: maxLength: 512
- `swapCommit` (string · cid)
- `swapRecord` (string · cid)

### Output (application/json)


### Errors

- `UnknownCollection`: grain does not index the collection.
- `InvalidSwap`: No description in schema.
- `ScopeMissingError`: The account's PDS granted the session less than the write needs.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Delete a record from the logged-in account's repo, at its PDS, and from the index before answering. Called as social.grain.repo.createRecord is.",
      "errors": [
        {
          "description": "grain does not index the collection.",
          "name": "UnknownCollection"
        },
        {
          "name": "InvalidSwap"
        },
        {
          "description": "The account's PDS granted the session less than the write needs.",
          "name": "ScopeMissingError"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "collection": {
              "description": "A collection grain indexes.",
              "format": "nsid",
              "type": "string"
            },
            "rkey": {
              "format": "record-key",
              "maxLength": 512,
              "type": "string"
            },
            "swapCommit": {
              "format": "cid",
              "type": "string"
            },
            "swapRecord": {
              "format": "cid",
              "type": "string"
            }
          },
          "required": [
            "collection",
            "rkey"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {},
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "social.grain.repo.deleteRecord",
  "lexicon": 1
}
```
