Skip to main content

Common Types

Common types are shared by REST API responses and resource models.

ApiResponse

Successful REST API responses use a common response envelope.

type ApiResponse<T> = {
code: string;
message: string;
paging?: object;
data: T;
};
FieldTypeDescription
codestringResponse code. Successful responses use ok.
messagestringHuman-readable response message.
pagingobjectPagination metadata. See Pagination.
dataTResponse payload.

ErrorResponse

REST API errors use a common response envelope.

type ErrorResponse<TData = null> = {
code: string;
message: string;
data: TData | null;
};

The HTTP status is returned as the response status code. It is not included in the response body.

FieldTypeDescription
codestringMachine-readable error code. The possible values depend on the endpoint and failure type.
messagestringHuman-readable error message. This may be a generic message or a validation message.
dataobject | nullOptional error details. This may provide relevant error information when available.

NumericString

Decimal value encoded as a string.

Use NumericString for monetary and asset amounts to preserve precision.

Examples:

15.0000000000000000
0.378000000000000000

IsoDateTimeUtc

ISO 8601 date-time string in UTC.

Example:

2026-05-21T15:24:36.468Z

CurrencyCode

Currency code used by an amount.

Examples:

USDT
TRX