# Asset

## Module endpoints

* [`GET /assets`](#get-assets)
* [`GET /assets/:code`](#get-assets-code)
* [`PATCH /assets/:code`](#patch-assets-code)
* [`POST /assets`](#post-assets)

### `GET /assets`

> `GET` <https://api.slyk.i&#x6F;**/assets>\*\*

Returns a paginated list of `assets`.

{% tabs %}
{% tab title="Available Filters" %}

| Name        |      Type      | Example                       |
| ----------- | :------------: | ----------------------------- |
| **code**    | `=` `in` `nin` | `filter[code]=in:usd,eur,btc` |
| **enabled** |       `=`      | `filter[enabled]=true`        |
| **name**    |     `like`     | `filter[name]=bit`            |
| **system**  |       `=`      | `filter[system]=false`        |
| **type**    | `=` `in` `nin` | `filter[code]=nin:fiat`       |

{% hint style="info" %}
The `name` filter performs a `SQL` query using the `like` operator.
{% endhint %}
{% endtab %}

{% tab title="Available Sorts" %}

| Name          | Example                                                            |
| ------------- | ------------------------------------------------------------------ |
| **createdAt** | <p><code>sort=createdAt</code><br><code>sort=-createdAt</code></p> |
| **enabled**   | <p><code>sort=enabled</code> <br><code>sort=-enabled</code></p>    |
| **system**    | <p><code>sort=system</code> </p><p><code>sort=-system</code></p>   |
| **type**      | <p><code>sort=type</code> </p><p><code>sort=-type</code></p>       |
| {% endtab %}  |                                                                    |

{% tab title="Paginate Options" %}

| Name         | Description                                             | Example          |
| ------------ | ------------------------------------------------------- | ---------------- |
| **size**     | Defines the number of results per page. Default = 30.   | `page[size]=2`   |
| **number**   | Defines the number of the page to retrieve. Default = 1 | `page[number]=2` |
| {% endtab %} |                                                         |                  |

{% tab title="Response" %}

```javascript
{
  "data": [
    {
      "code": "bar",
      "contract": {},
      "createdAt": "2019-07-20T14:30:37.483Z",
      "customData": {
        "description": "Foobar currency"
      },
      "decimalPlaces": 2,
      "enabled": true,
      "logo": null,
      "metadata": {},
      "name": "Foobar",
      "symbol": "ƒ",
      "system": false,
      "type": "custom",
      "updatedAt": "2019-07-20T14:30:37.483Z"
    },
    {
      "code": "btc",
      "contract": {},
      "createdAt": "2019-07-20T14:30:37.483Z",
      "customData": {},
      "decimalPlaces": 8,
      "enabled": true,
      "logo": null,
      "metadata": {},
      "name": "Bitcoin",
      "symbol": "BTC",
      "system": true,
      "type": "crypto"
      "updatedAt": "2019-07-20T14:30:37.483Z"
    }
  ],
  "total": 2
}
```

{% endtab %}
{% endtabs %}

### `GET /assets/:code`

> `GET` <https://api.slyk.i&#x6F;**/assets/:code>\*\*

Returns the `asset` details of the given `code`.

{% tabs %}
{% tab title="Response" %}

```javascript
{
  "data": {
    "code": "ltc",
    "contract": {},
    "createdAt": "2019-07-20T14:30:37.483Z",
    "customData": {},
    "decimalPlaces": 8,
    "enabled": true,
    "logo": null,
    "metadata": {},
    "name": "Litecoin",
    "symbol": "LTC",
    "system": true,
    "type": "crypto",
    "updatedAt": "2019-07-20T14:30:37.483Z"
  }
}
```

{% endtab %}
{% endtabs %}

### `PATCH /assets/:code`

> `PATCH` <https://api.slyk.i&#x6F;**/assets/:code>\*\*

Patch the `asset` details of the given `code`.

{% tabs %}
{% tab title="Request Parameters" %}

| Name              |    Type   | Required | Description                                                     |
| ----------------- | :-------: | :------: | --------------------------------------------------------------- |
| **contract**      |  `object` |  `false` | Asset contract configuration. Only applicable to crypto assets. |
| **customData**    |  `object` |  `false` | Can store additional information about the asset.               |
| **decimalPlaces** | `integer` |  `false` | Number of decimal places.                                       |
| **enabled**       | `boolean` |  `false` | Asset availability.                                             |
| **logo**          |  `string` |  `false` | Asset logo.                                                     |
| **name**          |  `string` |  `false` | Asset name.                                                     |
| **symbol**        |  `string` |  `false` | Asset symbol. Max length: 16.                                   |
| {% endtab %}      |           |          |                                                                 |

{% tab title="Request" %}

```javascript
{
  "decimalPlaces": 6,
  "name": "Foobiz"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "code": "biz",
    "contract": {},
    "createdAt": "2019-07-20T14:30:37.483Z",
    "customData": {
      "description": "Foobar currency"
    },
    "decimalPlaces": 6,
    "enabled": true,
    "logo": null,
    "metadata": {},
    "name": "Foobiz",
    "symbol": "Bz",
    "system": false,
    "type": "custom",
    "updatedAt": "2019-07-20T14:30:37.483Z"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /assets`

> `POST` <https://api.slyk.i&#x6F;**/assets>\*\*

Creates a new `asset`.

{% tabs %}
{% tab title="Request Parameters" %}

| Name              |    Type   | Required | Description                                                     |
| ----------------- | :-------: | :------: | --------------------------------------------------------------- |
| **code**          |  `string` |  `true`  | Asset identifier code. Must only contain digits and letters.    |
| **contract**      |  `object` |  `false` | Asset contract configuration. Only applicable to crypto assets. |
| **customData**    |  `object` |  `false` | Can store additional information about the asset.               |
| **decimalPlaces** | `integer` |  `true`  | Number of decimal places.                                       |
| **enabled**       | `boolean` |  `false` | Asset availability.                                             |
| **name**          |  `string` |  `true`  | Asset name.                                                     |
| **symbol**        |  `string` |  `false` | Asset symbol. Max length: 16.                                   |
| **type**          |  `string` |  `true`  | Asset type: `crypto`, `custom` or `fiat`.                       |
| {% endtab %}      |           |          |                                                                 |

{% tab title="Request" %}

```javascript
{
  "code": "kes",
  "customData": {
    "descritpion": "Currency of Kenya."
  },
  "decimalPlaces": 2,
  "enabled": true,
  "name": "Kenyan Shilling",
  "symbol": "KSh",
  "type": "fiat"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "code": "kes",
    "contract": {},
    "createdAt": "2019-07-20T14:30:37.483Z",
    "customData": {
      "descritpion": "Currency of Kenya."
    },
    "decimalPlaces": 2,
    "enabled": true,
    "logo": null,
    "metadata": {},
    "name": "Kenyan Shilling",
    "symbol": "KSh",
    "system": false,
    "type": "fiat",
    "updatedAt": "2019-07-20T14:30:37.483Z"
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.slyk.io/slyk/reference/endpoints/asset.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
