# social.grain.sync.indexRecords

> Deprecated: use social.grain.sync.refreshRecords, which this is answered from, in its own shape, for apps built before it. Index records the caller has just written to their own PDS, without waiting for the firehose. The server reads each one back from the caller's PDS, proved, before answering, so a read after this sees the write. Requires service auth; every URI must name the caller's repo.

- Kind: procedure
- Authority: sync.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.sync.indexRecords)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:e7rftrdyz5e2rw4y6ocszew2/social.grain.sync.indexRecords/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:e7rftrdyz5e2rw4y6ocszew2/social.grain.sync.indexRecords/analytics)

## Procedure (`social.grain.sync.indexRecords`)

Type: procedure · POST

### Input (application/json)

- `uris` (array, required): Records in the caller's repo, just created, updated or deleted.
  - Constraints: minLength: 1, maxLength: 25
  - `items` (string · at-uri)

### Output (application/json)

- `indexed` (array, required): Read back from the caller's PDS and indexed.
  - `items` (string · at-uri)
- `notFound` (array, required): Not in the caller's repo: deleted, or never written. Whatever the index held for it is removed.
  - `items` (string · at-uri)

### Errors

- `RepoMismatch`: A URI names a repo other than the caller's.
- `UnknownCollection`: A URI names a collection this server does not index.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Deprecated: use social.grain.sync.refreshRecords, which this is answered from, in its own shape, for apps built before it. Index records the caller has just written to their own PDS, without waiting for the firehose. The server reads each one back from the caller's PDS, proved, before answering, so a read after this sees the write. Requires service auth; every URI must name the caller's repo.",
      "errors": [
        {
          "description": "A URI names a repo other than the caller's.",
          "name": "RepoMismatch"
        },
        {
          "description": "A URI names a collection this server does not index.",
          "name": "UnknownCollection"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "uris": {
              "description": "Records in the caller's repo, just created, updated or deleted.",
              "items": {
                "format": "at-uri",
                "type": "string"
              },
              "maxLength": 25,
              "minLength": 1,
              "type": "array"
            }
          },
          "required": [
            "uris"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "indexed": {
              "description": "Read back from the caller's PDS and indexed.",
              "items": {
                "format": "at-uri",
                "type": "string"
              },
              "type": "array"
            },
            "notFound": {
              "description": "Not in the caller's repo: deleted, or never written. Whatever the index held for it is removed.",
              "items": {
                "format": "at-uri",
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "indexed",
            "notFound"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "social.grain.sync.indexRecords",
  "lexicon": 1
}
```
