# at.happyproto.registry.publishProfile

> 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.publishProfile)
- [Documentation](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.registry.publishProfile/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.registry.publishProfile/examples)

## Definitions

### `at.happyproto.registry.publishProfile`

**Type**: `procedure`

Check a package profile against the rules the indexer applies, and optionally write it to the caller's repo. The indexer validates a record only after it is published and skips an invalid one quietly, so a publisher writing the record itself gets no feedback; this answers the same refusal before the record exists. Pass validateOnly to check a record without writing it. Like every XRPC procedure this needs an authenticated caller, so validateOnly is a dry run rather than an anonymous one.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `record` | `unknown` | Yes | An at.happyproto.plugin.profile record. |
| `slug` | `string` | Yes | The package slug, which becomes the record key. A profile record carries no slug of its own. |
| `validateOnly` | `boolean` | No | Check the record and write nothing. Still requires authentication, as every procedure does. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `cid` | `string` (cid) | No |  |
| `uri` | `string` (at-uri) | No | The record written. Absent when validateOnly was set. |
| `valid` | `boolean` | Yes | Always true; an invalid record is an error, not a result. |

#### 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.
- **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": "Check a package profile against the rules the indexer applies, and optionally write it to the caller's repo. The indexer validates a record only after it is published and skips an invalid one quietly, so a publisher writing the record itself gets no feedback; this answers the same refusal before the record exists. Pass validateOnly to check a record without writing it. Like every XRPC procedure this needs an authenticated caller, so validateOnly is a dry run rather than an anonymous one.",
      "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": "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": "An at.happyproto.plugin.profile record.",
              "type": "unknown"
            },
            "slug": {
              "description": "The package slug, which becomes the record key. A profile record carries no slug of its own.",
              "maxLength": 512,
              "type": "string"
            },
            "validateOnly": {
              "default": false,
              "description": "Check the record and write nothing. Still requires authentication, as every procedure does.",
              "type": "boolean"
            }
          },
          "required": [
            "slug",
            "record"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "cid": {
              "format": "cid",
              "type": "string"
            },
            "uri": {
              "description": "The record written. Absent when validateOnly was set.",
              "format": "at-uri",
              "type": "string"
            },
            "valid": {
              "description": "Always true; an invalid record is an error, not a result.",
              "type": "boolean"
            }
          },
          "required": [
            "valid"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "at.happyproto.registry.publishProfile",
  "lexicon": 1
}
```
