Skip to main content

Client Configuration

The Urblock class is the main entry point. It accepts a bearer credential and optional configuration.

Constructor​

import { Urblock } from "@urblock/sdk";

const urblock = new Urblock(apiKey, config?);

Parameters​

ParameterTypeRequiredDescription
apiKeystringYesBearer credential used in the Authorization header. Most SDK resources use API keys (sk_live_..., sk_test_..., pk_live_..., or pk_test_...). Some dashboard-scoped flows use JWT bearer tokens.
configUrblockConfigNoConfiguration overrides

UrblockConfig​

PropertyTypeDefaultDescription
baseUrlstringhttps://api.urblock.ioBase URL of the Urblock API
timeoutnumber30000Request timeout in milliseconds
fetchtypeof fetchglobalThis.fetchCustom fetch implementation
headersRecord<string, string>{}Default headers merged into every request

Examples​

Default Configuration​

const urblock = new Urblock("sk_test_...");

Dashboard JWT​

const urblock = new Urblock("eyJhbGciOi...");

Use a JWT bearer token only for SDK methods backed by dashboard-authenticated endpoints.

Custom Base URL​

const urblock = new Urblock("sk_test_...", {
baseUrl: "https://api.staging.urblock.io",
});

Custom Timeout​

const urblock = new Urblock("sk_test_...", {
timeout: 60_000, // 60 seconds
});

Custom Fetch (e.g., undici)​

import { fetch } from "undici";

const urblock = new Urblock("sk_test_...", {
fetch,
});

Custom Headers​

const urblock = new Urblock("sk_test_...", {
headers: {
"X-Custom-Header": "my-value",
},
});

Available Resources​

Once initialized, the client exposes these resources as readonly properties:

PropertyResourceDescription
connectConnectResourceSmart accounts, passkeys, recovery, analytics
tokensTokensResourceToken deployment, reads, pause/unpause
transactionsTransactionsResourceMint, transfer, burn, approve operations
networksNetworksResourceSupported blockchain networks
webhooksWebhooksResourceWebhook endpoint management
eventsEventsResourceAudit log / webhook events
governanceGovernanceResourceGovernor + Timelock governance
identitiesIdentitiesResourceT-REX ONCHAINID identities
complianceComplianceResourceT-REX compliance modules
trustedIssuersTrustedIssuersResourceT-REX trusted issuers registry
claimTopicsClaimTopicsResourceT-REX claim topics registry
trexTrexResourceT-REX token operations
rolesRolesResourceOn-chain access control roles
vestingVestingResourceVestingWallet schedules
vaultsVaultsResourceERC-4626 tokenized vaults
gasEstimatesGasEstimatesResourceGas estimation
batchBatchResourceBatch operations
chainlinkChainlinkResourceChainlink Price Feeds + VRF v2.5
multisigMultisigResourceSafe{Wallet} multisig wallets
tbaTbaResourceToken Bound Accounts (ERC-6551)
faucetFaucetResourceTestnet faucet
billingBillingResourceBilling plans, subscriptions, usage
analyticsAnalyticsResourceTenant analytics and metrics

Top-Level Methods​

The client also exposes two methods directly:

health()​

Health check endpoint.

const health = await urblock.health();
// { status: "ok", timestamp: "2025-01-01T00:00:00.000Z", version: "1.0.0" }

GET /health is public, but the SDK still sends the bearer credential configured on the client.

status()​

Detailed service status.

const status = await urblock.status();
// { object: "status", status: "operational", services: { ... }, timestamp: "..." }

GET /v1/status requires a valid API key or JWT bearer token.

TypeScript Support​

All types are exported from the package:

import type {
TokenResponse,
TransactionResponse,
ListResponse,
UrblockConfig,
UrblockError,
} from "@urblock/sdk";

Resource classes are also exported for advanced usage:

import { TokensResource, HttpClient } from "@urblock/sdk";