{
  "lexicon": 1,
  "id": "com.atproto.repo.createRecord",
  "defs": {
    "main": {
      "type": "procedure",
      "description": "Create a single new repository record. Requires auth, implemented by PDS.",
      "input": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "required": [
            "repo",
            "collection",
            "record"
          ],
          "properties": {
            "collection": {
              "type": "string",
              "description": "The NSID of the record collection.",
              "format": "nsid"
            },
            "record": {
              "type": "unknown",
              "description": "The record itself. Must contain a $type field."
            },
            "repo": {
              "type": "string",
              "description": "The handle or DID of the repo (aka, current account).",
              "format": "at-identifier"
            },
            "rkey": {
              "type": "string",
              "description": "The Record Key.",
              "format": "record-key",
              "maxLength": 512
            },
            "swapCommit": {
              "type": "string",
              "description": "Compare and swap with the previous commit by CID.",
              "format": "cid"
            },
            "validate": {
              "type": "boolean",
              "description": "Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons."
            }
          }
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "required": [
            "uri",
            "cid"
          ],
          "properties": {
            "cid": {
              "type": "string",
              "format": "cid"
            },
            "commit": {
              "type": "ref",
              "ref": "com.atproto.repo.defs#commitMeta"
            },
            "uri": {
              "type": "string",
              "format": "at-uri"
            },
            "validationStatus": {
              "type": "string",
              "knownValues": [
                "valid",
                "unknown"
              ]
            }
          }
        }
      },
      "errors": [
        {
          "description": "Indicates that 'swapCommit' didn't match current repo commit.",
          "name": "InvalidSwap"
        }
      ]
    }
  }
}