Skip to content
GitHub

Assets

An asset represents an item of value that can be transferred via the Interledger Protocol. Assets in Rafiki can be added through the Backend Admin API or the Rafiki Admin application.

Add an asset using the CreateAsset GraphQL mutation

CreateAsset mutation

mutation CreateAsset($input: CreateAssetInput!) {
createAsset(input: $input) {
code
success
message
asset {
id
code
scale
}
}
}

Example

To add US dollars, for example, as an asset type to your Rafiki instance, call the CreateAsset mutation and pass the input parameters for the asset code, represented by its ISO 4217 currency code (USD), and scale variables as follows:

Example JSON request

{
"input": {
"code": "USD",
"scale": 2
}
}
VariableDescription
codeThe asset code, generally an ISO 4217 currency code where available.
scaleDifference in order of magnitude between the standard unit and a fractional unit.

Example JSON response

{
"data": {
"createAsset": {
"code": "200",
"success": true,
"message": "Created Asset",
"asset": {
"id": "b3dffeda-1e0e-47d4-82a3-69b1a622eeb9",
"code": "USD",
"scale": 2
}
}
}
}