Skip to Content
API reference

API reference

The backend receives verification, content, analytics, and earnings events from the widget, package, and dashboard.

This is a route overview. The OpenAPI document  describes the machine-facing API; use each route’s actual request and response contract when integrating.

For the browser package, use the source-mapped @nibgate/sdk reference. It covers 27 implemented client methods and the standalone validateResourceMetadata helper in SDK 0.4.40.

Base URL

https://api.nibgate.xyz

Mainnet production API. The testnet mirror lives at https://testnet-api.nibgate.xyz (same routes, Arc testnet chain 5042002, separate data). See Networks.

The host is already api., so routes live under their group name directly (/hub/..., /nibshare/...) — no /api prefix. The legacy /api/... forms still work.

API groups

Auth

Sign-In with Ethereum (SIWE) powers creator sessions on both the hub and Subblogs. Nonces are single-use and burned on every verify attempt; messages carry a 30-minute client expiry with 5 minutes of server clock-skew grace. A failure naming an expired message means the device clock is off (enable automatic date & time); a missing-nonce failure means cookies are blocked.

GET /auth/nonce # request a nonce for a wallet POST /auth/verify # verify the signed SIWE message, issues auth_session cookie GET /auth/me # current session (wallet, profile) POST /auth/logout # clear the session

(Both /auth/... and /api/auth/... forms work — the /api prefix is redundant with the api. host.)

