{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "A 60-second management ticket for one of the caller's instances, bound to the ticket key `keyProof` proves: a key the caller's browser generated and can't export. Send it to the instance as `Authorization: HV-Ticket <ticket>` with an `HV-Ticket-Proof` signed by that key for each request. Customers only.",
      "errors": [
        {
          "description": "This endpoint requires an authenticated caller.",
          "name": "AuthRequired"
        },
        {
          "description": "The caller is not a HappyProto customer, or the provisioner refused them.",
          "name": "Forbidden"
        },
        {
          "description": "instance is missing or not a UUID, keyProof is missing, or HappyView refused keyProof.",
          "name": "InvalidRequest"
        },
        {
          "description": "HappyView made no caller assertion for this sign-in, for example because it isn't a DPoP session. Signing in again may fix it. A sign-in from another app is refused by the provisioner and comes back as Upstream.",
          "name": "Unavailable"
        },
        {
          "description": "No such instance, or it is not the caller's. The two are indistinguishable.",
          "name": "NotFound"
        },
        {
          "description": "Passed through from the provisioner: the instance's HappyView release predates tickets.",
          "name": "UnsupportedRelease"
        },
        {
          "description": "Passed through from the provisioner: tickets are not turned on.",
          "name": "TicketsDisabled"
        },
        {
          "description": "The provisioner is unreachable, not configured, or answered with an error it does not explain to callers.",
          "name": "Upstream"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "instance": {
              "description": "The instance's UUID.",
              "type": "string"
            },
            "keyProof": {
              "description": "A compact JWS signed by the ticket key, with `typ: hv-key-proof+jwt` and its public JWK in the header. Claims: `aud`, HappyProto's instance's issuer URL; `lxm`, `at.happyproto.server.getManagementTicket`; `dpop_jkt`, the thumbprint of the DPoP key signing this request; `iat`; `jti`.",
              "type": "string"
            }
          },
          "required": [
            "instance",
            "keyProof"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "audience": {
              "description": "The instance the ticket names, as hpy:instance:<uuid>.",
              "type": "string"
            },
            "expiresAt": {
              "description": "When the ticket expires, in Unix seconds.",
              "type": "integer"
            },
            "ticket": {
              "description": "The ticket, a compact JWS.",
              "type": "string"
            },
            "url": {
              "description": "The instance's public URL, which the request proofs name.",
              "type": "string"
            }
          },
          "required": [
            "ticket",
            "expiresAt",
            "audience",
            "url"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "at.happyproto.server.getManagementTicket",
  "lexicon": 1
}
