{
"id": "app.tempomusic.staff.createInviteCode",
"defs": {
"main": {
"type": "procedure",
"input": {
"schema": {
"type": "object",
"required": [
"quantity"
],
"properties": {
"quantity": {
"type": "integer",
"maximum": 25,
"minimum": 1,
"description": "Number of invite codes to generate in this batch. Hard-capped at 25 to keep the audit-log write batch bounded and the partial-failure surface predictable."
}
}
},
"encoding": "application/json"
},
"errors": [
{
"name": "Forbidden",
"description": "The caller is not a super-admin."
},
{
"name": "InvalidRequest",
"description": "`quantity` outside the 1..25 range."
},
{
"name": "PdsUnavailable",
"description": "The PDS returned a transient failure on the FIRST call and zero codes were generated. Partial failures on subsequent calls surface via `created < requested` on a 200 OK response, NOT this error."
}
],
"output": {
"schema": {
"type": "object",
"required": [
"codes",
"created",
"requested"
],
"properties": {
"codes": {
"type": "array",
"items": {
"type": "string",
"maxLength": 128
},
"description": "The successfully-generated invite codes as suffix-only strings (the env prefix stored under `APPVIEW_PDS_INVITE_CODE_PREFIX` has been stripped)."
},
"created": {
"type": "integer",
"minimum": 0,
"description": "Number of codes actually generated (equal to `codes.length`). Present redundantly to make the partial-batch semantic obvious to clients that only inspect scalars."
},
"requested": {
"type": "integer",
"minimum": 1,
"description": "The `quantity` originally requested. `created < requested` signals a partial batch — the client may retry with `quantity = requested - created`."
}
}
},
"encoding": "application/json"
},
"description": "Generate a batch of single-use PDS invite codes (TEM-502). Requires the caller to have the `superAdmin` role. Each call requests `quantity` codes from the PDS (`com.atproto.server.createInviteCode` with `useCount=1`), writes one `inviteCodeCreated` audit row per successfully-created code (payload = SHA-256 hash of the suffix + `use_count`, never the plain code), and returns the suffix-only codes. When the PDS returns a transient failure mid-batch the handler stops iterating and returns the successfully-generated codes together with the requested count (partial-batch surfacing — the client decides whether to retry the missing count)."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}