btcintel

Sign an event with the account's custodied key

POST /v1/auth/npub/sign
who may call it
A session
the session of an account
what it costs
1 request of the quota
tiers and keys
how fresh
Never cached
every answer carries the index's height and the node's
MCP tool
None
On this page

Needs aal 1. The event comes unsigned (pubkey may be left empty; id and sig are set on the way back). It passes the same door as POST /v1/community/publish first (kinds 1111, 1985 and 5; the window; the size; NIP-73 subjects; the proof-of-work floor, mined by the client against the key's pubkey; bans), then the signer signs it within its own limits (30 a minute and 300 an hour per key). The signed event goes back to the caller, who publishes it through POST /v1/community/publish. 404 for an account without a custodied key; 409 when its key is its own; 503 signing_off while features.signing is false.

Parameters

NameWhereTypeRequiredWhat it does
eventbodyobjectrequiredA Nostr event as NIP-01 serialises it. Signed on the way out of POST /v1/auth/npub/sign; unsigned on the way in (id and sig absent, pubkey optional).

The body is application/json.

schema
  • event NostrEvent required — A Nostr event as NIP-01 serialises it. Signed on the way out of POST /v1/auth/npub/sign; unsigned on the way in (id and sig absent, pubkey optional).
    • id string — The event's id, 64 hex: the SHA-256 of its NIP-01 serialisation. POST /v1/auth/npub/sign sets it.
    • pubkey string — The author's public key, 64 hex. On an event sent to be signed it may be left out, and must otherwise be the account's custodied key.
    • created_at integer required — Unix seconds.
    • kind integer required — The event's kind.
    • tags array of array of string required — The event's tags.
    • content string required — The event's text.
    • sig string — The author's Schnorr signature of the id, 128 hex. Never on an event sent to be signed.

What it answers

The signed event.

FieldTypeWhat it carries
eventobjectA Nostr event as NIP-01 serialises it. Signed on the way out of POST /v1/auth/npub/sign; unsigned on the way in (id and sig absent, pubkey optional).
schema
  • event NostrEvent required — A Nostr event as NIP-01 serialises it. Signed on the way out of POST /v1/auth/npub/sign; unsigned on the way in (id and sig absent, pubkey optional).
    • id string — The event's id, 64 hex: the SHA-256 of its NIP-01 serialisation. POST /v1/auth/npub/sign sets it.
    • pubkey string — The author's public key, 64 hex. On an event sent to be signed it may be left out, and must otherwise be the account's custodied key.
    • created_at integer required — Unix seconds.
    • kind integer required — The event's kind.
    • tags array of array of string required — The event's tags.
    • content string required — The event's text.
    • sig string — The author's Schnorr signature of the id, 128 hex. Never on an event sent to be signed.

Errors

StatusCodeWhen
400invalid_inputMalformed input (invalid_input).
401unauthorizedunauthorized: the request does not say who makes it, or what it offers does not verify: no key or session where one is needed, or a password, a code, a passkey or a signed event that does not check. The message says what is missing.
403forbiddenforbidden: the caller is known but may not do this: a key without the scope or the tier the action needs, a session without an npub, a second factor or a recent sign-in, an operator without the role or switched off, or a source that does not allow it. The message says which.
404not_foundnot_found: what the path names is not known: not in the index (for a transaction, not in the node's mempool either), or no such record. The message says which.
409conflictconflict: the state refuses the change, for example a dispute of this caller's already open, a dispute or a claim no longer open, an address that belongs to another account, or a thing done already. The message says which.
422event_rejectedThe event was refused at the door (event_rejected): the message carries the relay's NIP-01 prefix — unbound: (not this caller's key), invalid: (shape, subject, window, size, signature), pow: (below the floor), blocked: (kind, banned, read-only).
429quota_exceededquota_exceeded: the caller's tier ran out of requests for the minute or the day. Retry-After says when to try again; every rate-limited answer carries X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset and X-RateLimit-Tier. While the deployment runs in log-only mode the decision is logged instead and X-RateLimit-Policy: log-only is set.
501not_configurednot_configured: this deployment does not run what the route needs, for example the mempool engine, accounts, the intel store or watchlists. The message names it.
503signing_off, unavailablesigning_off: the custodied signer is switched off (SIGNING_ENABLED), keys stay encrypted and exportable later; or unavailable: the signer service is not answering.

Each comes in the one error envelope, and none is cached: an error carries Cache-Control: no-store.

Example

No snippet. This route takes a signed-in session (the cookie btcintel.io sets) or a NIP-98 signature from your Nostr signer, never a key, so no snippet can run it from a shell. See Identity.