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;
};
| Field | Type | Description |
|---|---|---|
code | string | Response code. Successful responses use ok. |
message | string | Human-readable response message. |
paging | object | Pagination metadata. See Pagination. |
data | T | Response 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.
| Field | Type | Description |
|---|---|---|
code | string | Machine-readable error code. The possible values depend on the endpoint and failure type. |
message | string | Human-readable error message. This may be a generic message or a validation message. |
data | object | null | Optional 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