apyhub
DEVELOPER TOOLS

Convert Number Bases API

What it does

Number Base Converter converts integers between bases 2 through 36. Send a string value, optionally set from_base, and choose a to_base for the output. It accepts common prefixes like 0x, 0o, and 0b, so you can pass hexadecimal, octal, binary, or plain base-N strings without pre-processing them first.

Use it when you need to normalize numeric identifiers, display values in a different radix, or support developer-facing inputs that may arrive in mixed formats. The input schema only requires value, with to_base and from_base available when you need to override the defaults. from_base can also be set to 0 to auto-detect the input base.

The endpoint returns a structured JSON response. That makes it easy to chain into internal tools, code generators, validators, or admin workflows where numbers need to be reformatted before storage, comparison, or display.

If your app handles bit flags, color codes, hashes, or low-level debugging values, Number Base Converter gives you a simple way to translate them without writing base conversion logic yourself.

POST
Convert integers between any bases (2-36).
http://localhost:8080/creightonnick0/convert-number-bases
QUICKSTARTGUIDE

Quickstart

Convert a number from one base to another by sending the value and target base.

curl -X POST "http://localhost:8080/creightonnick0/convert-number-bases" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"value":"0xff","to_base":2,"from_base":0}'

What you'll get back

Returns the converted value in the requested base along with common number representations such as binary, octal, decimal, hexadecimal, bit length, and byte size.

{
  "input": "0xff",
  "decimal": 255,
  "binary": "11111111",
  "octal": "377",
  "hex": "ff",
  "to_base": 2,
  "result": "11111111",
  "bit_length": 8,
  "byte_size": 1,
  "is_negative": false
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
The number to convert (may include 0x/0o/0b prefix)
Target base for the result, 2-36 (default 16)
Base of the input, 2-36, or 0 to auto-detect (default 0)

About this endpoint

What it does

Converts an integer string from one base to another, using the request body fields to define the input value and the source and target bases. The endpoint accepts an input value that may include 0x/0o/0b prefixes and returns a structured JSON response.

Request Body

ParameterTypeMandatoryDescription
valueStringYesThe number to convert; may include a 0x/0o/0b prefix.
to_baseIntegerNoTarget base for the result, from 2 to 36. Default: 16.
from_baseIntegerNoBase of the input, from 2 to 36, or 0 to auto-detect. Default: 0.

Response

FieldTypeDescription
inputStringThe original input value as submitted.
decimalIntegerDecimal (base-10) representation.
binaryStringBinary (base-2) representation.
octalStringOctal (base-8) representation.
hexStringHexadecimal (base-16) representation.
to_baseIntegerThe target base used for result.
resultStringThe converted value in the requested to_base.
bit_lengthIntegerNumber of bits required to represent the value.
byte_sizeIntegerMinimum number of bytes required to store the value.
is_negativeBooleanWhether the input value is negative.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.