# at.happyproto.registry.updateProfile

> Published by [happyproto.at](https://lexicon.garden/identity/did:plc:mo7vq4jbioxwafy5zkcc3eux)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.registry.updateProfile)
- [Documentation](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.registry.updateProfile/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.registry.updateProfile/examples)

## Definitions

### `at.happyproto.registry.updateProfile`

**Type**: `procedure`

Replace a package profile the caller has already published, held to the rules publishProfile applies. This is how a publisher edits a profile: it writes to the caller's own repo as them, where com.atproto.repo.putRecord sent through a HappyView instance goes wherever that instance's proxy routing points. It never creates a profile; publish a new one with publishProfile.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `record` | `unknown` | Yes | The replacement at.happyproto.plugin.profile record. |
| `slug` | `string` | Yes | The package slug: the record key of the profile to replace. |
| `swapCid` | `string` (cid) | No | The CID the profile was read at. The write is refused with InvalidSwap if the profile has changed since. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `cid` | `string` (cid) | Yes |  |
| `uri` | `string` (at-uri) | Yes |  |

#### Errors

- **AuthRequired**: The caller's identity could not be determined, so there is no repo to write to.
- **InvalidRecord**: The record is not a profile the indexer would accept. The message names the reason.
- **ProfileMissing**: No profile is indexed at that slug for the caller.
- **InvalidSwap**: The profile changed after swapCid was read.
- **Upstream**: The record could not be written to the caller's repo.
- **NotConfigured**: The registry has no identity configured.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Replace a package profile the caller has already published, held to the rules publishProfile applies. This is how a publisher edits a profile: it writes to the caller's own repo as them, where com.atproto.repo.putRecord sent through a HappyView instance goes wherever that instance's proxy routing points. It never creates a profile; publish a new one with publishProfile.",
      "errors": [
        {
          "description": "The caller's identity could not be determined, so there is no repo to write to.",
          "name": "AuthRequired"
        },
        {
          "description": "The record is not a profile the indexer would accept. The message names the reason.",
          "name": "InvalidRecord"
        },
        {
          "description": "No profile is indexed at that slug for the caller.",
          "name": "ProfileMissing"
        },
        {
          "description": "The profile changed after swapCid was read.",
          "name": "InvalidSwap"
        },
        {
          "description": "The record could not be written to the caller's repo.",
          "name": "Upstream"
        },
        {
          "description": "The registry has no identity configured.",
          "name": "NotConfigured"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "record": {
              "description": "The replacement at.happyproto.plugin.profile record.",
              "type": "unknown"
            },
            "slug": {
              "description": "The package slug: the record key of the profile to replace.",
              "maxLength": 512,
              "type": "string"
            },
            "swapCid": {
              "description": "The CID the profile was read at. The write is refused with InvalidSwap if the profile has changed since.",
              "format": "cid",
              "type": "string"
            }
          },
          "required": [
            "slug",
            "record"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "cid": {
              "format": "cid",
              "type": "string"
            },
            "uri": {
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "uri",
            "cid"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "at.happyproto.registry.updateProfile",
  "lexicon": 1
}
```
