# pet.trezy.createPet

> Published by [trezy.pet](https://lexicon.garden/identity/did:plc:ollch4g7tes2reb5eceiwuol)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:ollch4g7tes2reb5eceiwuol/pet.trezy.createPet)
- [Documentation](https://lexicon.garden/lexicon/did:plc:ollch4g7tes2reb5eceiwuol/pet.trezy.createPet/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:ollch4g7tes2reb5eceiwuol/pet.trezy.createPet/examples)

## Definitions

### `pet.trezy.createPet`

**Type**: `procedure`

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `name` | `string` | Yes | The pet's name. Basic Latin only for now: letters, digits, spaces and . , ! ? ' - and nothing else. ⚠ THE LEXICON CANNOT EXPRESS THAT — atproto lexicons have no pattern facet — so createPet.lua is where it is enforced and where the reasoning lives. In short: the leaderboard is public, which makes an unrestricted name string an attack surface (right-to-left overrides, stacking combining marks, zero-width impersonation) rather than a preference; and the two pixel faces disagree about the remaining punctuation, so anything outside this set renders one character in a different typeface mid-word. Leading and trailing whitespace is trimmed and internal runs are collapsed to a single space BEFORE the name is signed and stored. |
| `species` | `string` | Yes |  |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (at-uri) | No |  |
| `error` | `string` | No | Present instead of uri/createdAt when the pet was not created for an expected reason. A stable machine code the client branches on — add codes, never rename them. |
| `active` | `boolean` | No | Whether the new pet went straight onto the stage, or is waiting because the player is already at activePetCap. ABSENT when the server could not tell — never guess it, and never default it to true: a client that says 'it's on the stage!' about a pet that is not there sends the player looking for it. Only active pets earn, so this is the difference between a purchase that starts paying immediately and one that does not. |
| `message` | `string` | No | A sentence to show the player, accompanying `error`. Free to reword; do not branch on it. |
| `createdAt` | `string` (datetime) | No |  |

## Raw Schema

```json
{
  "id": "pet.trezy.createPet",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "type": "object",
          "required": [
            "species",
            "name"
          ],
          "properties": {
            "name": {
              "type": "string",
              "maxLength": 64,
              "minLength": 1,
              "description": "The pet's name. Basic Latin only for now: letters, digits, spaces and . , ! ? ' - and nothing else. ⚠ THE LEXICON CANNOT EXPRESS THAT — atproto lexicons have no pattern facet — so createPet.lua is where it is enforced and where the reasoning lives. In short: the leaderboard is public, which makes an unrestricted name string an attack surface (right-to-left overrides, stacking combining marks, zero-width impersonation) rather than a preference; and the two pixel faces disagree about the remaining punctuation, so anything outside this set renders one character in a different typeface mid-word. Leading and trailing whitespace is trimmed and internal runs are collapsed to a single space BEFORE the name is signed and stored."
            },
            "species": {
              "type": "string"
            }
          }
        },
        "encoding": "application/json"
      },
      "output": {
        "schema": {
          "type": "object",
          "required": [],
          "properties": {
            "uri": {
              "type": "string",
              "format": "at-uri"
            },
            "error": {
              "type": "string",
              "description": "Present instead of uri/createdAt when the pet was not created for an expected reason. A stable machine code the client branches on — add codes, never rename them.",
              "knownValues": [
                "unknown-species",
                "missing-name",
                "invalid-name",
                "name-too-long",
                "cannot-afford",
                "not-purchasable",
                "definitions-unavailable"
              ]
            },
            "active": {
              "type": "boolean",
              "description": "Whether the new pet went straight onto the stage, or is waiting because the player is already at activePetCap. ABSENT when the server could not tell — never guess it, and never default it to true: a client that says 'it's on the stage!' about a pet that is not there sends the player looking for it. Only active pets earn, so this is the difference between a purchase that starts paying immediately and one that does not."
            },
            "message": {
              "type": "string",
              "description": "A sentence to show the player, accompanying `error`. Free to reword; do not branch on it."
            },
            "createdAt": {
              "type": "string",
              "format": "datetime"
            }
          }
        },
        "encoding": "application/json"
      }
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
