# ai.newnal.illi.mydata.putRecord

> Root or main admin writes one My Data record in the parent's name: the collection's #section (rkey self) or one #entry (rkey absent = a new item, else the item to replace). Validated against the platform's published lexicon and ILLI's checks (dates, times, durations, RRULE, codes; a section saying 'none' must have no item of that kind). Written with the parent's delegated session, followed by its provenance (agent = the caller, method reported_by_other); the previous value goes to the audit log; a 'skipped' or 'not sure' state of the answered question is cleared. expectedCid, when given, must be the current CID (RecordChanged otherwise, with the current record in the message). Emits changed {collection: "mydata"}.

- Kind: procedure
- Authority: mydata.illi.newnal.ai
- Lexicon: 1
- Published by [illi-service.newnal.id](https://lexicon.garden/identity/did:plc:uztm7bi2ce42dez3uu3qafro), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.mydata.putRecord)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.mydata.putRecord/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.mydata.putRecord/analytics)

## Procedure (`ai.newnal.illi.mydata.putRecord`)

Type: procedure · POST

### Input (application/json)

- `collection` (ref, required)
  - Reference: `ai.newnal.illi.mydata.defs#collection`
- `data` (union, required): The `data` of one My Data record: the collection's #section (one record at rkey self) or #entry (one record per item), as the platform's published lexicon defines it. $type names the def.
  - One of: `ai.newnal.mydata.healthFunctionalAbilities#entry`, `ai.newnal.mydata.healthMedicalEvents#section`, `ai.newnal.mydata.healthMedicalEvents#entry`, `ai.newnal.mydata.healthAllergies#section`, `ai.newnal.mydata.healthAllergies#entry`, `ai.newnal.mydata.healthMedications#section`, `ai.newnal.mydata.healthMedications#entry`, `ai.newnal.mydata.healthHealthStatus#section`, `ai.newnal.mydata.healthHealthStatus#entry`, `ai.newnal.mydata.interestsAndTastesTravel#section`, `ai.newnal.mydata.interestsAndTastesHobbies#section`, `ai.newnal.mydata.interestsAndTastesHobbies#entry`, `ai.newnal.mydata.interestsAndTastesFood#section`, `ai.newnal.mydata.interestsAndTastesGeneral#entry`, `ai.newnal.mydata.interestsAndTastesMedia#section`, `ai.newnal.mydata.interestsAndTastesNews#section`, `ai.newnal.mydata.interestsAndTastesFavoriteWorks#entry`, `ai.newnal.mydata.interestsAndTastesFavoriteCreators#entry`, `ai.newnal.mydata.capabilitiesSkillsAndKnowledge#entry`, `ai.newnal.mydata.valuesAndGoalsGoals#entry`, `ai.newnal.mydata.profileScheduleActivities#entry`, `ai.newnal.mydata.lifestyleHabits#entry`, `ai.newnal.mydata.profileIdentity#section`, `ai.newnal.mydata.profileBirth#section`, `ai.newnal.mydata.profileRepresentation#section`
- `expectedCid` (string · cid)
- `homeId` (string · tid, required)
- `itemKeys` (array): The question keys this record answers; their skipped or 'not sure' states are cleared.
  - Constraints: maxLength: 20
  - `items` (string)
    - Constraints: maxLength: 100
- `requestKey` (string, required): Idempotency key chosen by the client; a replay with the same key and input returns the first result.
  - Constraints: minLength: 1, maxLength: 64
- `rkey` (string · record-key)
- `slot` (integer, required): The parent slot, 1 or 2.
  - Constraints: minimum: 1, maximum: 2

### Output (application/json)

- `record` (ref, required)
  - Reference: `ai.newnal.illi.mydata.defs#recordView`

### Errors

- `NotMember`: No description in schema.
- `NotAdmin`: No description in schema.
- `HomeNotFound`: No description in schema.
- `ParentNotLinked`: No description in schema.
- `InvalidRecord`: No description in schema.
- `RecordChanged`: No description in schema.
- `DelegationUnavailable`: No description in schema.
- `PdsUnavailable`: No description in schema.
- `RequestConflict`: No description in schema.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Root or main admin writes one My Data record in the parent's name: the collection's #section (rkey self) or one #entry (rkey absent = a new item, else the item to replace). Validated against the platform's published lexicon and ILLI's checks (dates, times, durations, RRULE, codes; a section saying 'none' must have no item of that kind). Written with the parent's delegated session, followed by its provenance (agent = the caller, method reported_by_other); the previous value goes to the audit log; a 'skipped' or 'not sure' state of the answered question is cleared. expectedCid, when given, must be the current CID (RecordChanged otherwise, with the current record in the message). Emits changed {collection: \"mydata\"}.",
      "errors": [
        {
          "name": "NotMember"
        },
        {
          "name": "NotAdmin"
        },
        {
          "name": "HomeNotFound"
        },
        {
          "name": "ParentNotLinked"
        },
        {
          "name": "InvalidRecord"
        },
        {
          "name": "RecordChanged"
        },
        {
          "name": "DelegationUnavailable"
        },
        {
          "name": "PdsUnavailable"
        },
        {
          "name": "RequestConflict"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "collection": {
              "ref": "ai.newnal.illi.mydata.defs#collection",
              "type": "ref"
            },
            "data": {
              "description": "The `data` of one My Data record: the collection's #section (one record at rkey self) or #entry (one record per item), as the platform's published lexicon defines it. $type names the def.",
              "refs": [
                "ai.newnal.mydata.healthFunctionalAbilities#entry",
                "ai.newnal.mydata.healthMedicalEvents#section",
                "ai.newnal.mydata.healthMedicalEvents#entry",
                "ai.newnal.mydata.healthAllergies#section",
                "ai.newnal.mydata.healthAllergies#entry",
                "ai.newnal.mydata.healthMedications#section",
                "ai.newnal.mydata.healthMedications#entry",
                "ai.newnal.mydata.healthHealthStatus#section",
                "ai.newnal.mydata.healthHealthStatus#entry",
                "ai.newnal.mydata.interestsAndTastesTravel#section",
                "ai.newnal.mydata.interestsAndTastesHobbies#section",
                "ai.newnal.mydata.interestsAndTastesHobbies#entry",
                "ai.newnal.mydata.interestsAndTastesFood#section",
                "ai.newnal.mydata.interestsAndTastesGeneral#entry",
                "ai.newnal.mydata.interestsAndTastesMedia#section",
                "ai.newnal.mydata.interestsAndTastesNews#section",
                "ai.newnal.mydata.interestsAndTastesFavoriteWorks#entry",
                "ai.newnal.mydata.interestsAndTastesFavoriteCreators#entry",
                "ai.newnal.mydata.capabilitiesSkillsAndKnowledge#entry",
                "ai.newnal.mydata.valuesAndGoalsGoals#entry",
                "ai.newnal.mydata.profileScheduleActivities#entry",
                "ai.newnal.mydata.lifestyleHabits#entry",
                "ai.newnal.mydata.profileIdentity#section",
                "ai.newnal.mydata.profileBirth#section",
                "ai.newnal.mydata.profileRepresentation#section"
              ],
              "type": "union"
            },
            "expectedCid": {
              "format": "cid",
              "type": "string"
            },
            "homeId": {
              "format": "tid",
              "type": "string"
            },
            "itemKeys": {
              "description": "The question keys this record answers; their skipped or 'not sure' states are cleared.",
              "items": {
                "maxLength": 100,
                "type": "string"
              },
              "maxLength": 20,
              "type": "array"
            },
            "requestKey": {
              "description": "Idempotency key chosen by the client; a replay with the same key and input returns the first result.",
              "maxLength": 64,
              "minLength": 1,
              "pattern": "^[A-Za-z0-9._:-]+$",
              "type": "string"
            },
            "rkey": {
              "format": "record-key",
              "type": "string"
            },
            "slot": {
              "description": "The parent slot, 1 or 2.",
              "maximum": 2,
              "minimum": 1,
              "type": "integer"
            }
          },
          "required": [
            "homeId",
            "slot",
            "collection",
            "data",
            "requestKey"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "record": {
              "ref": "ai.newnal.illi.mydata.defs#recordView",
              "type": "ref"
            }
          },
          "required": [
            "record"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "ai.newnal.illi.mydata.putRecord",
  "lexicon": 1
}
```
