Radix Babylon Gateway API (0.1.0)

Download OpenAPI specification:Download

This API is designed to enable clients to efficiently query information on the RadixDLT ledger, and allow clients to build and submit transactions to the network. It is designed for use by wallets and explorers.

This document is an API reference documentation, visit User Guide to learn more about different usage scenarios.

The Gateway API is implemented by the Network Gateway, which is configured to read from full node(s) to extract and index data from the network.

Sub-APIs

The Gateway API is split into 4 sub APIs:

  • Status (/status/*) - For status and configuration details for the Gateway / Network.
  • Transaction (/transaction/*) - For transaction construction, preview, submission, and monitoring the status of an individual transaction.
  • Stream (/transaction/*) - For reading committed transactions.
  • State (/state/*, /entity/* and /non-fungible/*) - For reading the current or past ledger state of the network.

Concepts

Interacting with this API effectively may require knowledge about the Radix Babylon Transaction Model and the State Model.

We share some very high-level details below, but please see the official documentation for more details on this.

Transactions and the Gateway

User transactions are formed of a core "intent", which is then signed by 0+ signatories, before being notarized. The output is called a notarized payload. It is this notarized transaction payload which is submitted to the network.

For most users, this construction process will generally happen in their Radix Wallet. If you wish to construct transactions programmatically or offline, you will need to integrate the Radix Engine Toolkit into your application for construction and finalization.

Once submitted, a transaction payload can end up being either rejected or committed. Transactions get rejected if they fail to pass certain criteria at the given time. A transaction payload can be marked as a:

  • Permanent Rejection if it is never possible for it to be committed (eg it's statically invalid, or only valid up until epoch 100 and it's now epoch 101)
  • Temporary Rejection if it still may be possible that the transaction payload could be committed

A given intent typically is only part of one submitted notarized payload, but it's possible for a notary to notarize and submit multiple payloads for the same intent. The Radix Engine ensures that any intent can only be committed once.

A committed transaction is either committed with an outcome of "Success" or "Failure":

  • Committed Failure will result in fees being paid up until the failure point, but all other changes will be discarded.
  • Committed Success will result in all changes being committed.

Only committed transactions appear on ledger.

The gateway will attempt to submit your transaction to nodes on the network. If it gets temporarily rejected, the error message will be recorded against the transaction, but the Gateway will retry submission for a limited time. During this time, the status will be reported as pending.

State Model

The Radix Engine consists of "global entities". A global entity has a Bech32m Address, with a human-readable-prefix (and prefix byte) matching the entity type.

As an example, entities include concepts like Components, Packages, Vaults, Resource Managers and Key-Value Stores.

Each entity owns substates which store data, and these substates can own other entities. For example, an Account Component has a struct substate which owns a Key-Value Store. This Key-Value store has an entry for each resoure the Account owns, and each Key-Value Store Entry owns a corresponding Vault.

For each global entity, the Gateway aggregates its owned resources by looking at the contents of Vaults in the subtree of entities under that global entity.

Architecture

Request-Response Format

The API is designed in a JSON-RPC-like style, using HTTP as a transport layer, which means that:

  • Requests always use HTTP POST method.
  • There is no HTTP cache involved.
  • Client-originated errors result in HTTP 4xx error responses.
  • Server-originated errors result in HTTP 5xx error responses:
    • The error object contains an HTTP-like code
    • The error object also contains a structured/typed properties, with a type discriminator, allowing for structured error interpretation in client software.

Pagination Model

Collections can grow in size therefore every dynamic-length collection is a subject to pagination where a generic data struct is used to represent a chunk (page) of underlying data. Gateway API uses cursor-based pagination model where the sole existence of the cursor indicates that next chunk (page) of the underlying collection is available.

collection {
  int64? total_count,
  string? next_cursor,
  string? previous_cursor,
  T[] items
}
  • total_count (optional) if present specifies the overall size of the underlying collection,
  • next_cursor (optional) if present indicates that the next chunk (page) exists and can be fetched using collection-specific endpoint and cursor value,
  • previous_cursor (optional) if present indicates that the previous chunk (page) exists and can be fetched using collection-specific endpoint and cursor value,
  • items a chunk (page) of unerlying collection items.

Status Endpoints

Query information about the Gateway API status.

Get Gateway Information

Returns the Gateway API version, current ledger state and well-known network addresses.

Responses
200

Network Gateway Information

post/gateway/information
Response samples
application/json
{
  • "ledger_state": {
    },
  • "known_target": {
    },
  • "release_info": {
    },
  • "well_known_addresses": {
    }
}

Transaction Endpoints

Query status of, construct, preview and submit transactions.

Get Construction Metadata

Returns information needed to construct a new transaction including current epoch number.

Responses
200

Returns information needed to construct transaction.

post/transaction/construction
Response samples
application/json
{
  • "ledger_state": {
    }
}

Preview Transaction

Previews transaction against the network. This endpoint is effectively a proxy towards CoreApi's /v0/transaction/preview endpoint. See CoreApi's documentation for more details.

Request
Request Body schema: application/json
object

Refer to #/components/schemas/TransactionPreviewRequest of CoreApi for more details.

Responses
200

Successful Preview

4XX

Client-originated request error

post/transaction/preview
Request samples
application/json
{ }
Response samples
application/json
{ }

Submit Transaction

Submits a signed transaction payload to the network.

Request
Request Body schema: application/json
notarized_transaction_hex
required
string (NotarizedTransactionHexString)

Hex-encoded notarized transaction payload which can be submitted.

Responses
200

Successful Submission

4XX

Client-originated request error

post/transaction/submit
Request samples
application/json
{
  • "notarized_transaction_hex": "string"
}
Response samples
application/json
{
  • "duplicate": true
}

Get Committed Transaction Details

Returns the committed details and receipt of the transaction for a given transaction identifier. Transaction identifiers which don't correspond to a committed transaction will return a TransactionNotFoundError.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

required
object (TransactionCommittedDetailsRequestIdentifier)
Responses
200

Transaction Status

4XX

Client-originated request error

post/transaction/committed-details
Request samples
application/json
{
  • "transaction_identifier": {
    }
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "transaction": {
    },
  • "details": {
    }
}

Get Transaction Status

Returns overall transaction status and all of its known payloads based on supplied intent hash.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

intent_hash_hex
required
string (HashHexString)

Hex-encoded SHA-256 hash.

Responses
200

Transaction Status

4XX

Client-originated request error

post/transaction/status
Request samples
application/json
{
  • "intent_hash_hex": "<transaction-intent-hash>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "status": "unknown",
  • "known_payloads": [
    ],
  • "error_message": "string"
}

Stream Endpoints

Browse through the history of transactions.

Get Recent Transactions

Returns user-initiated transactions which have been committed to the ledger. The returned response is in a paginated format, ordered by most recently committed.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit
integer or null

The page size requested.

Responses
200

Recent Transactions (paginated)

4XX

Client-originated request error

post/transaction/recent
Request samples
application/json
{
  • "limit": 5
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "total_count": 0,
  • "previous_cursor": "string",
  • "next_cursor": "string",
  • "items": [
    ]
}

State Endpoints

Query information snapshot about state of ledger entities at present or past time.

Get Entities Overview

Returns basic information (incomplete metadata) for a given collection of entities. This endpoint is intended to be used for populating screens which contain a small bit of information about multiple entities.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

addresses
required
Array of strings (EntityAddress)
Responses
200

Entities Overview

4XX

Client-originated request error

post/entity/overview
Request samples
application/json
{
  • "addresses": [
    ]
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "entities": [
    ]
}

Get Entity Details

Returns detailed information for a single entity.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

address
required
string (EntityAddress)

Bech32m-encoded human readable version of the entity's global address.

Responses
200

Entity Details

4XX

Client-originated request error

post/entity/details
Request samples
application/json
{
  • "address": "<entity-address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "address": "string",
  • "metadata": {
    },
  • "details": {
    }
}

Get Entity Resource Totals

Returns the total amount of each fungible and non-fungible resources owned by a given global entity. The response for fungibles and non-fungibles is paginated, and only the first page of each is returned. The returned lists are ordered by the resource's first appearance on the ledger. For further pages, use the entity/fungibles and entity/non-fungibles endpoints. To get the owned non-fungible ids (instead of just the amount), use the entity/non-fungible-ids endpoint.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

address
required
string (EntityAddress)

Bech32m-encoded human readable version of the entity's global address.

Responses
200

Entity Resources

4XX

Client-originated request error

post/entity/resources
Request samples
application/json
{
  • "address": "<component-entity-address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "address": "string",
  • "fungible_resources": {
    },
  • "non_fungible_resources": {
    }
}

Get Entity Metadata

Returns all the metadata properties associated with a given global entity. The returned response is in a paginated format, ordered by first appearance on the ledger.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

address
required
string (EntityAddress)

Bech32m-encoded human readable version of the entity's global address.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit
integer or null

The page size requested.

Responses
200

Entity Metadata (paginated)

4XX

Client-originated request error

post/entity/metadata
Request samples
application/json
{
  • "address": "<entity-address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "address": "string",
  • "metadata": {
    }
}

Get Entity Fungible Resource Totals

Returns the total amount of each fungible resource owned by a given global entity. The returned response is in a paginated format, ordered by the resource's first appearance on the ledger.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

address
required
string (EntityAddress)

Bech32m-encoded human readable version of the entity's global address.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit
integer or null

The page size requested.

Responses
200

Entity Fungibles (paginated)

4XX

Client-originated request error

post/entity/fungibles
Request samples
application/json
{
  • "address": "<component-entity-address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "address": "string",
  • "fungibles": {
    }
}

Get Entity Non-Fungible Resource Totals

Returns the total amount of each non-fungible resource owned by a given global entity. The returned response is in a paginated format, ordered by the resource's first appearance on the ledger.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

address
required
string (EntityAddress)

Bech32m-encoded human readable version of the entity's global address.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit
integer or null

The page size requested.

Responses
200

Entity Non-Fungibles (paginated)

4XX

Client-originated request error

post/entity/non-fungibles
Request samples
application/json
{
  • "address": "<component-entity-address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "address": "string",
  • "non_fungibles": {
    }
}

Get Entity Non-Fungible IDs

Returns all non-fungible IDs of a given non-fungible resource owned by a given entity. The returned response is in a paginated format, ordered by the resource's first appearence on the ledger.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

address
required
string (EntityAddress)

Bech32m-encoded human readable version of the entity's global address.

resource_address
string (ResourceAddress)

Bech32m-encoded human readable version of the resource (fungible, non-fungible) global address.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit
integer or null

The page size requested.

Responses
200

Entity Non-Fungible IDs (paginated)

4XX

Client-originated request error

post/entity/non-fungible/ids
Request samples
application/json
{
  • "address": "<component-entity-address>",
  • "resource_address": "<non-fungible-resource-entity-address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "address": "string",
  • "resource_address": "string",
  • "non_fungible_ids": {
    }
}

Get Non-Fungible Collection

Returns the non-fungible IDs of a given non-fungible resource. Returned response is in a paginated format, ordered by their first appearance on the ledger.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

address
required
string (EntityAddress)

Bech32m-encoded human readable version of the entity's global address.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit
integer or null

The page size requested.

Responses
200

Non-Fungible IDs (paginated)

4XX

Client-originated request error

post/non-fungible/ids
Request samples
application/json
{
  • "address": "<non-fungible-entity-address>"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "address": "string",
  • "non_fungible_ids": {
    }
}

Get Non-Fungible Data

Returns data associated with a given non-fungible ID of a given non-fungible resource.

Request
Request Body schema: application/json
object or null (LedgerStateSelector)

Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.

address
required
string (EntityAddress)

Bech32m-encoded human readable version of the entity's global address.

non_fungible_id
required
string (NonFungibleId)

String-encoded non-fungible ID.

cursor
string or null

This cursor allows forward pagination, by providing the cursor from the previous request.

limit
integer or null

The page size requested.

Responses
200

Non-Fungible ID Data

4XX

Client-originated request error

post/non-fungible/data
Request samples
application/json
{
  • "address": "<non-fungible-entity-address>",
  • "non_fungible_id": "0a0100000000"
}
Response samples
application/json
{
  • "ledger_state": {
    },
  • "address": "string",
  • "non_fungible_id_type": "string",
  • "non_fungible_id": "string",
  • "mutable_data_hex": "string",
  • "immutable_data_hex": "string"
}