On Subblogs the same flow lives under /api/auth/* (nonce, verify, me, logout) and issues the sb_auth_session HttpOnly cookie; sessions resolve to a wallet via User.walletAddress. A session wallet is a possession signal — it can satisfy proof-bound access without a bare ?wallet= claim.

Status & stats

GET /api/nibgate/status # service liveness GET /hub/stats # platform totals: creators, sites, content, views, unlocks, revenue GET /hub/sitemap-sites # verified sites feed for sitemaps GET /hub/sitemap/content # verified content feed for sitemaps

Site registration

Dashboard APIs create sites, issue verification tokens, recheck widget health, and archive removed sites.

POST /hub/sites/register GET /hub/sites POST /hub/sites/:websiteId/verify DELETE /hub/sites/:websiteId

Note: the path param is websiteId (the site UUID), and registration is /sites/register — not POST /hub/sites.

Cross-stack identity sync

Site identity (domain, verification, owner wallet, publisher profile) syncs testnet<->mainnet while content and money stay per-stack. Blog link tokens bind the minter wallet, so one token links a blog on both hubs (requires the same BLOG_LINK_SECRET on both).

GET /hub/site/verify-status?domain=example.com # public verification + identity for a domain POST /hub/blog/link/generate # mint a wallet-bound link token (auth) POST /hub/blog/link/verify # link a blog; resolves owner by wallet across stacks GET /hub/site/verified-identities # peer identity index (x-peer-secret gated) POST /hub/site/sync-from-peer # mirror peer identities + published blog posts (x-peer-secret gated)

Every content, receipt, rating, metric, and content-event row carries its hub-stamped network (testnet | mainnet); receipts whose chainId attests the other stack are rejected.

Event ingestion

Event ingestion requires a registered site ID and matching public verification token, rejects removed sites and applies rate limits. The token is public widget configuration, not a secret origin-authentication credential. Widget verification controls discovery eligibility separately; a valid token does not prove payment.

POST /hub/evt

Accepts the same payload as the legacy /hub/track endpoint (still available for backward compatibility). The rename avoids adblocker filter lists targeting the word “track”.

Example event shape:

{ "siteId": "site_123", "token": "verify_token", "event": "resource_view", "resource": { "id": "post_123", "title": "Paid research note", "url": "https://creator.com/research", "recipient": "0xCreator" } }

The siteId + token identify the registered site and its public reporting configuration; they do not cryptographically prove the caller’s origin. The recipient wallet links the content to the creator account and payment receiver for the verified site. A missing siteId or token returns 400, and an invalid token returns 403.

Hosted payments

The hosted pay endpoint runs the payment flow on behalf of creators. Serving private content still requires a server-side access check; this endpoint cannot secure content already shipped in HTML or JavaScript.

POST /hub/pay

Request:

{ "price": "0.01", "recipient": "0xCreatorWallet", "title": "Premium Post", "paymentRail": "gateway", "contentId": "content-uuid-or-external-id", "path": "/posts/my-post" }
FieldRequiredDescription
priceNoDefaults to 0.01. Overridden server-side when contentId maps to a tracked content record
recipientNoWallet to receive payment. Falls back to NIBGATE_SELLER_ADDRESS env var; tracked records’ recipientWallet wins. Hosted mode routes through the creator’s fee wallet (99% creator / 1% platform)
titleNoContent title for the payment challenge
paymentRailNo'gateway' (Circle Gateway, default) or 'transfer' (direct USDC transfer to the resolved payTo)
contentIdNoContent record id — pins price/recipient server-side and scopes the direct-rail txHash claim
pathNoResource path used in the payment challenge and ownership-proof message

Returns a 402 Payment Required challenge on first call. For the gateway rail the browser settles Circle’s batching challenge and retries with a Payment-Signature; for the transfer rail the browser broadcasts the USDC transfer and retries with x-nibgate-transfer-tx plus an x-nibgate-tx-owner EIP-191 signature binding the txHash to this resource (transferOwnershipMessage). Direct-rail txHashes are claimed single-use per contentId — replays against other content fail with txhash-claimed-elsewhere. On success, returns 200 with { success: true, payment: { paymentProvider, verified, recipient, network, amount, revenue, currency, payer, txHash } }.

The widget handles this automatically when using data-nibgate-premium attributes — no manual API calls needed.

Explore content

Explore reads verified content metadata from the backend.

GET /hub/explore/content?q=music&type=music&sort=trending

Public ledger

The ledger provides a live, auditable feed of views, unlocks, payments, and ratings across all sites.

GET /hub/ledger?limit=50&skip=0&type=&domain=
ParamDefaultDescription
limit50Items per page (max 100)
skip0Offset for pagination
type—Filter by activity type: views, unlocks, payments, tips, ratings
domain—Filter by site domain (e.g. fortune.nibgate.xyz for per-site activity)

Returns sorted activity list plus total counts across all records.

{ "success": true, "activities": [ { "type": "payment", "id": "…", "websiteId": "…", "actor": "0x…", "contentId": "…", "contentTitle": "Premium Post", "contentUrl": "https://fortune.nibgate.xyz/writing/premium-post", "domain": "fortune.nibgate.xyz", "amount": 0.01, "currency": "USDC", "timestamp": "2026-07-28T19:17:24.000Z", "paymentId": "…", "txHash": "0x…", "chainId": "5042002", "network": "eip155:5042002", "paymentProvider": "circle-gateway", "receiptUrl": "…", "payerWallet": "0x…", "recipientWallet": "0x…", "status": "verified" } ], "totals": { "views": 300, "unlocks": 160, "payments": 175, "ratings": 70, "total": 705 }, "hasMore": false }

The ledger is also available as a UI at https://nibgate.xyz/ledger with search, filtering, expandable row details, and live updates.

Tips

Nib Tips pay the creator of any page. A resolved creator settles instantly; an unresolved (external) creator’s tip is held in a no-key per-domain box until claimed, and is refundable by the payer meanwhile. Full flows on the Nib Tips page.

POST /hub/tips/challenge # tip challenge for a resolved creator (x402 envelope, payTo) POST /hub/tips/verify # record a settled tip after paying the challenge POST /hub/tips/hold # no proof → box challenge; with txHash → record a held tip GET /hub/tips/held?domain= # exact-domain lookup; accepts a domain or page URL, including external sites POST /hub/tips/claim # creator releases a domain's box (siteId + verifyToken) POST /hub/tips/refund # payer refunds unclaimed held tips (signed control message)
EndpointKey fields
challengecontentUrl (req), amount (req), recipient (req unless the hub index resolves the URL), paymentRail (transfer / gateway) → accepts[0].payTo, payee, feeBps, protocolFee
verifysame + txHash (transfer) or paymentSignature (gateway) + walletAddress → receipt, status: settled
holdcontentUrl, amount, domain (defaults to hostname); second call adds txHash, walletAddress → holdStatus: held, box
helddomain (req; domain or URL), limit (max 100 rows) → domain, latest tips, all-match count and total
claimsiteId, token (verifyToken) req; creatorWallet/claimToken when claiming to a non-owner wallet → releaseTx, feeBps: 500, protocolFee
refunddomain, payer, message, signature req (EIP-191, signer must equal payer); optional amount cap → refundTx; 202 while Gateway credit settles, 404 when nothing is held

Refunds only ever touch held rows and only ever return funds to the signing payer, full amount, no fee. See Nib Tips and the holding contracts for the on-chain mechanics.

The held-tip lookup is public and does not require site registration. It matches the exact normalized host (www is treated as an alias; subdomains are distinct) and is scoped to the API network used. External pages can be checked even when not indexed by Nibgate, but returned title/image metadata is only available when the tipper supplied it or matching indexed content can provide it. The browser checker is linked from the public ledger  and is available at https://nibgate.xyz/pending-tips (mainnet) and https://testnet.nibgate.xyz/pending-tips (testnet).

Reputation & ratings

Ratings are built from verified unlock eligibility, not raw votes:

POST /hub/reputation/ratings/prepare # prepare the rating message, content hash and contract configuration POST /hub/reputation/ratings/index # verify and index an onchain rating transaction POST /hub/reputation/ratings/sync # reconcile indexed rating proofs GET /hub/reputation/ratings/stats?contentId= # hub-authoritative rating read (average 1-5, count); never recompute the content hash locally GET /hub/reputation/leaderboards # content / site / creator leaderboards POST /hub/content/:contentId/rate # rating surface for a resource

Nibshare

The hosted quick-share rail lives at /ns/<slug> on the hub and /nibshare on the API host. Every gated share enforces the shared access rule — a bare ?wallet= is a claim only, never an identity:

GET /nibshare/:slug/quote # price + policy for the share GET /nibshare/:slug/meta # public metadata GET /nibshare/:slug/manifest # machine-readable contract for agents GET /nibshare/:slug/access # access decision; 200 grant / 402 challenge / 403 deny POST /nibshare/:slug/unlock # x402 unlock; binds proof to (wallet, share) GET /nibshare/:slug/media/:kind # encrypted media (proof-gated for paid/invite-only) DELETE /nibshare/:slug/entitlements/:wallet # restore (un-ban / un-revoke) an entitlement POST /nibshare/:slug/entitlements/:wallet/ban # ban (hard deny, no re-purchase) POST /nibshare/:slug/entitlements/:wallet/revoke # revoke (may re-purchase) PUT /nibshare/:slug/access-control # edit price/whitelist/publicAccess (owner + SIWE) GET /nibshare/:slug/access-control # read current whitelist/tier/invite policy POST /nibshare/:slug/view # imply a view GET /nibshare/stats # public platform aggregates GET /nibshare/dashboard # per-owner dashboard stats (owner + SIWE) POST /nibshare/gateway/balance # depositor USDC balance

Error semantics: 402 = payment challenge, 403 = denied (invite-only, banned, revoked, or payer ≠ possessed wallet), 404 = draft/unpublished, 410 = revoked, 419 = expired. Full detail: backend/src/server/nibshare/API.md.

Subblogs

Subblog content gates mirror the hub under the subblog’s own origin (/api/... on *.nibgate.xyz):

GET /api/nibgate/access?path=/<type>/<slug> # x402 access; 200 with decrypted content / 402 GET /api/nibgate/manifest?path=… # per-post agent contract GET /api/nibgate/media/:postId/:kind # encrypted media proxy (proof-gated for paid) GET /api/nibgate/posts/:key/quote # price + access decision for a post GET /api/<type>/<slug> # short mirror of the access route PUT /api/nibgate/posts/:key/access-control # edit whitelist/tier/publicAccess (admin only) GET /api/nibgate/posts/:key/access-control # read whitelist/tier/invite policy (admin only) POST /api/nibgate/posts/:key/entitlements/:wallet/{ban,revoke} # gating actions (admin only) DELETE /api/nibgate/posts/:key/entitlements/:wallet # restore (admin only) GET /api/nibgate/gateway/balances # depositor USDC balance (admin)

Non-published posts return 404; invite-only denies non-whitelisted wallets with 403 before any payment. Subblogs admin actions require the sb_auth_session cookie and the admin role (authorize('admin')).

Payment confirmation and safe retries

SDK 0.4.40 and wallet 0.4.31 support Arc mainnet (eip155:5042, https://api.nibgate.xyz) and Arc testnet (eip155:5042002, https://testnet-api.nibgate.xyz). Install @nibgate/sdk@latest and @nibgate/wallet@latest. Configure the application network and matching Hub together; an npm tag does not configure the network automatically.

A wallet transaction hash or Gateway signature means a proof was submitted, not that the Hub recorded a successful tip. A standalone SDK tip without a Hub verification response returns status: 'pending'. Only a successful Hub response confirms settled (resolved tip) or holdStatus: 'held' (funded hold).

On an interrupted response, keep the original proof and exact request fields, including the network, amount, payee and content metadata. Retry verification with that same proof; never send a second payment to repair a missing receipt. The matching completed proof returns HTTP 200 with replayed: true and its existing receipt, without another Tip row or another Gateway settlement. Reusing a proof with different request fields is rejected. Legacy proofs without the new verified binding fail closed.

HTTP 409 payment-proof-already-used means the proof is reserved or recorded with a different or unverifiable binding. HTTP 409 payment-verification-pending means its durable reservation has not completed. Stop automatic payment attempts; inspect the existing transaction/receipt and reconcile ambiguous settlement with the operator. Pending reservations are not automatically cleared or settled again. A transport or server error after submission is not evidence that no payment occurred. An unconfirmed direct-transfer receipt returns HTTP 402; retrying its read-only verification is safe. If a facilitator settlement is lost before database completion, the stored proof and transaction require reconciliation. Held-tip claim/refund relays have their own outcome checks.

Google wallet compatibility: wallet 0.4.31 checks already-authorized accounts before SIWE, closes the AppKit sheet before the embedded signature prompt, and configures Reown’s Arc RPC routes on both networks. This avoids overlapping dialogs and Magic iframe restrictions on direct Arc RPC hosts. Nibgate’s application RPC proxies remain read-only; wallet signing still requires user approval.

Last updated on