{"uid":"cap_I3_XrhRGNzhx7A-mhzmoL","slug":"token-amount-to-raw-units-20c3e20f","name":"Token Amount to Raw Units","description":"Scale human token amounts by decimals into on-chain raw units. Call when building ERC-20 transfer/approve amounts from UI-facing quantities. Returns raw integer string, amount, and decimals used as deterministic JSON for $0.001 USDC via x402 on Base. First-party local math only—no RPC, live market feed, API keys, storage, or mediagen. Advisory only; the caller owns capital, risk, and production controls.","url":"https://api.delx.ai/api/v1/x402/token-amount-to-raw","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"amount":{"type":"number","description":"Input field: amount."},"decimals":{"type":"integer","description":"Input field: decimals."}}},"responseSchema":{"type":"json","example":{"raw":"1250000","amount":1.25,"schema":"delx/util-token-amount-to-raw/v1","decimals":6}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","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.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_G77tPtfbR4gTNtNsbSaJv","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Converts a human-readable ERC-20 token amount into its on-chain raw integer representation by scaling by the token's decimal places.","exampleAgentPrompt":"Convert 0.001 USDC — which uses 6 decimals — into its raw on-chain integer units so I can use it in an ERC-20 transfer call.","exampleUseCases":[{"title":"ERC-20 transfer amount preparation","prompt":"I want to send 50 USDC to a wallet address — USDC has 6 decimals. What's the raw integer amount I need to put in the transfer function?"},{"title":"ERC-20 approve amount for DeFi protocol","prompt":"I'm approving a DeFi contract to spend 1000 DAI on my behalf. DAI has 18 decimals — give me the exact raw integer I need for the approve call."},{"title":"Micro-payment amount scaling for x402","prompt":"I need to charge exactly 0.001 USDC as a micro-payment using 6 decimals. What's the raw on-chain unit value I should include in the payment transaction?"}],"resultDescription":"A deterministic JSON response containing the raw integer string (e.g. '1000000' for 1 USDC with 6 decimals), the original human-readable amount, and the decimals value used in the computation. No external calls are made — the result is pure local arithmetic.","failureModes":["Missing 'amount' field returns a validation error","Missing or invalid 'decimals' field (non-integer or negative) returns an error","Very large decimal values may cause integer overflow edge cases","Floating-point precision issues if amount has more significant digits than decimals allows"],"whenToPreferThis":"Use this endpoint when you need a fast, deterministic, local-math conversion from a human-readable token amount to its on-chain raw integer representation — especially when building ERC-20 transfer or approve payloads. Prefer this over manual arithmetic to avoid floating-point errors. No API key, RPC node, or market feed is required.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T06:58:17.686Z","isFirstParty":false}