{"uid":"cap_XwUZnmfmBmIOAaOJH-H55","slug":"fittings-cryptographically-secure-random-bytes-generator-18cfaebe","name":"fittings Cryptographically Secure Random Bytes Generator","description":"Generate CSPRNG bytes from the Web Crypto API, returned as hex, base64 or a UUID. Never Math.random.","url":"https://fittings.sh/v1/crypto/random-bytes","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":[],"properties":{"bytes":{"type":"number","description":"1-1024"},"encoding":{"type":"string","description":"hex | base64 | uuid"}}}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.003103","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.003103/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003103","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003103","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_M6L2qetBEafvYi2UBeQrA","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.003103","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Generates cryptographically secure random bytes using the Web Crypto API (CSPRNG), returned as hex, base64, or UUID string.","exampleAgentPrompt":"Generate 32 cryptographically secure random bytes and return them as a hex string.","exampleUseCases":[{"title":"Secure session token generation","prompt":"I need a cryptographically secure random token for a new user session — can you generate 64 bytes encoded as base64?"},{"title":"UUID for a new database record","prompt":"Give me a secure random UUID to use as a primary key for a new database record — none of that Math.random stuff."},{"title":"Random nonce for CSRF protection","prompt":"Generate 16 cryptographically secure random bytes as hex so I can use them as a CSRF nonce in my form."}],"resultDescription":"A string of cryptographically secure random bytes in the requested encoding: hex (lowercase hexadecimal), base64, or UUID (RFC 4122 v4 format). The output is produced by the Web Crypto API CSPRNG, never Math.random.","failureModes":["bytes parameter out of range (must be 1-1024) — returns error","invalid encoding value (must be hex, base64, or uuid) — returns error","uuid encoding ignores the bytes parameter as UUIDs have a fixed 16-byte structure","network timeout on the fittings.sh host"],"whenToPreferThis":"Choose this endpoint when you need verifiably cryptographically secure random data (CSPRNG quality) rather than pseudo-random numbers from Math.random. Ideal for generating tokens, nonces, salts, session IDs, or UUIDs in server-side agent workflows where a trusted external entropy source is required and local crypto APIs are unavailable or untrusted.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T12:56:49.821Z","isFirstParty":false}