# Token Amount to Raw Units

> Token Amount to Raw Units is a paid API for AI agents from api.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Converts a human-readable ERC-20 token amount into its on-chain raw integer representation by scaling by the token's decimal places.

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/token-amount-to-raw
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/token-amount-to-raw-units-20c3e20f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_I3_XrhRGNzhx7A-mhzmoL

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability token-amount-to-raw-units-20c3e20f -d '<json body>'
```

Example prompt: 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.

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

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.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "amount": {
   "type": "number",
   "description": "Input field: amount."
  },
  "decimals": {
   "type": "integer",
   "description": "Input field: decimals."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "raw": "1250000",
  "amount": 1.25,
  "schema": "delx/util-token-amount-to-raw/v1",
  "decimals": 6
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/token-amount-to-raw-units-20c3e20f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.delx.ai](https://www.zero.xyz/host/api.delx.ai/llms.txt)
