# kticket > kticket sells event tickets on Kaspa. The HTTP API is the product; the > browser app is one client of it. There is no agent-specific account or > token: if a person can do it, a machine can do it the same way. Identity is wallet ownership. Sign a server-issued challenge and every request is scoped to that wallet. The server reports its network; never choose one yourself. ## Contract - [HTTP API reference](https://kticket.danieliyahu.com/docs/api): every endpoint, schema, example, and error code. - [Agent guide](https://kticket.danieliyahu.com/docs/agent-guide.md): signing, the two-step prepare/finalize flow, and the rules as markdown. - [OpenAPI document](https://kticket.danieliyahu.com/openapi.json): the same contract as OpenAPI 3.1 JSON. - `GET /v1/config`: `{ "network": "testnet10", "network_id": "testnet-10", "wallet_network": "kaspa_testnet_10", "address_prefix": "kaspatest:" }` — the runtime chain identity. - `GET /health`: `{ "status": "ok", "network": "testnet10" }`. ## Authentication The credential is a signature over a single-use challenge. 1. `POST https://kticket.danieliyahu.com/v1/auth/challenge` with `{ "address": "kaspa:..." }`. 2. Sign the returned `message` verbatim with the wallet's Kaspa private key (Schnorr; hex or base64). 3. `POST https://kticket.danieliyahu.com/v1/auth/session` with `{ "message", "signature" }`; it returns `{ token, expires_in_seconds }`. 4. Send `Authorization: Bearer ` on user-specific reads such as `GET /v1/tickets`. Public reads (`GET /v1/events`, event detail, listings) need no token. ## Feedback `POST /v1/feedback` with `{ "message": "..." }` is anonymous: no wallet and no account. Messages are capped at 1500 characters and rate-limited per client. The server stores the note before delivery, then returns `{ "accepted": true, "delivered": true|false }` with `202`. `delivered: false` means the note is durably queued and has not been sent yet; never report it as sent. ## Covenant model The on-chain ticket covenant is a **KCC20-fork**, not an implementation of KCC-20 Final: its state is kticket's own six-field layout and its entrypoints are `mint` / `use` / `mark_used` / `list` / `purchase` / `delist`. There is no `transfer` or `transfer_delegator`, no borrow support, and no `extension_commitment`. Decode `raw_chain.state` as kticket state, not as a KCC-20 `KCC20State`. ## Shareable event pages `GET /events/{covenant_id}` is the human page and the link preview: the shell carries the verified event's title, description, canonical URL, and Open Graph/Twitter tags. Unknown, unverified, or temporarily unreachable events still return 200 with the generic site metadata — a preview is never proof. `GET /sitemap.xml` lists verified event pages and `GET /robots.txt` points at it; the JSON facts remain at `GET /v1/events/{covenant_id}`. ## Buying a ticket Money moves in two stateless steps: - `POST https://kticket.danieliyahu.com/v1/events/{covenant_id}/buy/prepare` with `{ "publicKey": "...", "address": "..." }` returns `buy_id`, the unsigned `template`, the safe-JSON `signing_template`, and `sign_inputs`. - Sign exactly the `sign_inputs` (the server has already prepared the covenant spend at input 0), then `POST https://kticket.danieliyahu.com/v1/events/{covenant_id}/buy/finalize` with `{ buy_id, template, signed }`. It returns `{ txid, status }`: `settled` once the ledger accepted the mint, `pending` when it is only relayed. ## Publishing an event KCC-23 deploys take two transactions, so deploying is three stateless calls with two wallet signatures: - `POST https://kticket.danieliyahu.com/v1/events/deploy/prepare` takes `capacity`, `price_kas` (KAS, not sompi; at least 1 KAS — every event is paid, free events are not supported), `publicKey`, `address`, and optional event metadata (`name`, `date`, `time`, `ticker`, `decimals`, `image`, `image_hash`). It returns `deploy_id` and `preparation`: the unsigned preparation tx plus the safe-JSON `signing_template`. Its payload is the KCC-23 declaration: `0x00` followed by the UTF-8 JSON object. - Sign it, then `POST https://kticket.danieliyahu.com/v1/events/deploy/genesis` with the same request fields plus `{ deploy_id, preparation: { template, signed } }`. The server relays the preparation tx, waits until it is accepted, and returns `preparation_txid`, `event_covenant_id`, and `genesis` — sign `genesis.signing_template`. The genesis tx spends the preparation output at input 0, so the covenant id commits to the metadata payload. - Finalize with `{ deploy_id, template, signed }` (the genesis template). A successful finalize registers the event for discovery. `POST /v1/events` can register an already-deployed event by `deploy_txid`. ## Resale `GET /v1/listings` and `GET /v1/events/{covenant_id}/listings` return chain-proven listings. A holder lists with `POST /v1/tickets/{ticket_id}/list/prepare` (price in sompi, at least 1 KAS) then `POST /v1/tickets/{ticket_id}/list/finalize`, and clears it with `POST /v1/tickets/{ticket_id}/delist/prepare` then `POST /v1/tickets/{ticket_id}/delist/finalize`. Anyone can buy a listing with `POST /v1/tickets/{ticket_id}/purchase/prepare` then `POST /v1/tickets/{ticket_id}/purchase/finalize` — the seller need not be online. The buyer pays exactly the listed price: the ticket's 0.5 KAS value and the network fee come out of it; nothing is added on top. A resale buyer pays the listing price exactly, and the seller receives it minus the fee. ## Check-in (door) `POST /v1/tickets/{ticket_id}/use/prepare` returns the template the owner pre-signs plus a `use_id`. The gate rebuilds the same template with `/use/sign-template`, co-signs input 0, then `/use/finalize` assembles and broadcasts. A ticket id is `<64-hex-txid>:`. ## Errors Every failure uses one envelope: `{ "error": { "type": "invalid", "message": "...", "retryable": false } }` `type` is stable and machine-readable: `invalid`, `conflict`, `policy`, `network`, `upstream`, `unauthorized`, or `unknown-*`. `retryable` says whether the same request may succeed later. HTTP status carries the class: 400 invalid, 401 unauthorized, 404 not found, 409 conflict, 422 rejected by policy, 429 rate limited, 502 network refused, 503 upstream unavailable. ## Safety - `prepare` results are correlated by an id but the server keeps no pending state: finalize promptly, and do not retry a broadcast blindly. - Never alter the template between prepare and finalize; the server merges signatures into exactly the template it issued. - Amounts are sompi (1 KAS = 100,000,000 sompi) except `price_kas` on deploy.