# Introduction

CSPR.cloud is an enterprise-grade middleware platform aimed to super-charge developers and to be the primary way for dApps to interact with the Casper Network. It provides access to indexed and enriched blockchain data, real-time streaming subscriptions, and access to reliable and maintained Casper Node. The APIs include:

* Indexed and normalized network data
* Integrations with the existing fungible and non-fungible (NFT) token standards, such as [CEP-18](https://github.com/casper-ecosystem/cep18), [CEP-47](https://github.com/casper-ecosystem/casper-nft-cep47), and [CEP-95](https://github.com/casper-network/ceps/pull/95)
* Support of the existing smart contract-level event standards, such as [Casper Event Standard (CES)](https://github.com/make-software/casper-event-standard), which is also natively supported by the [Odra smart contract framework](https://github.com/odradev/odra)
* Relevant off-chain data, such as CSPR rates or [account info standard data](https://github.com/make-software/casper-account-info-contract)
* and more

CSPR.cloud was built with developer experience in mind and expands the Casper Node RPC API with more data points and querying possibilities, which are not available via the native node API. You can check for examples in the [Highlights](/documentation/highlights) section.

## Reference

To get familiar with CSPR.cloud, we recommend that you read these documents:

* [Overview](/documentation/overview)\
  Learn about the general technical aspects of CSPR.cloud API, and how it works
* [Getting started](/documentation/getting-started)\
  Learn how to make your first API request and start your integration with the Casper Network
* [Highlights](/documentation/highlights)\
  Learn about CSPR.cloud API possibilities, which aren't present in the Casper Node RPC API
* [REST API](/rest-api/reference)\
  Get familiar with the REST API reference to know what endpoints are available
* [Streaming API](/streaming-api/reference)\
  Get familiar with the Streaming API reference to know what Web Socket subscriptions are available
* [Casper Node API](/casper-node-api/connecting-with-an-sdk)\
  Learn how to connect to the private Casper Node powered by CSPR.cloud using the most popular SDKs
* [x402 Facilitator API](/x402-facilitator-api/reference)\
  Learn how to use the CSPR.cloud x402 facilitator to verify and settle HTTP micropayments on the Casper Network

## Support

If you have any questions or run into any issues while using the CSPR.cloud Web API, you can find help in the [CSPR.cloud Developer Community](https://t.me/CSPRDevelopers). Here you can connect and get help from other developers.

## Legal

By using CSPR.cloud, you agree to our [Developer Terms of Service](https://cspr.cloud/terms-of-service/) and acknowledge that you have read our [Privacy Policy](https://cspr.cloud/privacy-policy/).


# Overview

CSPR.cloud REST API is an HTTP-based API that dApps can use to programmatically query Casper network data. It has predictable resource-oriented endpoints and uses standard HTTP response codes, authentication, and verbs.

CSPR.cloud Streaming API is WebSocket-based and follows the WebSocket standard conventions.

CSPR.cloud x402 Facilitator API enables internet-native HTTP micropayments on the Casper Network, implementing the [x402 open standard](https://x402.org) for payment-gated resources.

## Base URLs

The APIs can be accessed using the following base URLs

### Mainnet

| API                      | Base URL                              |
| ------------------------ | ------------------------------------- |
| CSPR.cloud REST API      | <https://api.cspr.cloud>              |
| CSPR.cloud Streaming API | <wss://streaming.cspr.cloud>          |
| Casper Node RPC API      | <https://node.cspr.cloud>             |
| Casper Node SSE API      | <https://node-sse.cspr.cloud>         |
| x402 Facilitator API     | <https://x402-facilitator.cspr.cloud> |

### Testnet

| API                      | Base URL                              |
| ------------------------ | ------------------------------------- |
| CSPR.cloud REST API      | <https://api.testnet.cspr.cloud>      |
| CSPR.cloud Streaming API | <wss://streaming.testnet.cspr.cloud>  |
| Casper Node RPC API      | <https://node.testnet.cspr.cloud>     |
| Casper Node SSE API      | <https://node-sse.testnet.cspr.cloud> |
| x402 Facilitator API     | <https://x402-facilitator.cspr.cloud> |

## Authorization

The API is protected and requires access tokens to be provided with each request. The access tokens identify the API user and their corresponding access tier limits. Visit the [Authorization](/documentation/overview/authorization) page to learn more.

## Rate limits and quotas

The API is rate-limited, with rate limits defined by the user access tier. The total number of requests to each of the APIs is limited by monthly and daily quotas. Visit the [Rate limits and quotas](/documentation/overview/rate-limits-and-quotas) page to learn more.

## Responses

The API sends data in the JSON format. Successful REST API responses contain the `data` property, which contains the response data:

```json
{
    "data": <ResponseData>
}
```

The Streaming API messages additionally include the `action` and `timestamp` properties:

```json
{
    "action": <string>,
    "data": <MessageData>,
    "timestamp": <datetime>
}
```

## Pagination

Requests that potentially may return an unlimited number of items are paginated. Endpoints that return paginated responses accept the `page` and `limit` query parameters to control the page and the number of items per page, correspondingly. Paginated responses contain two additional properties providing information on the total number of items and the total number of pages:

```json
{
    "data": [<ResponseData>],
    "item_count": <int>,
    "page_count": <int>
}
```

Visit the [Pagination](/documentation/overview/pagination) page to learn more.

## Sorting

Some of the endpoints that return paginated responses provide a possibility to sort the results. Sorting is controlled by the `order_by` and `order_direction` query params. Visit the [Sorting](/documentation/overview/sorting) page to learn more.

## Filtering

Some of the endpoints that return paginated responses provide a possibility to filter the results by certain properties. Available filter properties vary for different endpoints and are specified in the corresponding endpoint documentation. Visit the [Filtering](/documentation/overview/filtering) page to learn more.

## Optional properties

Some of the endpoints provide a possibility to include optional properties into the responses using the `includes` query param. Visit the [Optional properties](/documentation/overview/optional-properties) page to learn more.

## Errors

Error responses contain the `error` property with optional `code`, `message`, and `description` properties providing more information about the error that occurred:

```json
{
    "error": {
        "code": 404,
        "message": "The requested block was not found"
    }
}
```

Visit the [Errors](/documentation/overview/errors) page to learn more.

## Versions

This documentation covers CSPR.cloud V2. Click [here](http://casper-docs.make.software) for CSPR.cloud V1 documentation, which will be deprecated soon.


# Authorization

The CSPR.cloud API is exclusively available to registered users. To authorize your API requests, an access token is required. The access tokens identify the API user and their corresponding access tier limitations. Please visit the [CSPR.cloud](https://cspr.cloud) website to learn about the tiers and to submit an access token request. To learn more about rate limites and quotas please read the [Rate limits and quotas](/documentation/overview/rate-limits-and-quotas) documentation page.

## Authorization header

The access token should be included in the `Authorization` header:

```bash
curl --request GET \
    'https://node.testnet.cspr.cloud/status' \
    --header "Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a"
```

{% hint style="info" %}
The access token provided in the example above is for the demonstration purposes only, and has limited capabilities.
{% endhint %}

To learn how to include the `Authorization` header in Casper SDKs to access the CSPR.cloud Casper Node please read the [Connecting with an SDK](/casper-node-api/connecting-with-an-sdk) page.

## Accessing from a browser

At this moment CPSR.cloud provides only the server side integration. By using your access token in a front-end application, you'll expose it to the world.

## Reporting

You can request the usage report by sending an email from your registered account to <support@cspr.cloud>.


# Rate limits and quotas

At CSPR.cloud, we distinguish between rate limits and quotas to ensure efficient API management.

## Rate limit

We impose a limit on the number of requests per minute. This measure helps manage load and avoid overloading our systems.

## Quotas

Quotas control the overall call rates over an extended period, often tied to subscription tiers.

* **Long-term Management:** Quotas determine the total number of calls that can be made in a set period, like a month.
* **Tier-based Access:** For example, a free tier might allow 10,000 calls per month, while a premium tier could permit up to 10,000,000 calls in the same timeframe.

Exceeding these limits triggers a 429 error, signaling a rate limit breach.

## Free tier limits

The free tier limits are set to ensure that you can test the API and integrate it into your application.

### Mainnet

| Service              | Monthly quota | Daily quota | Rate limit /min |
| -------------------- | ------------- | ----------- | --------------- |
| CSPR.Node Proxy      | 20,000        | 1,200       | 100             |
| CSPR.Node Proxy SSE  | 5,000         | 200         | 10              |
| CSPR.Cloud API       | 100,000       | 6,000       | 100             |
| x402 Facilitator API | 2500          | 2500        | 100             |

### Testnet

| Service              | Monthly quota | Daily quota | Rate limit /min |
| -------------------- | ------------- | ----------- | --------------- |
| CSPR.Node Proxy      | 20,000        | 1,200       | 100             |
| CSPR.Node Proxy SSE  | 5,000         | 200         | 10              |
| CSPR.Cloud API       | 100,000       | 6,000       | 100             |
| x402 Facilitator API | 25            | 25          | 100             |

## Handling limits

To effectively manage your API usage and comply with rate limit or quota, consider the following strategies:

* **Upgrade to Premium Tier:** If your needs exceed the free tier quota, consider upgrading to our Premium tier for higher limits. You can apply at [CSPR.cloud](https://cspr.cloud).
* **Implement a Backoff-Retry Strategy:** In cases where you encounter a 429 error (rate limit or quota exceeded), it's advisable to implement a backoff-retry strategy. This involves reducing the frequency of your API requests to stay within the allowed limits.
* **Monitor API Calls:** Utilize logging tools to monitor your application’s API usage. This can help you identify patterns and optimize your request strategy to ensure efficient usage.
* **Lazy Loading Technique:** To reduce unnecessary API calls, implement lazy loading in your application. Trigger API calls based on user interactions, such as clicking a button or reaching a specific section of a page, to minimize the number of requests.

Adhering to these strategies will help you efficiently manage your API usage within the CSPR.cloud environment.


# Pagination

REST API endpoints that potentially may return an unlimited number of items are paginated.

## Requests

In addition to the endpoint-specific parameters, endpoints that return paginated responses accept the following pagination parameters to control the page and number of items per page correspondingly:

| Parameter   | Type  | Default | Description              |
| ----------- | ----- | ------: | ------------------------ |
| `page`      | `int` |     `1` | Page number              |
| `page_size` | `int` |    `10` | Number of items per page |

The maximum number of items per page is `250`.

## Responses

Paginated responses contain two additional properties providing information on the total number of items and the total number of pages:

| Parameter    | Type  | Description           |
| ------------ | ----- | --------------------- |
| `item_count` | `int` | Total number of items |
| `page_count` | `int` | Total number of pages |

## Example

Get the second page of accounts with `25` items per page:

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts?page=2&page_size=25' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "account_hash": "37f304a6632b214eacc45b85f6a45759194ea69f6684da0bca42d60e42ac8e12",
      "balance": "3050076259180",
      "main_purse_uref": "uref-692b5b8afcad47b0dee74962540a01ea1402fc0c9c84d9474e5766775373795c-007",
      "public_key": "019aa4adcd6f58f92eb4c98c0245e5d86b61de4919245c23ae9e906a6df5d41b0c"
    },
    {
      "account_hash": "7894d8458c82388f6d276c07c1c52033ac37b175fa722b9cc40e7a0157ce17fc",
      "balance": "252442325961483",
      "main_purse_uref": "uref-c4afe0fb020ebcdc940289d759499ff5fb87e999567e4d61d836d70bfad20a55-007",
      "public_key": "0145fb72c75e1b459839555d70356a5e6172e706efa204d86c86050e2f7878960f"
    },
    ...
    {
      "account_hash": "eb108759cf29b5d1ce6a311989890170d94bb98e06e4097e4ee20c18d6bf4f16",
      "balance": "80331298738010",
      "main_purse_uref": "uref-fd73e477cbbeb134ebb7fee8ccb423c8d45c88e23bd82d2d1104fc7f34f3a27b-007",
      "public_key": "0154d4c09bcae885fdd3dc0bf8ac7fa23ae281baf60a5b352b1ff0b505a65e1285"
    }
  ],
  "item_count": 63584,
  "page_count": 2544
}
```

## Traversing results

When making an API request to an endpoint that returns paginated data, you usually don't receive all of the results in a single response. To traverse the data, you need to increment the page number in your requests until you collect all the required items. When doing so, note the [rate limits](/documentation/overview/rate-limits-and-quotas). Setting the number of items per page to its maximum value of `250` will minimize the chances of being rate-limited for most of the use cases.

Note that if new objects are added to the list of items being paginated, the contents of each page will change.


# Sorting

REST API endpoints that return [paginated responses](/documentation/overview/pagination) may provide a possibility to sort the results by one of the result properties. Not all properties can be used for sorting. Please check the endpoint documentation to find out the sorting properties.

## Requests

In addition to the endpoint-specific parameters, endpoints that return sorted results accept the following parameters to control the sorting property and the order:

| Parameter         | Type     | Description                                      |
| ----------------- | -------- | ------------------------------------------------ |
| `order_by`        | `string` | Sorting property the results should be sorted by |
| `order_direction` | `string` | Order direction: ASC or DESC                     |

The defaults are different for different endpoints and are provided in the corresponding endpoint documentation.

## Example

Get blocks sorted by height from lowest to highest:

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/blocks?order_by=block_height&order_direction=ASC' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "block_height": 0,
      "block_hash": "975ea4de188c2a67946188cea0ec8a93d2d38286d7642526d50c45839a291210",
      "parent_block_hash": "0000000000000000000000000000000000000000000000000000000000000000",
      "state_root_hash": "e88b7c061760134ba37ad312c1e2d6373121748e9c61bcea19cc57510829addf",
      "era_id": 0,
      "proposer_public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca",
      "native_transfers_number": 0,
      "contract_calls_number": 0,
      "is_switch_block": false,
      "timestamp": "2021-04-08T17:00:57Z"
    },
    {
      "block_height": 1,
      "block_hash": "f8ebb3a81c9c70faeaec896c94e7e56c75a5e1548e1b8dfe639c1b31610e5d22",
      "parent_block_hash": "975ea4de188c2a67946188cea0ec8a93d2d38286d7642526d50c45839a291210",
      "state_root_hash": "e88b7c061760134ba37ad312c1e2d6373121748e9c61bcea19cc57510829addf",
      "era_id": 0,
      "proposer_public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e",
      "native_transfers_number": 0,
      "contract_calls_number": 0,
      "is_switch_block": false,
      "timestamp": "2021-04-08T17:02:02Z"
    },
    ...
    {
      "block_height": 9,
      "block_hash": "590f7b20a276ef7a2a2fba6871ad781a56fad16daa0ee80b4f214f7870652255",
      "parent_block_hash": "2e601c65dbfde43948eef998b8ab5c68d9f95b35612eb0245444903ea419c185",
      "state_root_hash": "f6985aa0d6dc760fd651f5d86bb3ecb7b9d3b56860b437aa83a0fa489dab9d3b",
      "era_id": 0,
      "proposer_public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e",
      "native_transfers_number": 0,
      "contract_calls_number": 3,
      "is_switch_block": false,
      "timestamp": "2021-04-08T17:10:47Z"
    }
  ],
  "item_count": 2291305,
  "page_count": 229131
}
```


# Filtering

REST and WebSocket API endpoints that return multiple results may provide possibility to filter the data by certain properties. Not all properties can be used as filters. Please check the endpoint documentation to find out what properties are available for filtering.

## Requests

To filter the results by a property, the corresponding property should be provided as a query param. Multiply filters can be used in one request to narrow down the data to what fits your dApp use-case. Some filters can accept multiple values separated by a comma.

## Example

Filter NFT tokens by owner and contract package:

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/nft-tokens?owner_hash=8c9675894eb753007c17058b4616dee224171365f0ac5e161152b1e5c95ce944&contract_package_hash=998af6825d77da15485baf4bb89aeef3f1dfb4a78841d149574b0be694ce4821' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "contract_package_hash": "998af6825d77da15485baf4bb89aeef3f1dfb4a78841d149574b0be694ce4821",
      "is_burned": false,
      "offchain_metadata": null,
      "offchain_metadata_status": 0,
      "onchain_metadata": "eyJuYW1lIjogIlF1aWV0IHBsYWNlcyIsICJhc3NldCI6ICJodHRwczovL21hcml0aW1lLnNlYWxzdG9yYWdlLmlvL21ha2UvOTk4YWY2ODI1ZDc3ZGExNS9iMzQ0NzhkMzkyNjY0OGEyODkzZWNlM2NiNzJiMGIwMSIsICJkZXNjcmlwdGlvbiI6ICJhIGxvZnQgIn0=",
      "owner_hash": "8c9675894eb753007c17058b4616dee224171365f0ac5e161152b1e5c95ce944",
      "owner_type": 0,
      "timestamp": "2022-12-06T18:41:41Z",
      "token_id": "13",
      "token_standard_id": 1,
      "tracking_id": 21455
    },
    {
      "contract_package_hash": "998af6825d77da15485baf4bb89aeef3f1dfb4a78841d149574b0be694ce4821",
      "is_burned": false,
      "offchain_metadata": null,
      "offchain_metadata_status": 0,
      "onchain_metadata": "eyJuYW1lIjogImxpYnJhcnkiLCAiYXNzZXQiOiAiaHR0cHM6Ly9tYXJpdGltZS5zZWFsc3RvcmFnZS5pby9tYWtlLzk5OGFmNjgyNWQ3N2RhMTUvNTQ0ZjI5ZDJiOTZmNDc1ZjhmYWMwMmJmMzY5ZWM2MGUiLCAiZGVzY3JpcHRpb24iOiAiYW5vdGhlciBjb29sIHF1aWV0IHBsYWNlIn0=",
      "owner_hash": "8c9675894eb753007c17058b4616dee224171365f0ac5e161152b1e5c95ce944",
      "owner_type": 0,
      "timestamp": "2022-12-06T18:44:45Z",
      "token_id": "14",
      "token_standard_id": 1,
      "tracking_id": 21456
    }
  ],
  "item_count": 2,
  "page_count": 1
}
```


# Optional properties

Most of the REST API endpoints allow optional data to be included in their responses. It could be related entities, derived properties, [account info standard data](https://github.com/make-software/casper-account-info-contract), or CSPR rates at the moment of the entity creation. Please check the endpoint documentation to find out what optional properties could be included in the responses.

## Requests

Optional data can be included using the `includes` query param that specifies a comma-separated list of all optional data that should be included. The `includes` query param options can be one of three forms:

### Scalar values

To include a scalar value its name should be specified the `includes` list.

### Objects

Similar to scalar values to include an object its name should be specified in the `includes` list. However, for objects it's possible to specify a subset of fields that should be returned using the object querying syntax, which looks like this:

```
includes=account_info{info{owner{name,branding{logo}}}}
```

The request above will return only the `name` and the `branding.logo` properties of the account info object

### Functions

When the included data requires extra parameters, it is included as a function. The function form provides a possibility to specify the needed input. For example, to include the USD to CSPR rate, the USD currency ID `1` should be passed as a parameter to the `rate` function, like this:

```
includes=rate(1)
```

## Examples

### Scalar values

The `WriteTransfer` transforms that are used to track the native token transfers, contain the recipient account hash. It's possible, however, to include the corresponding public key if it is known to us. To learn more, visit the [Transfer REST API](/rest-api/transfer) page.

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/transfers?includes=to_public_key' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "amount": "2500000000",
      "deploy_hash": "0000015dd8b8065e31af7785cd174fa10bebf380f39515ffc3a8a536aee819a0",
      "from_purse": "uref-b8b87efb3d0f6d6f5f4b3bed8a9b017acfcb7ecaf555ec42d852864622e71c9b-007",
      "id": 0,
      "initiator_account_hash": "42204997767147bb78f0045b50272cdfbf90bd10544f9e51d66e0560166de456",
      "timestamp": "2021-10-12T06:20:59Z",
      "to_account_hash": "a8ae349a49ede9df992637e4c9141b5075352b4d607711bd1cf30a76403406c6",
      "to_public_key": "01da93a224201b9936f535502643fe07a922b2010993cdad093acb0112d810c1a8",
      "to_purse": "uref-6626e023ab7ab4837be36a9e61dffcfe239d987039727c9f56408527e48d3968-004",
      "transform_key": "c3fca49f9193ec730e9170a02360d0a96d9f3c07c9b898b6c6494d67b417d886"
    },
    {
      "amount": "2500000000",
      "deploy_hash": "00000498bf7c3994f804a4f8a99378350e02ebf5633774ced4faa2ae6dad88a3",
      "from_purse": "uref-6626e023ab7ab4837be36a9e61dffcfe239d987039727c9f56408527e48d3968-007",
      "id": 0,
      "initiator_account_hash": "a8ae349a49ede9df992637e4c9141b5075352b4d607711bd1cf30a76403406c6",
      "timestamp": "2021-10-13T12:26:47Z",
      "to_account_hash": "42204997767147bb78f0045b50272cdfbf90bd10544f9e51d66e0560166de456",
      "to_public_key": "01c978cd9eb96143ed89f0523c07787207ff4eb84756197a6a1d9093bcd51da4ed",
      "to_purse": "uref-b8b87efb3d0f6d6f5f4b3bed8a9b017acfcb7ecaf555ec42d852864622e71c9b-004",
      "transform_key": "7fd3d2892dc61f43269a55aaeec21158c283717549caf7a820e9cfa966e6df1d"
    },
    ...
    {
      "amount": "1000000000000",
      "deploy_hash": "000026eeab921c16335f65f54ea050efca9cf352840a1025f87b4deaa3bbdd95",
      "from_purse": "uref-b06a1ab0cfb52b5d4f9a08b68a5dbe78e999de0b0484c03e64f5c03897cf637b-007",
      "id": null,
      "initiator_account_hash": "b383c7cc23d18bc1b42406a1b2d29fc8dba86425197b6f553d7fd61375b5e446",
      "timestamp": "2021-10-20T23:59:25Z",
      "to_account_hash": "1b43092d00330439d874c1e4b38bf68b6c9a043aacf72da350e65e46d13e0c51",
      "to_public_key": "01ec83a2a60742294ab33aa86b6cd6c71662d1f37e9a270edc1e768e1a7deaa5c7",
      "to_purse": "uref-f4d64726bf61c2b1f53ce9b137a64a063e8225a98f1cb6ed1a9966ccf983b480-004",
      "transform_key": "f4d64726bf61c2b1f53ce9b137a64a063e8225a98f1cb6ed1a9966ccf983b480"
    }
  ],
  "item_count": 5297116,
  "page_count": 529712
}
```

### Objects

An entity is called related if its identifier is present among the requested entity's properties. To include a related entity you need to specify its name in the `includes` query param. In the example below, we include contract package and contract entry point objects in the deploy list data. To learn more, visit the [Including related entities](/documentation/highlights/including-related-entities) page.

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/deploys?includes=contract_package,contract_entrypoint \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 6664918,
  "page_count": 666492,
  "data": [
    {
      "args": {
        "amount": {
          "cl_type": "U512",
          "parsed": "100000000000"
        },
        "post_id": {
          "cl_type": "U64",
          "parsed": 1
        },
        "source_purse": {
          "cl_type": "URef",
          "parsed": "uref-dbee6bd5057140ef79760ff97ee225f219c095a6b520e9fdb1083005b3e91adf-007"
        }
      },
      "block_hash": "2f535ee1f7a841bf33fb3af6c841ee5ac81b331e4f033e2700829800d406cd6a",
      "caller_public_key": "019d71f9869046408292ec32e78e613ac5f7b320fd268cd8c0ae3c95dc5d6dca62",
      "contract_entrypoint": {
        "action_type_id": null,
        "contract_hash": "8069372ccd59c538d93404313182f8c47579b5aa4fe23060ae2f6ef83a4aa7c0",
        "contract_package_hash": "b67106c2381b719a2e310e0598847d75ac37381471e318ae112a85e79b96e9ad",
        "id": 1685659,
        "name": "bid"
      },
      "contract_hash": "8069372ccd59c538d93404313182f8c47579b5aa4fe23060ae2f6ef83a4aa7c0",
      "contract_package": {
        "contract_package_hash": "b67106c2381b719a2e310e0598847d75ac37381471e318ae112a85e79b96e9ad",
        "description": null,
        "icon_url": null,
        "website_url": null,
        "latest_version_contract_type_id": null,
        "metadata": {},
        "name": null,
        "owner_public_key": "01a0c97ba1ba5a973eeee369e9480ea15665278699873876a18eaf09c361f8e9c1",
        "timestamp": "2023-12-17T16:32:42Z"
      },
      "contract_package_hash": "b67106c2381b719a2e310e0598847d75ac37381471e318ae112a85e79b96e9ad",
      "cost": "20894638930",
      "deploy_hash": "c2a83a2409f65447d8495768a6f99fee7247135680461ed4b3d6d936995c7630",
      "entry_point_id": 1685659,
      "error_message": null,
      "execution_type_id": 2,
      "payment_amount": "150000000000",
      "status": "processed",
      "timestamp": "2023-12-17T17:52:39Z"
    },
    ...
    {
      "args": {
        "token_owner": {
          "cl_type": "Key",
          "parsed": {
            "Account": "account-hash-2142a81faac0670b76ef0e1be2925ddb9cd7493cc99b2fa591161b82c808a7e3"
          }
        }
      },
      "block_hash": "0daaee30d1a87b4323221e43d08ce4365ab88681f47b18cc247336fa6773d731",
      "caller_public_key": "014d657f276686b711251f32fb9fa36c0852aaab43f4f6bb6cbc7794d4d54cf67e",
      "contract_entrypoint": {
        "action_type_id": null,
        "contract_hash": "f07497ba5e71e52643e620d4722419c22870638ee3f5412c9cbc204c00b3b0b0",
        "contract_package_hash": "7c7a462c55ed3f3631a933e46315a072adaa38105a4160df3a00823495f53e41",
        "id": 1685652,
        "name": "register_owner"
      },
      "contract_hash": "f07497ba5e71e52643e620d4722419c22870638ee3f5412c9cbc204c00b3b0b0",
      "contract_package": {
        "contract_package_hash": "7c7a462c55ed3f3631a933e46315a072adaa38105a4160df3a00823495f53e41",
        "description": null,
        "icon_url": null,
        "website_url": null,
        "latest_version_contract_type_id": 7,
        "metadata": {
          "burn_mode": 0,
          "events_mode": 0,
          "holder_mode": 2,
          "identifier_mode": 0,
          "metadata_mutability": 1,
          "minting_mode": 1,
          "name": "enhanced-nft-1",
          "nft_kind": 1,
          "nft_metadata_kind": 0,
          "ownership_mode": 2,
          "symbol": "ENFT-1",
          "total_supply_uref": "uref-bc550f42fe8898a51bc0daae90ce910f4b5a042a306efa8f95032813089ad195-007",
          "whitelist_mode": 0
        },
        "name": "enhanced-nft-1",
        "owner_public_key": "01a0c97ba1ba5a973eeee369e9480ea15665278699873876a18eaf09c361f8e9c1",
        "timestamp": "2023-12-17T16:29:40Z"
      },
      "contract_package_hash": "7c7a462c55ed3f3631a933e46315a072adaa38105a4160df3a00823495f53e41",
      "cost": "681461970",
      "deploy_hash": "be2db151ba267cff9630b54c45b0aeb704d7d512f12670f7995af7cedad27d27",
      "entry_point_id": 1685652,
      "error_message": null,
      "execution_type_id": 2,
      "payment_amount": "5000000000",
      "status": "processed",
      "timestamp": "2023-12-17T17:26:36Z"
    }
  ]
}
```

### Functions

Entities that have the `timestamp` property can optionally include the CSPR rate at that time in the requested currency, which is passed as an argument to the `rate` function. In the example below, we include the USD to CSPR rate in the account transfers response. To learn more, visit the [Including CSPR rates](/documentation/highlights/including-cspr-rates) page.

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/8acedb18a06c3b1b0823334f5b6fea53b2f6bc50f792de401b1f561bc214ba1f/transfers?includes=rate(1)' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "amount": "10000000000000",
      "deploy_hash": "4237b9518b7f0dda69235fedc92badd4e5206cd9b3ad2e9f599fe34416d9e3ab",
      "from_purse": "uref-b06a1ab0cfb52b5d4f9a08b68a5dbe78e999de0b0484c03e64f5c03897cf637b-007",
      "id": 20230516,
      "initiator_account_hash": "b383c7cc23d18bc1b42406a1b2d29fc8dba86425197b6f553d7fd61375b5e446",
      "rate": 0.0488488,
      "timestamp": "2023-05-16T22:01:16Z",
      "to_account_hash": "8acedb18a06c3b1b0823334f5b6fea53b2f6bc50f792de401b1f561bc214ba1f",
      "to_purse": "uref-fb2c1f47c593e5f27735c92217d7c99f85516467a1cb446214ae22fc46d8559e-004",
      "transform_key": "abf1343e47952a57ab001ec423398a773dfd96f3f32a905daeb6bc47db0db2dc"
    },
    {
      "amount": "1000000000000",
      "deploy_hash": "4d14f8f9cd95aabdfdea930aa9472bf966264d25f57986b005810e11d1c05017",
      "from_purse": "uref-b06a1ab0cfb52b5d4f9a08b68a5dbe78e999de0b0484c03e64f5c03897cf637b-007",
      "id": null,
      "initiator_account_hash": "b383c7cc23d18bc1b42406a1b2d29fc8dba86425197b6f553d7fd61375b5e446",
      "rate": 0.0295418,
      "timestamp": "2022-11-14T13:14:02Z",
      "to_account_hash": "8acedb18a06c3b1b0823334f5b6fea53b2f6bc50f792de401b1f561bc214ba1f",
      "to_purse": "uref-fb2c1f47c593e5f27735c92217d7c99f85516467a1cb446214ae22fc46d8559e-004",
      "transform_key": "b0a27297a03107cd66c270d9bc7b33086f3ceb9c2e8c4058e72a4285c73273bd"
    }
  ],
  "item_count": 2,
  "page_count": 1
}
```

The `rate` property of the first result in the response above holds the CSPR rate from May 16th, 2023, and the second result has the `rate` from November 11th, 2022.


# Errors

Requests made to our APIs can result in several different error responses. The following document describes error values.

## Properties

The `Error` has the following properties:

| Property  | Type     | Description                                                      |
| --------- | -------- | ---------------------------------------------------------------- |
| `code`    | `string` | Error code constant represented as a string                      |
| `message` | `string` | Error message depending on the type of error and an API resource |

## Error Types

| Code               | Name                 | HTTP Status Code | Description                              |
| ------------------ | -------------------- | ---------------- | ---------------------------------------- |
| `invalid_input`    | InvalidParamError    | `400`            | Invalid client input parameters          |
| `unauthorized`     | UnauthorizedError    | `401`            | Client is not authorized                 |
| `access_denied`    | AccessDeniedError    | `403`            | `Entity` or resource access is forbidden |
| `not_found`        | NotFoundError        | `404`            | `Entity` not found                       |
| `duplicate_entity` | DuplicateEntityError | `409`            | `Entity` already exist                   |

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/invalid_identifier' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "error": {
    "code": "invalid_input",
    "message": "AccountHash identifier is not a valid account hash or public key"
  }
}
```

## Rate limiting errors

Visit the [Rate limits and quotas](/documentation/overview/rate-limits-and-quotas) for more information regarding Rate limiting errors.


# Getting started

This tutorial will help you make your first API call to receive a list of NFT tokens in the [CSPR.studio](https://cspr.studio) contract.

## Prerequisites

We will use cURL to make API calls. You can install it from the [curl.se](https://curl.se/download.html) website or by using the package manager of your choice.

## Create an access token

Please register on [CSPR.build console](https://console.cspr.build/sign-up) to create a CSPR.cloud access token.

## First API call

To fetch the NFT tokens in the [CSPR.studio](https://CSPR.studio) contract we'll be using the [NFT API](/rest-api/non-fungible-token). The endpoint requires a contract package hash, which we can find on [CSPR.live](https://cspr.live/contract-package/c4e5a03066ce3c6006f562939e48f7076c77de5d46cf8fe625c41e02c5e74814):

```bash
curl -X 'GET' \
  'https://api.cspr.cloud/contract-packages/c4e5a03066ce3c6006f562939e48f7076c77de5d46cf8fe625c41e02c5e74814/nft-tokens' \
  -H 'accept: application/json' \
  -H 'authorization: [Your access token]'
```

```json
{
  "data": [
    {
      "contract_package_hash": "c4e5a03066ce3c6006f562939e48f7076c77de5d46cf8fe625c41e02c5e74814",
      "is_burned": false,
      "offchain_metadata": null,
      "offchain_metadata_status": 0,
      "onchain_metadata": {
        "asset": "https://maritime.sealstorage.io/make/c4e5a03066ce3c60/0a14a18a7a214b64a9da1e5bdfe12ded",
        "description": "Friday morning in Рíвне.",
        "name": "Friday morning in Rivne"
      },
      "owner_hash": "8297d55f4530ac75f46d04319bf4c7d1de68de1b3fe31cd462f752fadf27b571",
      "owner_type": 0,
      "timestamp": "2022-10-31T07:20:42Z",
      "token_id": "1",
      "token_standard_id": 1,
      "tracking_id": 6053
    },
    {
      "contract_package_hash": "c4e5a03066ce3c6006f562939e48f7076c77de5d46cf8fe625c41e02c5e74814",
      "is_burned": false,
      "offchain_metadata": null,
      "offchain_metadata_status": 0,
      "onchain_metadata": {
        "asset": "https://maritime.sealstorage.io/make/c4e5a03066ce3c60/69a349373da14f6f9511e2a8d375657e",
        "description": "Dougal loving life on the edge",
        "name": "Flying Dougal"
      },
      "owner_hash": "2af66211f9fb970ead08bb80d3d05ad385f83e51caf4940c2f2eb309a0427828",
      "owner_type": 0,
      "timestamp": "2022-11-15T16:54:36Z",
      "token_id": "10",
      "token_standard_id": 1,
      "tracking_id": 11228
    },
    ...
    {
      "contract_package_hash": "c4e5a03066ce3c6006f562939e48f7076c77de5d46cf8fe625c41e02c5e74814",
      "is_burned": false,
      "offchain_metadata": null,
      "offchain_metadata_status": 0,
      "onchain_metadata": {
        "asset": "https://maritime.sealstorage.io/ipfs/bafybeif6wojygvwuav4wdt7dyqx2ekem4fqdpx47p3fu2e5yh7y6anqr2u",
        "description": "The “Ghost” collection is a unique serie of NFTs found on the Casper blockchain. These NFTs are digital representations of ghosts, spirits, and paranormal phenomenon that have been meticulously designed and created by digital artists. Each NFT in this collection is a unique and exclusive piece that captures the essence of the supernatural and the mysterious.\n",
        "name": "Ghosts"
      },
      "owner_hash": "a485e8c7fbe2bfd939930dd9d94025b403fe4bfcf0f8f46b31bd9f28298b8890",
      "owner_type": 0,
      "timestamp": "2023-10-07T08:31:23Z",
      "token_id": "1006",
      "token_standard_id": 1,
      "tracking_id": 317986
    }
  ],
  "item_count": 1277,
  "page_count": 128
}
```

{% hint style="info" %}
Replace "\[Your-Access-Token]" with your actual access token in each example.
{% endhint %}

## What's next

Please proceed with the following documents to get familiar with CSPR.cloud:

* [Overview](/documentation/overview)\
  Learn about the general technical aspects of CSPR.cloud API, and how it works
* [Highlights](/documentation/highlights)\
  Learn about CSPR.cloud API possibilities, which aren't present in the Casper Node RPC API
* [REST API](/rest-api/reference)\
  Get familiar with the REST API reference to know what endpoints are available
* [Streaming API](/streaming-api/reference)\
  Get familiar with the Streaming API reference to know what Web Socket subscriptions are available
* [Casper Node API](/casper-node-api/connecting-with-an-sdk)\
  Learn how to connect to the private Casper Node powered by CSPR.cloud using the most popular SDKs
* [x402 Facilitator API](/x402-facilitator-api/reference)\
  Learn how to use the CSPR.cloud x402 facilitator to verify and settle HTTP micropayments on the Casper Network
* [CSPR.click](https://docs.cspr.click)\
  While CSPR.cloud handles your dApp integration with the Casper Network, CSPR.click takes care of how users of your dApp interact with the blockchain. It provides integration with all the wallets and on-ramp providers in the Casper ecosystem to solve authentication and token-acquiring problems. Please be sure to check it out!


# Highlights

CSPR.cloud indexes and normalizes on-chain data to improve developers' experience when building on the Casper Network. Below are examples that demonstrate some of the possibilities CSPR.cloud offers. For the full list, please see the API reference pages.

* [Including related entities](/documentation/highlights/including-related-entities)\
  Receive related entities in a single response to minimize the number of network requests needed to load the data
* [Including CSPR rates](/documentation/highlights/including-cspr-rates)\
  Include CSPR rates that were relevant at the moment of a transfer, contract call, or reward creation
* [Including account info](/documentation/highlights/including-account-info)\
  Include account info information provided by the account owner in the responses that contain account identifiers
* [Accessing auction data](/documentation/highlights/accessing-auction-data)\
  Query granular pieces of the auction data that interest you, like all account delegations or a list of the current era validators
* [Accessing token data](/documentation/highlights/accessing-token-data)\
  Query fungible token data relevant to your dApp
* [Accessing NFT data](/documentation/highlights/accessing-nft-data)\
  Query NFT movements and ownership from CSPR.cloud while focusing on the core business value of your application
* [Accessing historical contract costs](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/highlights/accessing-historical-contract-costs.md)\
  Check aggregated historical contract costs to provide your users with better pricing
* [De-anonymizing account hashes](/documentation/highlights/de-anonymizing-account-hashes)\
  Translate account hashes to the corresponding public key for accounts that were observed on the network
* [De-anonymizing account purses](/documentation/highlights/de-anonymizing-account-purses)\
  Translate account main purses to the account public keys to better trace the fund movements
* [Receiving contract-level events](/documentation/highlights/receiving-contract-level-events)\
  Subscribe to contract-level events the contracts from your dApps emit to track and aggregate the off-chain state for a better user experience


# Including related entities

CSPR.cloud REST API provides the possibility to include related entities in responses. An entity is called related if its identifier is present among the requested entity's properties. For example, the [Deploy](/rest-api/deploy) entity is related to the [NFT Action](/rest-api/non-fungible-token-action) entity because the latter has a `deploy_hash` property identifying the deploy that produced the action. Not all related entities can be included in responses; the ones that can are listed in the "Optional properties" section for the corresponding entity or endpoint page.

Related entities are included the same as other [optional properties](/documentation/overview/optional-properties), using the `includes` query param. For the related entity to be added to the response, its name has to be specified in the list of `includes`.

Including related entities makes it possible to fetch the required data in one request, simplifying the integration and reducing latency, which is especially useful when processing paginated responses. Continuing the [NFT Action](/rest-api/non-fungible-token-action) and [Deploy](/rest-api/deploy) example, one may need to know the deploy caller account when processing the `NFT Action` data. By including the `Deploy` object in the `NFT Action` response, all the required information can be received in just one API call instead of requesting the deploy data for each NFT action in the list:

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contract-packages/998af6825d77da15485baf4bb89aeef3f1dfb4a78841d149574b0be694ce4821/nft-tokens/2/actions?includes=deploy' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "contract_package_hash": "998af6825d77da15485baf4bb89aeef3f1dfb4a78841d149574b0be694ce4821",
      "deploy": {
        "args": {
          "recipient": {
            "cl_type": "Key",
            "parsed": {
              "Account": "account-hash-989ca079a5e446071866331468ab949483162588d57ec13ba6bb051f1e15f8b7"
            }
          },
          "token_ids": {
            "cl_type": {
              "List": "U256"
            },
            "parsed": [
              "2"
            ]
          }
        },
        "block_hash": "6dd2def46e2417f05dbbb3b8429099f20f89f7fb4b32d4e61fd5d79959ba35f8",
        "caller_public_key": "013eecc2f0fbcad01a35fca7ad0bf191a8cf1eb8d6b13ea63cb92a31e6c767c0bc",
        "contract_hash": "ff2f649f127c033d744f80e7c3bcf0561c716d8f6d1dadc0cd79d8b2d309c020",
        "contract_package_hash": "998af6825d77da15485baf4bb89aeef3f1dfb4a78841d149574b0be694ce4821",
        "cost": "801777450",
        "deploy_hash": "7ffa747cf92deace24a8f81f62ed01694271940ac16e20c419a56f47f680f0a5",
        "entry_point_id": 96622,
        "error_message": null,
        "execution_type_id": 4,
        "payment_amount": "1000000000",
        "status": "processed",
        "timestamp": "2022-10-28T13:40:14Z"
      },
      "deploy_hash": "7ffa747cf92deace24a8f81f62ed01694271940ac16e20c419a56f47f680f0a5",
      "from_hash": "c1e4f35cf36553d9acca0fa02be97537f333c18783373e34d6932eb649584a8c",
      "from_type": 0,
      "nft_action_id": 4,
      "timestamp": "2022-10-28T13:40:14Z",
      "to_hash": "989ca079a5e446071866331468ab949483162588d57ec13ba6bb051f1e15f8b7",
      "to_type": 0,
      "token_id": "2",
      "token_tracking_id": 20709
    },
    {
      "contract_package_hash": "998af6825d77da15485baf4bb89aeef3f1dfb4a78841d149574b0be694ce4821",
      "deploy": {
        "args": {
          "token_meta_data": {
            "cl_type": "String",
            "parsed": "{\"token_uri\":\"ipfs://\"}"
          },
          "token_owner": {
            "cl_type": "Key",
            "parsed": {
              "Account": "account-hash-d0bc9ca1353597c4004b8f881b397a89c1779004f5e547e04b57c2e7967c6269"
            }
          }
        },
        "block_hash": "928a4518bd001cc4ba07a6405e2a2053c157a8a16f0df08668a8aa4d12b7ddbf",
        "caller_public_key": "016d9e3db0a800aef8d18975b469c77bef042ee909d24cb83d27df97a22bb6d8ad",
        "contract_hash": "4a2c7bda207ddf20487c13bd882a0773e1047c0544024bfae4a40e8769a8f452",
        "contract_package_hash": "e2e9be86fb0bef6f2df08c0e3b49cc66ce458a40e496e115f6dc984011177d16",
        "cost": "6398252230",
        "deploy_hash": "af1d08519310188c9746f090d7a0d999da13b58d64680086277bdecebfd29628",
        "entry_point_id": 117617,
        "error_message": null,
        "execution_type_id": 2,
        "payment_amount": "10381644690",
        "status": "processed",
        "timestamp": "2023-01-01T09:40:04Z"
      },
      "deploy_hash": "af1d08519310188c9746f090d7a0d999da13b58d64680086277bdecebfd29628",
      "from_hash": null,
      "from_type": null,
      "nft_action_id": 1,
      "timestamp": "2023-01-01T09:40:04Z",
      "to_hash": "d0bc9ca1353597c4004b8f881b397a89c1779004f5e547e04b57c2e7967c6269",
      "to_type": 0,
      "token_id": "2",
      "token_tracking_id": 20709
    }
  ],
  "item_count": 2,
  "page_count": 1
}
```


# Including CSPR rates

Often, when looking at the fiat value of a native token amount, we want it to be converted using the rate that was relevant at the moment when the corresponding action happened. CSPR.cloud REST API provides the possibility to do so when requesting data having the `timestamp` property and when it's semantically acceptable To learn more, visit the [CSPR rate](/rest-api/cspr-rate) page.

In the example below, we include the USD to CSPR rate in the account delegation rewards response by calling the `rate` [function](/documentation/overview/optional-properties#functions) with the USD currency ID as the argument in the `includes` query param:

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/019aa4adcd6f58f92eb4c98c0245e5d86b61de4919245c23ae9e906a6df5d41b0c/delegation-rewards?includes=rate(1)' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 38490,
  "page_count": 3849,
  "data": [
    {
      "amount": "139319",
      "era_id": 11774,
      "public_key": "019aa4adcd6f58f92eb4c98c0245e5d86b61de4919245c23ae9e906a6df5d41b0c",
      "rate": 0.04051209,
      "timestamp": "2023-12-20T12:55:54Z",
      "validator_public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
    },
    {
      "amount": "186761050",
      "era_id": 11774,
      "public_key": "019aa4adcd6f58f92eb4c98c0245e5d86b61de4919245c23ae9e906a6df5d41b0c",
      "rate": 0.04051209,
      "timestamp": "2023-12-20T12:55:54Z",
      "validator_public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e"
    },
    ...
    {
      "amount": "139010",
      "era_id": 11771,
      "public_key": "019aa4adcd6f58f92eb4c98c0245e5d86b61de4919245c23ae9e906a6df5d41b0c",
      "rate": 0.0403257,
      "timestamp": "2023-12-20T06:55:27Z",
      "validator_public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
    }
  ]
}
```


# Including account info

Accounts on Casper Mainnet and Testnet networks have the possibility to self-identify themselves in a decentralized with the [Casper Account Info Standard](https://github.com/make-software/casper-account-info-contract) smart contract. Many validators and contract owner accounts provide information about themselves to increase trust on the network.

CSPR.cloud REST API allows including account information to simplify the integration with the standard for dApps developers. Typically, account info standard data can be included in responses that contain account identifiers like account hashes or public keys.

In the example below, we'll include validator account info data in the account delegations API response. To demonstrate the possibility of [filtering included object data](/documentation/overview/optional-properties#objects), we'll request only the owner name and logo properties of the account info object.

```bash
curl -X 'GET' -G \
  'https://api.testnet.cspr.cloud/accounts/018df66cb0257dd378d1944d665ea001518419408d55db740a9bb1a262093cefd9/delegations' \
  --data-urlencode 'includes=validator_account_info{info{owner{name,branding{logo}}}}' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "bonding_purse": "uref-845ca8130882c27ee0da81252ed0deb7787796a3868df4b771e0518383d89a4b-007",
      "public_key": "018df66cb0257dd378d1944d665ea001518419408d55db740a9bb1a262093cefd9",
      "stake": "235732110487",
      "validator_account_info": null,
      "validator_public_key": "0196948158bf5b35c0c84f680f110b8debaa4e7628e13ba336a95651a214d3b9bd"
    },
    {
      "bonding_purse": "uref-a5bac0a17edeed284a0264f3fbbd189d3c4819f0e788a576792dc028c8476fba-007",
      "public_key": "018df66cb0257dd378d1944d665ea001518419408d55db740a9bb1a262093cefd9",
      "stake": "565388190696",
      "validator_account_info": {
        "info": {
          "owner": {
            "branding": {
              "logo": {
                "png_1024": "",
                "png_256": "https://picsum.photos/256/256",
                "svg": ""
              }
            },
            "name": "ACME"
          }
        }
      },
      "validator_public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
    }
  ],
  "item_count": 2,
  "page_count": 1
}
```


# Accessing auction data

CPSR.cloud provides granular access to the auction data, which is more convenient than parsing the results of the [`state_get_auction_info`](https://docs.casper.network/developers/json-rpc/json-rpc-pos/#state-get-auction-info) Casper RPC API method, through the following APIs:

* [Get bidder](/rest-api/bidder/get-bidder)
* [Get bidders](/rest-api/bidder/get-bidders)
* [Get validator](/rest-api/validator/get-validator)
* [Get validators](/rest-api/validator/get-validators)
* [Get account delegations](/rest-api/delegation/get-account-delegations)
* [Get validator delegations](/rest-api/delegation/get-validator-delegations)
* [Get auction metrics](/rest-api/auction-metrics/get-auction-metrics)

For example, fetching account delegations can be done with the following API request:

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02/delegations?limit=2&offset=0' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 129,
  "page_count": 13,
  "data": [
    {
      "bonding_purse": "uref-0ac1ba0100574729337b63b11e1f933b91d1d0f220823bef502bd8957305976b-007",
      "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "stake": "55342872342594023",
      "validator_public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e"
    },
    {
      "bonding_purse": "uref-917e1aeba7e7d3a322e89069e88b6e0877a59d781840c0ce8223e990e0342d42-007",
      "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "stake": "55334239891699578",
      "validator_public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
    },
    ...
    {
      "bonding_purse": "uref-64b18eba7bea61163415e728cc8aec51208e14c7abf29d1ce4d50d317ca43053-007",
      "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "stake": "10101529405231091",
      "validator_public_key": "01aea86e5fccdf72daa7c65cc8b3d2ca96a006a0dcd70d3617f85fef00b9d78464"
    }
  ]
}
```


# Accessing token data

Fungible tokens are one of the most used abstractions implemented on blockchains. CSPR.cloud allows dApp developers to focus on the core logic of their applications by tracking the token activity on the Casper Network for [CEP-18](https://github.com/casper-ecosystem/cep18) compatible tokens and providing APIs to query that data. CSPR.cloud provides a possibility to:

* [Get list of tokens owned by an account with their balances](/rest-api/fungible-token-ownership/get-account-fungible-token-ownership)
* [Get list of token owners for a fungible token contract](/rest-api/fungible-token-ownership/get-contract-package-fungible-token-ownership)
* [Get account token activity](/rest-api/fungible-token-action/get-account-token-actions)
* [Get contract token activity](/rest-api/fungible-token-action/get-contract-package-token-actions)

Below is an example, that demonstrated fetching list of tokens owned by an account. Note, that we are [including optional data](/documentation/overview/optional-properties) about the contract package using the `includes` query parameter.

```bash
curl -X 'GET' -G \
  'https://api.testnet.cspr.cloud/accounts/013ff7b986fd1ebd176692825035f1fefa20fb89796dc533219ad307e56ed97439/ft-token-ownership' \
  --data-urlencode 'includes=contract_package{name,metadata}' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
"data": [
    {
      "balance": "198689800",
      "contract_package": {
        "metadata": {
          "balances_uref": "uref-75c2ee03c1982fc514336a38271a9748cee0994a11f16f8b750c68f142c8a957-007",
          "decimals": 3,
          "name": "Nexfi App Token",
          "symbol": "NFI",
          "total_supply_uref": "uref-6e641bea3588986637bd7a5bd2b80f141bf79d21a5be54152a6dc9ac6f9b42a4-007"
        },
        "name": "Nexfi App Token"
      },
      "contract_package_hash": "04ff7ad6975508fffb5a2f364323503fb045b6d1eaeb9aeaa7283c046e0b6710",
      "owner_hash": "a3caf9628418b3a35bd4a92d62d35e8a244898cdea26c269bf75a2d82ad221f0"
    },
    {
      "balance": "50",
      "contract_package": {
        "metadata": {
          "balances_uref": "uref-897fd9713fa3f57c741a3488d7c1a8a24ac0a1cb273eb861e03491698b6e198d-007",
          "decimals": 1,
          "name": "MP1",
          "symbol": "MonoPoint",
          "total_supply_uref": "uref-7c05f307f0f1f7d3b47ea207cdad169d03e554007efc8646d40c5e87002d1ae1-007"
        },
        "name": "MP1"
      },
      "contract_package_hash": "0ed344ff11750d965f6188eb6bb62dcabc51b20f3900b3c7d2f19463cda23378",
      "owner_hash": "a3caf9628418b3a35bd4a92d62d35e8a244898cdea26c269bf75a2d82ad221f0"
    },
    {
      "balance": "9970000",
      "contract_package": {
        "metadata": {
          "balances_uref": "uref-1db06ca66b714a032b2da27476ae8574656105565cb4990633049e483bc2e52a-007",
          "decimals": 3,
          "name": "ENFLOW TOKEN",
          "symbol": "ENF",
          "total_supply_uref": "uref-874fd7504edc780853175536c76025697fa5f4223c63d1e47e075cad2eadf592-007"
        },
        "name": "ENFLOW TOKEN"
      },
      "contract_package_hash": "223e8b0e3101a7d7671279a08abd38a86cefd590536d0aaa5a068c2c616e11da",
      "owner_hash": "a3caf9628418b3a35bd4a92d62d35e8a244898cdea26c269bf75a2d82ad221f0"
    }
  ],
  "item_count": 3,
  "page_count": 1
}
```


# Accessing NFT data

Non-fungible tokens, or NFTs, became one of the most popular use cases in the current blockchain world. CSPR.cloud keeps track of all NFT contracts compatible with the [CEP-47](https://github.com/casper-ecosystem/casper-nft-cep47) and [CEP-78](https://github.com/casper-ecosystem/cep-78-enhanced-nft) NFT standards on the Casper Network. CSPR.cloud provides a possibility to:

* [Get list of NFTs owned by an account](/rest-api/non-fungible-token/get-account-tokens)
* [Get list of NFTs minted within a contract](/rest-api/non-fungible-token/get-contract-package-tokens)
* [Get list of NFTs owners for a contract](/rest-api/non-fungible-token-ownership/get-contract-package-token-ownership)
* [Get account NFT activity](/rest-api/non-fungible-token-action/get-account-token-actions)
* [Get contract NFT activity](/rest-api/non-fungible-token-action/get-contract-package-token-actions)
* and more

Moreover, CSPR.cloud not only tracks on-chain NFT data but also fetches the off-chain metadata for you, which can be particularly slow when the metadata is stored on [IPFS](https://ipfs.tech). Below is an example that demonstrated fetching NFT tokens for the [CasperPunks](https://cspr.live/contract-package/ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495) contracts, which is a [CEP-78](https://github.com/casper-ecosystem/cep-78-enhanced-nft) smart NFT contract that stores the token metadata on IPFS:

```bash
curl -X 'GET' \
  'https://api.cspr.cloud/contract-packages/ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495/nft-tokens' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
      "is_burned": false,
      "offchain_metadata": {
        "attributes": [
          {
            "trait_type": "background",
            "value": "Red"
          },
          {
            "trait_type": "body",
            "value": "Grey"
          },
          {
            "trait_type": "eyes",
            "value": "Narrow"
          },
          {
            "trait_type": "hat",
            "value": "tophat"
          },
          {
            "trait_type": "mouth",
            "value": "StacheBrown"
          }
        ],
        "compiler": "HashLips Art Engine",
        "date": 1682468152509,
        "description": "The first generation of generative CasperPunks",
        "dna": "5dd6a50e43d44cda7af7d50c7d314af724c2851d",
        "edition": 1,
        "image": "https://api-box.casperpunks.io/metadata/images/1.png",
        "name": "Casper Punks Gen 1 #1"
      },
      "offchain_metadata_status": 2,
      "onchain_metadata": {
        "checksum": "",
        "name": "CasperPunks Gen1",
        "symbol": "CP-GEN1",
        "token_uri": "https://api-box.casperpunks.io/metadata/1"
      },
      "owner_hash": "909ce489ea31a76c8f3ca97364b209b942d023a1a0447dc63263444c1566338a",
      "owner_type": 0,
      "timestamp": "2023-05-23T06:38:53Z",
      "token_id": "1",
      "token_standard_id": 2,
      "tracking_id": 19236
    },
    {
      "contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
      "is_burned": false,
      "offchain_metadata": {
        "attributes": [
          {
            "trait_type": "background",
            "value": "Purple"
          },
          {
            "trait_type": "body",
            "value": "Grey"
          },
          {
            "trait_type": "eyes",
            "value": "Bulging"
          },
          {
            "trait_type": "hat",
            "value": "PinkMohawk"
          },
          {
            "trait_type": "mouth",
            "value": "Patch"
          }
        ],
        "compiler": "HashLips Art Engine",
        "date": 1682468131158,
        "description": "The first generation of generative CasperPunks",
        "dna": "0de5f3c56c496630c56d0b78739c69a68cbe2824",
        "edition": 10,
        "image": "https://api-box.casperpunks.io/metadata/images/10.png",
        "name": "Casper Punks Gen 1 #10"
      },
      "offchain_metadata_status": 2,
      "onchain_metadata": {
        "checksum": "",
        "name": "CasperPunks Gen1",
        "symbol": "CP-GEN1",
        "token_uri": "https://api-box.casperpunks.io/metadata/10"
      },
      "owner_hash": "6d230cf0b8f2a1aae9b88108f483e66c83a301f59b2c8118e0c7765081e36fe9",
      "owner_type": 0,
      "timestamp": "2023-05-24T14:52:46Z",
      "token_id": "10",
      "token_standard_id": 2,
      "tracking_id": 19247
    },
    ...
    {
      "contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
      "is_burned": false,
      "offchain_metadata": {
        "attributes": [
          {
            "trait_type": "background",
            "value": "Mint"
          },
          {
            "trait_type": "body",
            "value": "Grey"
          },
          {
            "trait_type": "eyes",
            "value": "Frown"
          },
          {
            "trait_type": "hat",
            "value": "beanie"
          },
          {
            "trait_type": "mouth",
            "value": "Laugh"
          }
        ],
        "compiler": "HashLips Art Engine",
        "date": 1682468103314,
        "description": "The first generation of generative CasperPunks",
        "dna": "1df66a2d43f0de7784136685eb8f85531e53d7d1",
        "edition": 1006,
        "image": "https://api-box.casperpunks.io/metadata/images/1006.png",
        "name": "Casper Punks Gen 1 #1006"
      },
      "offchain_metadata_status": 2,
      "onchain_metadata": {
        "checksum": "",
        "name": "CasperPunks Gen1",
        "symbol": "CP-GEN1",
        "token_uri": "https://api-box.casperpunks.io/metadata/1006"
      },
      "owner_hash": "96609d29c02388c81b6b1bd08feef31d3f3f1331ae39c0ad4f921e43c14d5393",
      "owner_type": 1,
      "timestamp": "2023-05-25T02:24:28Z",
      "token_id": "1006",
      "token_standard_id": 2,
      "tracking_id": 20245
    }
  ],
  "item_count": 2166,
  "page_count": 217
}
```

Note the `offchain_metadata` property, which contains the off-chain token metadata.


# De-anonymizing account hashes

While accounts are known to be recognized by their public keys, internally on-chain, they are uniquely identified by fixed-length accounts hashes derived from those public keys. Because of that, in certain contexts, we may know the account hash but not the public key. CSPR.cloud maintains the mapping between account hashes and the corresponding public keys to be able to "de-anonymize" the former when needed by requesting the public key as an [optional property](/documentation/overview/optional-properties).

Let's have a look at the [Transfer API](/rest-api/transfer), for example. The `Transfer` object only provides the recipient account hash:

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/deploys/6117d9f92a40d3785b53145c68a118cf36b974b2803acf41cffce8630acd769c/transfers' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "amount": "2000000000000",
      "deploy_hash": "6117d9f92a40d3785b53145c68a118cf36b974b2803acf41cffce8630acd769c",
      "from_purse": "uref-72653d09444d0b3bd27372247510e9346c39fa831a89008dd9ce849a7b2c15e2-007",
      "id": 1704899420700,
      "initiator_account_hash": "7dc2bcc676eba6196d16374e1a2dbfa1df336f779854d95a0b4e65de6d593158",
      "timestamp": "2024-01-10T15:10:36Z",
      "to_account_hash": "b85634e0695ac3b6a7792c2009377b4a405118571a9c64ab2c66048250fef36c",
      "to_purse": "uref-7bba21087353cf75a83234b07525efdf33f59a6d71da00021a4bb80b6ace4bd7-004",
      "transform_key": "a1845ce7b2d334c7fd39b6313ebcfe4e8e29889bcdc792f7c67c7ba5360fd220"
    }
  ],
  "item_count": 1,
  "page_count": 1
}
```

Let's "de-anonymize" the recipient of the transfer above by including the `to_public_key` [optional property](/documentation/overview/optional-properties):

```bash
curl -X 'GET' -G \
  'https://api.testnet.cspr.cloud/deploys/6117d9f92a40d3785b53145c68a118cf36b974b2803acf41cffce8630acd769c/transfers' \
  --data-urlencode 'includes=to_public_key' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "amount": "2000000000000",
      "deploy_hash": "6117d9f92a40d3785b53145c68a118cf36b974b2803acf41cffce8630acd769c",
      "from_purse": "uref-72653d09444d0b3bd27372247510e9346c39fa831a89008dd9ce849a7b2c15e2-007",
      "id": 1704899420700,
      "initiator_account_hash": "7dc2bcc676eba6196d16374e1a2dbfa1df336f779854d95a0b4e65de6d593158",
      "timestamp": "2024-01-10T15:10:36Z",
      "to_account_hash": "b85634e0695ac3b6a7792c2009377b4a405118571a9c64ab2c66048250fef36c",
      "to_public_key": "02027fec2d969dd0779358c40abe2a772f309408348c2a1f413fddfe684a4287ba1a",
      "to_purse": "uref-7bba21087353cf75a83234b07525efdf33f59a6d71da00021a4bb80b6ace4bd7-004",
      "transform_key": "a1845ce7b2d334c7fd39b6313ebcfe4e8e29889bcdc792f7c67c7ba5360fd220"
    }
  ],
  "item_count": 1,
  "page_count": 1
}
```

Note the `to_public_key` property that was added in the second response. It contains the public key that corresponds to the account hash specified in `to_account_hash`. Please check [Transfer Optional Properties](/rest-api/transfer#optional-properties) to learn about all the optional data that can be included in the [Transfer API](/rest-api/transfer) responses.


# De-anonymizing account purses

Similarly to ["de-anonymizing account hashes"](/documentation/highlights/de-anonymizing-account-hashes), CSPR.cloud can also "de-anonymize" account purses which can be used as the only transfer source or destination parameter. Let's have a look at transfers that happened in this [deploy](https://testnet.cspr.live/deploy/014989ad6e5b0c26a00f23606b8d6ec963003a9cc2e5e32f43b8ababc55fb8ab) for example.

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/deploys/014989ad6e5b0c26a00f23606b8d6ec963003a9cc2e5e32f43b8ababc55fb8ab/transfers' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "amount": "99000000",
      "deploy_hash": "014989ad6e5b0c26a00f23606b8d6ec963003a9cc2e5e32f43b8ababc55fb8ab",
      "from_purse": "uref-faf8e43069a7551cbb0594dd1f93396cf204e80b59886129d3476bf3319d7aef-007",
      "id": null,
      "initiator_account_hash": "d65804fef96e8c4294c7a95daf5c7dd219f19f08e2613418b453b08eb84364ab",
      "timestamp": "2021-09-16T16:06:16Z",
      "to_account_hash": null,
      "to_purse": "uref-faf8e43069a7551cbb0594dd1f93396cf204e80b59886129d3476bf3319d7aef-007",
      "transform_key": "213bd956791dd9be048bd20b793a277d5807682bb1fa827e344cbe1ad2a3cc53"
    }
  ],
  "item_count": 1,
  "page_count": 1
}
```

The `to_account_hash` was not specified in the transfer parameters. Let's "de-anonymize" it by including the `to_purse_public_key` [optional property](/documentation/overview/optional-properties):

```bash
curl -X 'GET' -G \
  'https://api.testnet.cspr.cloud/deploys/014989ad6e5b0c26a00f23606b8d6ec963003a9cc2e5e32f43b8ababc55fb8ab/transfers' \
  --data-urlencode 'includes=to_purse_public_key' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "amount": "99000000",
      "deploy_hash": "014989ad6e5b0c26a00f23606b8d6ec963003a9cc2e5e32f43b8ababc55fb8ab",
      "from_purse": "uref-faf8e43069a7551cbb0594dd1f93396cf204e80b59886129d3476bf3319d7aef-007",
      "id": null,
      "initiator_account_hash": "d65804fef96e8c4294c7a95daf5c7dd219f19f08e2613418b453b08eb84364ab",
      "timestamp": "2021-09-16T16:06:16Z",
      "to_account_hash": null,
      "to_purse": "uref-faf8e43069a7551cbb0594dd1f93396cf204e80b59886129d3476bf3319d7aef-007",
      "to_purse_public_key": "01f25c7f82f8bf57b195f18412f9c13b239e95b007eb226f559f8320f3acffac7c",
      "transform_key": "213bd956791dd9be048bd20b793a277d5807682bb1fa827e344cbe1ad2a3cc53"
    }
  ],
  "item_count": 1,
  "page_count": 1
}
```

Note the `to_purse_public_key` property that was added in the second response. It contains the public key that corresponds to the account having the `to_purse` as its main purse. Please check [Transfer Optional Properties](/rest-api/transfer#optional-properties) to learn about all the optional data that can be included in the [Transfer API](/rest-api/transfer) responses.


# Receiving contract-level events

Web3 comes with a new storage architecture dApps have to embrace. In traditional Web2 applications, users don't interact with the storage directly. It's typically hidden behind the API layer.

![](https://3330876193-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBYsJS9u9kh3yqgnfTRb%2Fuploads%2Fgit-blob-8f3029d6535121aae9050901ec57f8618ce1e590%2Fuser-storage-interaction-in-web2.png?alt=media)

Blockchain is data storage that provides data we can trust, and that trust requires no middleman between the users and the changes in the data. In this setup, dApps have to observe the on-chain activity to display the relevant state to the end users. While this can be done by polling the network state using the [CSPR.cloud REST API](/rest-api/reference) or [CSPR.cloud Casper Node](/casper-node-api/connecting-with-an-sdk), CSPR.cloud is also prepared to assist dApps developers with observing the on-chain activity with its [Streaming API](/streaming-api/reference).

![](https://3330876193-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBYsJS9u9kh3yqgnfTRb%2Fuploads%2Fgit-blob-3ac2c8bc02bc457ccbba23770ba5147fab6244c7%2Fuser-storage-interaction-in-web3.png?alt=media)

To demonstrate it in action, let's create an NFT contract using the Testnet version of [CSPR.studio](https://testnet.cspr.studio) and observe its activity on the network. Navigate to the [My NFT collections](https://testnet.cspr.studio/collections) page and create a new collection. To listen to the contract-level events emitted by our contract, we'll need to know its hash. Copy the hash of the deploy that created your NFT collection on the last step of the collection creation process and query the contract it deployed to the network using the [Contract REST API](/rest-api/contract):

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contracts?deploy_hash=149710648b6295b426fa31bb4b79b65374edd3e9ccd242b7d1bf6a7abb308f47' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "contract_hash": "98f4b9ad7891d982e1b5f39e51dd332cae6f83f9615f3025af32796587bea527",
      "contract_package_hash": "19e6954b07d1b4d0341a6f73689c7fbc96959c33f4465c0e11c49b6bc850884a",
      "contract_type_id": 7,
      "contract_version": 1,
      "deploy_hash": "149710648b6295b426fa31bb4b79b65374edd3e9ccd242b7d1bf6a7abb308f47",
      "is_disabled": false,
      "timestamp": "2024-01-09T14:29:30Z"
    }
  ],
  "item_count": 1,
  "page_count": 1
}
```

Knowing the contract hash, we can subscribe to the contract-level events emitted by our newly created contract using the [Contract-level events Streaming API](/streaming-api/contract-level-events). For this example, you'll need to install the [`wscat`](https://github.com/websockets/wscat) [NPM](https://www.npmjs.com) utility.

```bash
wscat -c 'wss://streaming.testnet.cspr.cloud/contract-events?contract_hash=98f4b9ad7891d982e1b5f39e51dd332cae6f83f9615f3025af32796587bea527' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

Now, let's go back to [CSPR.studio](https://testnet.cspr.studio) and mint an NFT. Once the mint deploy is executed on the network, our WebSocket connection will receive a message containing the `Mint` event data, as well as the token data encoded as a JSON string:

```json
{
  "data": {
    "contract_package_hash": "19e6954b07d1b4d0341a6f73689c7fbc96959c33f4465c0e11c49b6bc850884a",
    "contract_hash": "98f4b9ad7891d982e1b5f39e51dd332cae6f83f9615f3025af32796587bea527",
    "data": {
      "data": "{\"name\":\"User storage interaction in Web2\",\"description\":\"Users typically don\\u0027t interact directly with the data storage in Web2\",\"asset\":\"https://maritime.sealstorage.io/ipfs/bafybeicfojnysuueowj4mcparaxzkl5ckytq7ma5mqhhzju35r734ercra\"}",
      "recipient": "account-hash-1856e4a0b23c70b64e4509987680de0d99145fa0cdc71ad9b78760e18ff0deec",
      "token_id": "0"
    },
    "name": "Mint"
  },
  "action": "emitted",
  "extra": {
    "deploy_hash": "7d23a8b0cd927a7e54b6e55b267c8000016c3d0b3a9e97a2c281239c8a8f9120",
    "event_id": 0,
    "transform_id": 31
  },
  "timestamp": "2024-01-09T17:06:51.43910404Z"
}
```

Note the `extra` property that provides technical information, such as `deploy_hash`, `event_id`, and the deploy execution `transform_id`, which can be used to link the event data to the corresponding deploy properly.


# Resolving CSPR.name

CSPR.cloud REST API provides the possibility to resolve CSPR.name names either directly by calling the [CSPR.name Resolution API](/rest-api/cspr-name-resolution) or by including CSPR.name names as [optional properties](/documentation/overview/optional-properties).

At the moment of writing this page (August 27th, 2024), the CSPR.name is not launched yet. That's why we added a test CSPR.name for the Faucet account to allow developers to implement and test their CSPR.name integration before the launch.

Direct CSPR.name to account hash resolution can be done using the [Get CSPR.name resolution API](/rest-api/cspr-name-resolution/get-cspr-name-resolution) and is recommended for the situations when you receive the name outside CSPR.cloud and want to resolve it to the corresponding account hash:

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/cspr-name-resolutions/faucet.cspr' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "name_token_id": "0000000000000000000000000000000000000000000000000000000000000000",
    "name": "faucet.cspr",
    "resolved_hash": "b383c7cc23d18bc1b42406a1b2d29fc8dba86425197b6f553d7fd61375b5e446",
    "expires_at": "2124-08-27T12:00:00Z"
  }
}
```

In situations, when you want to resolve account hashes to the corresponding CSPR.name names, in most of the cases it's possible to do by requesting CSPR.name as [optional property](/documentation/overview/optional-properties) in the `includes` query parameter:

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/deploys/872394dcb8ac58b61f543e6fa0e3425b1db6b83a03d9d46cbf55c9d4b736624f?includes=caller_cspr_name' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "args": {
      "amount": {
        "cl_type": "U512",
        "parsed": "1000000000000"
      },
      "target": {
        "cl_type": {
          "ByteArray": 32
        },
        "parsed": "3234c6a8e17a19976300d18d6dcc444839ff981c5bfcd0d8724e3a0c018f61f3"
      }
    },
    "block_hash": "b8e7c74faed73e54be402a5f575a6cd8adf7382ed58bdb0ed48271464a122415",
    "block_height": 3618748,
    "caller_cspr_name": "faucet.cspr",
    "caller_public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
    "contract_hash": null,
    "contract_package_hash": null,
    "cost": "2976291766",
    "deploy_hash": "872394dcb8ac58b61f543e6fa0e3425b1db6b83a03d9d46cbf55c9d4b736624f",
    "entry_point_id": null,
    "error_message": null,
    "execution_type_id": 1,
    "payment_amount": "4000000000",
    "status": "processed",
    "timestamp": "2024-08-26T14:34:56Z"
  }
}
```

If you want to find the primary CSPR.name for an account, you can include it in the [Get account API](/rest-api/account/get-account):

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02?includes=cspr_name' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "account_hash": "b383c7cc23d18bc1b42406a1b2d29fc8dba86425197b6f553d7fd61375b5e446",
    "balance": 9516302858997050000,
    "cspr_name": "faucet.cspr",
    "deployment_threshold": 1,
    "key_management_threshold": 1,
    "main_purse_uref": "uref-b06a1ab0cfb52b5d4f9a08b68a5dbe78e999de0b0484c03e64f5c03897cf637b-007",
    "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02"
  }
}
```


# Changelog

## 2.9.0 - 2026.02.05

* Added `token_market_data` includer
* Added Swaps API endpoint

## 2.8.0 - 2026.01.22

* Added fungible token DEX rate endpoints
* Added fungible token daily DEX rate endpoints
* Improved quote calculation for CSPR.trade API
* Fixed native token annual issuance rate calculation used in Supply API

## 2.7.0 - 2025.12.18

* Added `csprtrade_data` includer
* Improved DEX pair filtering (including decimals-aware filtering)

## 2.6.1 - 2025.11.25

* Added documentation for DEX fiat rates

## 2.6.0 - 2025.11.19

* Added fungible token DEX fiat rates endpoints
* Added DEX fiat rate includer
* Added filtering for FT ownerships by `contract_package_hash`

## 2.5.2 - 2025.11.10

* Fixed FT ownership serialization

## 2.5.1 - 2025.11.05

* Added account undelegations endpoint
* Added `last_switch_block.timestamp` to network state responses

## 2.5.0 - 2025.09.30

* Added `contract_package` includer support for FT/NFT actions in transaction feed endpoints

## 2.4.4 - 2025.09.24

* Fixed Odra WASM proxy endpoint handling

## 2.4.3 - 2025.09.22

* Fixed account liquid, undelegated and delegated balances serialization to be exposed as `string` in API responses

## 2.4.0 - 2025.09.16

* Added annual issuance (inflation rate) in Supply API
* Added era range support for Rewards API

## 2.1.1 - 2025.07.10

* Added optional `friendlymarket_data` property to the Token API

## 2.1.0 - 2025.07.03

* Added support for CEP-95 NFT standard
* Added Purse API
* Added contract identification for [Odra WASM proxy](https://github.com/odradev/odra/tree/eb4ddbde36cc315d84c7d5c366fa090604d6af06/odra-casper/proxy-caller) transactions
* Added optional `coingecko_data` property to the Token API
* Added genesis accounts identification

## 2.0.21 - 2025.06.17

* Fixed edge cases in validator performance tracking for newly joined validators

## 2.0.20 - 2025.06.02

* Added possibility to filter contract NFTs by owner
* Added possibility to filter token actions by the action type

## 2.0.19 - 2025.05.14

* Fixed duplicated delegator rewards (introduced in 2.0.18)

## 2.0.18 - 2025.05.14

* Fixed delegator rewards grouping in the API responses for delegators with multiple delegations
*

## 2.0.17 - 2025.04.25

* Added additional logging to collect more data about the service stability after Casper 2.0 upgrade on Mainnet

## 2.0.16 - 2025.04.24

* Fixed edge cases in Casper 2.0 validator performance tracking

## 2.0.15 - 2025.04.18

* Added new validator performance tracking based on the cited signatures for Casper 2.0

## 2.0.14 - 2025.04.08

* Updated to the latest version of Casper SDK that handles contract hash prefixes for both Casper 1.5.x and 2.0.0

## 2.0.13 - 2025.04.01

* Fixed issues related to certain contract packages not being tracked on Casper 2.0

## 2.0.12 - 2025.03.27

* Added `website_url` property to contract packages
* Added `refund_amount` property to deploys
* Improved performance of the Bidder API
* Fixed filtering deploys by `caller_hash` in the streaming API

## 2.0.11 - 2025.03.24

* Fixed incorrect balance updates for Casper 2.0 transactions

## 2.0.10 - 2025.03.24

* Fixed tracking of Casper 2.0 transactions with caller represented by account hash

## 2.0.9 - 2025.03.21

* Improved service stability during the network upgrade scenarios

## 2.0.8 - 2025.03.12

* Fixed validator rewards tracking
* Improved performance of the Delegation API

## 2.0.7 - 2025.03.07

* Added withdrawals tracking for purse delegations
* Fixed sorting by `self_share` and `network_share` in Validators API

## 2.0.6 - 2025.03.05

* Improved service stability by updating to the latest version Casper SDK

## 2.0.5 - 2025.02.20

* Added new API endpoint that returns pending undelegating amount for purses
* Added new API endpoint that returns pending unstaking amount for validators
* Fixed various issues related to Casper 2.0 integration discovered on the integration network

## 2.0.4 - 2025.02.07

* Fixed payment amount tracking issue for certain Casper 2.0 transactions

## 2.0.3 2025.02.06

* Added new API endpoint that returns purse delegations

## 2.0.2 - 2025.02.05

* Updated to the latest version of Casper SDK that fixes certain Casper 2.0 integration issues

## 2.0.1 - 2025.02.04

* Improved performance of the Blocks API
* Updated to the latest version of Casper SDK that fixes certain Casper 2.0 integration issues

## 2.0.0 - 2025.02.03 🎉

* Added integration with Casper 2.0 in a backward compatible way for CSPR.cloud users

## 1.5.3 - 2025.01.20

* Updated SDK dependencies to ensure compatibility with Casper 1.5.x and 2.0 in preparation for the Casper 2.0 compatible release

## 1.5.2 - 2025.01.13

* Improved owner type identification (account or contract) for token ownerships
* Fixed filtering by `deploy_hash` in the deploy streaming API

## 1.5.1 - 2025.01.09

* Fixed parsing logic for tracking certain token actions for legacy contracts that don't use CES events
* Fixed tracking owner type and balance for certain token ownership for legacy contracts that don't use CES events

## 1.5.0 - 2025.01.07

* Switched to Casper 2.0 compatible Casper SDK in preparation for the Casper 2.0 release

## 1.4.7 - 2024.12.03

* Fixed serialization issue for token ownerships for legacy contracts that don't use CES events

## 1.4.6 - 2024.11.06

* Added ability to sort token ownerships by balance

## 1.4.5 - 2024.10.22

* Added reverse resolution for CSPR.name

## 1.4.2 - 2024.08.27

* Added optional `rates` property to token action responses

## 1.4.1 - 2024.08.20

* Added new network stats API

## 1.4.0 - 2024.08.19

* Added CSPR.name resolution API

## 1.3.10 - 2024.08.08

* Fixed account info tracking for servers that require user agent

## 1.3.9 - 2024.08.06

* Added default sorting for validators by `is_identified_account_info` and `total_stake` properties
* Fixed sorting and pagination for Accounts API

## 1.3.8 - 2024.07.12

* Improved performance for the account balance API

## 1.3.7 - 2024.07.02

* Added option `deploy` property to Transfers API responses
* Added filtering token and NFT actions by `deploy_hash` in the Streaming API

## 1.3.6 - 2024.06.26

* Bug fixes

## 1.3.5 - 2024.06.17

* Fixed internal APIs used by CSPR.suite products

## 1.3.4 - 2024.06.13

* Fixed reversed associated accounts API, that returned empty associations in some cases

## 1.3.3 - 2024.06.12

* Fixed sorting in Contracts API
* Fixed filtering deploys by `caller_public_key`

## 1.3.2 - 2024.06.06

* Fixed including logic for the `validator_performance` optional property
* Fixed validator rewards API endpoint

## 1.3.1 - 2024.06.01

* Bug fixes

## 1.3.0 - 2024.05.30

* Fixed total account delegations API endpoint

## 1.2.2 - 2024.05.28

* Fixed balance tracking for certain accounts

## 1.2.1 - 2024.05.23

* Added Centralized Account Info API

## 1.2.0 - 2024.05.20

* Added new total account delegations API endpoint
* Added optional `contract_package` property to all resources that have `contract_package_hash` property
* Added `from_purse_public_key` and `to_purse_public_key` optional properties to transfers
* Added the ability to filter deploys stream by `deploy_hash` for Streaming API
* Fixed Streaming API intermittent connection terminations

## 1.1.3 - 2024.05.13

* Added `is_burned` filter for NFTs

## 1.1.2 - 2024.05.09

* Fixed edge cases for token and NFT APIs

## 1.1.1 - 2024.04.10

* Improved performance for Deploys and Blocks APIs

## 1.1.0 - 2024.04.29

* Added ability to filter data by block height range

## v1.0.1 - 2024.03.26

* Improved stability of Streaming API connections

## 1.0.0 - 2024.03.12 🎉

* First release. Welcome, CSPR.cloud!


# AI skill

The CSPR.cloud API skill is a compact context package for AI coding agents that need to answer questions or generate code against the CSPR.cloud REST API, Streaming API, and Casper Node proxy.

The skill does not copy the full API documentation. It keeps CSPR.cloud-wide rules in the skill file and points agents to the public documentation for endpoint-specific details.

## Skill files

The skill package contains a single required file:

```
cspr-cloud/
  SKILL.md
```

## Installation

### Option 1 - Direct file (Claude Code and tools that support remote skill URLs)

Point your tool at the published skill file:

```
https://cspr.cloud/skill.md
```

For Claude Code, add the URL to your project or user skill configuration. No download or unpacking required.

### Option 2 - Archive (Codex and other tools)

Download the [CSPR.cloud API skill archive](https://casper-assets.s3.us-east-1.amazonaws.com/ai/cspr-cloud-skill.zip) and copy the unpacked `cspr-cloud` directory into the skill directory used by your AI coding tool.

```bash
unzip cspr-cloud-skill.zip
```

For Codex:

```bash
mkdir -p ~/.codex/skills
cp -R cspr-cloud ~/.codex/skills/
```

For Claude Code:

```bash
mkdir -p ~/.claude/skills
cp -R cspr-cloud ~/.claude/skills/
```

The installed directory must contain the `SKILL.md` file at its root.

Maintainers can update the source file from `docs/agentic-skills/cspr-cloud/SKILL.md` in this repository. Public users should use the GitBook download and do not need repository access.

## API key

CSPR.cloud APIs require an access token. Request an access token through [CSPR.cloud](https://cspr.cloud/) and keep it outside source control.

The recommended local setup is an environment variable:

```bash
export CSPR_CLOUD_API_KEY="your-access-token"
```

Ask the agent to read the token from `CSPR_CLOUD_API_KEY` and send it in the `Authorization` header. Do not put CSPR.cloud access tokens in browser code.

For runnable examples, the agent should check for `CSPR_CLOUD_API_KEY` and fail fast or ask you to set it when it is missing. For illustrative snippets, it should use a placeholder instead of a real token.

## Usage

Ask your agent to use the `cspr-cloud` skill when working with CSPR.cloud API requests, response parsing, pagination, optional includes, streaming subscriptions, or examples for Casper dApps.

The skill is designed to make the agent open only the relevant public documentation page for the current task instead of ingesting the whole documentation set.


# MCP server

The CSPR.cloud MCP server lets AI agents connect to CSPR.cloud through the Model Context Protocol. Use it when your agent supports remote MCP servers and you want it to call CSPR.cloud tools directly.

## Community project

The hosted MCP server is based on the community Casper MCP server. The source repository is available at [github.com/msanlisavas/casper-mcp](https://github.com/msanlisavas/casper-mcp).

## Endpoints

| Network | MCP endpoint                         |
| ------- | ------------------------------------ |
| Mainnet | `https://mcp.cspr.cloud/mcp`         |
| Testnet | `https://mcp.testnet.cspr.cloud/mcp` |

## API key

The hosted MCP server requires a CSPR.cloud API key. Store it in an environment variable and do not commit it to source control.

```bash
export CSPR_CLOUD_API_KEY="your-api-key"
```

## Codex setup

Codex stores MCP server configuration in `~/.codex/config.toml`. You can add the server with the CLI and then update the configuration to pass the API key as an HTTP header.

### 1. Add the MCP server

For Mainnet:

```bash
codex mcp add cspr_cloud --url https://mcp.cspr.cloud/mcp
```

For Testnet:

```bash
codex mcp add cspr_cloud_testnet --url https://mcp.testnet.cspr.cloud/mcp
```

### 2. Add the API-key header

Open `~/.codex/config.toml` and add `env_http_headers` to the CSPR.cloud MCP server entry.

Mainnet:

```toml
[mcp_servers.cspr_cloud]
url = "https://mcp.cspr.cloud/mcp"
env_http_headers = { "X-CSPR-Cloud-Api-Key" = "CSPR_CLOUD_API_KEY" }
```

Testnet:

```toml
[mcp_servers.cspr_cloud_testnet]
url = "https://mcp.testnet.cspr.cloud/mcp"
env_http_headers = { "X-CSPR-Cloud-Api-Key" = "CSPR_CLOUD_API_KEY" }
```

`env_http_headers` maps the HTTP header name to the environment variable that contains the value. In the example above, Codex reads `CSPR_CLOUD_API_KEY` and sends it as `X-CSPR-Cloud-Api-Key`.

### 3. Verify the connection

Start a new Codex session and run:

```
/mcp
```

The CSPR.cloud MCP server should appear in the active MCP servers list. If it does not, check that `CSPR_CLOUD_API_KEY` is exported in the shell where Codex is started and that the server entry is enabled in `~/.codex/config.toml`.

## Claude Code setup

Claude Code supports remote MCP servers over HTTP. Use `claude mcp add-json` so the API key can stay in the `CSPR_CLOUD_API_KEY` environment variable instead of being written directly into Claude configuration.

Claude Code supports multiple MCP scopes:

* `local` - available only in the current project. This is the default.
* `project` - shared through a `.mcp.json` file in the project root.
* `user` - available across all projects for the current user.

The examples below use `--scope project`, which writes a shareable `.mcp.json` file with an environment-variable placeholder instead of the API key. Claude Code asks you to approve project-scoped MCP servers before using them.

### 1. Add the MCP server

For Mainnet:

```bash
claude mcp add-json cspr_cloud --scope project \
  '{"type":"http","url":"https://mcp.cspr.cloud/mcp","headers":{"X-CSPR-Cloud-Api-Key":"${CSPR_CLOUD_API_KEY}"}}'
```

For Testnet:

```bash
claude mcp add-json cspr_cloud_testnet --scope project \
  '{"type":"http","url":"https://mcp.testnet.cspr.cloud/mcp","headers":{"X-CSPR-Cloud-Api-Key":"${CSPR_CLOUD_API_KEY}"}}'
```

Claude Code expands `${CSPR_CLOUD_API_KEY}` from the environment when it loads the MCP server. Start Claude Code from a shell where the variable is exported.

### 2. Verify the connection

From a terminal:

```bash
claude mcp list
```

Inside Claude Code:

```
/mcp
```

The CSPR.cloud MCP server should appear in the MCP servers list. If Claude reports a configuration parsing error, check that `CSPR_CLOUD_API_KEY` is set in the shell where Claude Code starts.


# Reference

This is a full list of the available CSPR.cloud REST API entities. Some of the entities are presented as root-level resources, and some represent related information of the root-level resources and are presented as their edges. The endpoints associated with each entity provide all the relevant data about that entity. Value objects that provide a mapping between identifiers and names aren't listed here and are documented with the corresponding endpoint documentation.

Entities may have relations to other entities. Such relations are exposed by the presence of one entity identifier in the other entity properties. Typically, it means that this identifier can be used as a [query filter](/documentation/overview/filtering) in the API requests and that the related entity could be included in the responses as an [optional property](/documentation/overview/optional-properties).

| Entity                                                                       | Description                                                                                                                          |
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| [Account](/rest-api/account)                                                 | Account observed in the network activity, which may not necessarily have the on-chain balance                                        |
| [Account info](/rest-api/account-info)                                       | Account info data provided through the [account information contract](https://github.com/make-software/casper-account-info-contract) |
| [Auction metrics](/rest-api/auction-metrics)                                 | Aggregated auction metrics for an era                                                                                                |
| [Awaiting Deploy](/rest-api/awaiting-deploy)                                 | Deploy that is awaiting for submission                                                                                               |
| [Block](/rest-api/block)                                                     | Normalized representation of the Casper Network block                                                                                |
| [Bidder](/rest-api/bidder)                                                   | Bidder participating in the auction                                                                                                  |
| [Centralized account info](/rest-api/centralized-account-info)               | Account information about known accounts provided by CSPR.cloud team                                                                 |
| [Contract](/rest-api/contract)                                               | Normalized representation of the Casper Network contract                                                                             |
| [Contract entry point](/rest-api/contract-entry-point)                       | Normalized representation of the Casper Network contract entry point                                                                 |
| [Contract package](/rest-api/contract-package)                               | Normalized representation of the Casper Network contract package                                                                     |
| [Currency](/rest-api/currency)                                               | Fiat and cryptocurrencies used in rate APIs                                                                                          |
| [Deploy](/rest-api/deploy)                                                   | Normalized representation of the Casper Network deploy                                                                               |
| [DEX](/rest-api/dex)                                                         | Decentralized exchanges (DEX) operating on Casper Network                                                                            |
| [Swap](/rest-api/swap)                                                       | DEX fungible token trades indexed from on-chain activity                                                                             |
| [Fungible token action](/rest-api/fungible-token-action)                     | Action performed on a fungible token                                                                                                 |
| [Fungible token ownership](/rest-api/fungible-token-ownership)               | Account fungible token ownership                                                                                                     |
| [Fungible token rate](/rest-api/fungible-token-rate)                         | Historical fungible token rates to fiat and popular cryptocurrencies                                                                 |
| [Fungible token daily rate](/rest-api/fungible-token-daily-rate)             | Historical average daily fungible token rates to fiat and popular cryptocurrencies                                                   |
| [Fungible token DEX rate](/rest-api/fungible-token-dex-rate)                 | DEX exchange rates between fungible token pairs                                                                                      |
| [Fungible token daily DEX rate](/rest-api/fungible-token-daily-dex-rate)     | Historical average daily DEX rates between fungible token pairs                                                                      |
| [Non-fungible token (NFT)](/rest-api/non-fungible-token)                     | Non-fungible token (NFT)                                                                                                             |
| [Non-fungible token (NFT) action](/rest-api/non-fungible-token-action)       | Action performed on a non-fungible token (NFT)                                                                                       |
| [Non-fungible token (NFT) ownership](/rest-api/non-fungible-token-ownership) | Non-fungible token (NFT) ownership                                                                                                   |
| [CSPR rate](/rest-api/cspr-rate)                                             | Historical CSPR rate to fiat and popular cryptocurrencies                                                                            |
| [CSPR supply](/rest-api/cspr-supply)                                         | Network native token (CSPR) supply information                                                                                       |
| [Transfer](/rest-api/transfer)                                               | Normalized representation of the Casper Network transfer transform                                                                   |
| [Validator](/rest-api/validator)                                             | Validator participating in an era                                                                                                    |
| [Validator reward](/rest-api/validator-reward)                               | Normalized representation of the Casper Network reward received by validator                                                         |
| [Validator performance](/rest-api/validator-performance)                     | Historical validator performance based on the era rewards information                                                                |


# Account

The `Account` entity represents accounts observed in the network activity. For example, when the corresponding public key was passed as a deploy argument. With this approach, [CSPR.cloud](http://CSPR.cloud) is also capable of capturing accounts that don’t have an on-chain balance, but which can own fungible or non-fungible tokens (NFT). Such accounts will have the purse and the on-chain balance returned by CSPR.cloud API.

## Properties

The `Account` entity has the following properties:

| Property                   | Type         | Description                                                                                                                          |
| -------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| `public_key`               | `string(68)` | Account public key represented as a hexadecimal string. Primary account identifier                                                   |
| `account_hash`             | `string(64)` | 32-byte hash of the `public_key` represented as a hexadecimal string. Secondary account identifier                                   |
| `balance`                  | `uint64`     | The liquid balance of the account’s main purse in motes                                                                              |
| `main_purse_uref`          | `string(73)` | Account main purse URef in the `uref-dead...beef-007` format                                                                         |
| `deployment_threshold`     | `uint64`     | The minimum total weight of associated keys required to deploy (i.e. execute transfer).                                              |
| `key_management_threshold` | `uint64`     | The minimum total weight of associated keys required to perform key management operations (e.g. add/remove keys, change thresholds). |
| `genesis_balance`          | `uint64`     | The initial token balance allocated to the account at the network genesis, before any transfers have occurred.                       |

**Example**

```json
{
  "account_hash": "fa12d2dd5547714f8c2754d418aa8c9d59dc88780350cb4254d622e2d4ef7e69",
  "balance": "1801534117600521",
  "genesis_balance": "1801534117600521",
  "deployment_threshold": 1,
  "key_management_threshold": 1,
  "main_purse_uref": "uref-bb9f47c30ddbe192438fad10b7db8200247529d6592af7159d92c5f3aa7716a1-007",
  "public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
}
```

## Optional properties

Depending on the endpoint some of the following optional properties may be included in the `Account` entity:

| Property                   | Type                                                           | Description                                                                                                                                                                                                                                                      |
| -------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `auction_status`           | `string`                                                       | Account auction status: `inactive_bidder`, `active_bidder`, `active_validator`, `pending_validator`                                                                                                                                                              |
| `delegated_balance`        | `uint64`                                                       | Total funds delegated across all validators                                                                                                                                                                                                                      |
| `staked_balance`           | `uint64`                                                       | Total funds staked as validator                                                                                                                                                                                                                                  |
| `undelegating_balance`     | `uint64`                                                       | Total undelegated funds that will be returned to the account main purse after the 7 era lockdown period. Accounts that delegate to a validator with a max delegation amount will have the exceed reward amount automatically undelegated at the end of every era |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the account owner                                                                                                                                                      |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                                                                                                                                                                     |
| `cspr_name`                | `string`                                                       | Primary CSPR.name of the account                                                                                                                                                                                                                                 |
| `rank`                     | `uint64`                                                       | Rank of the account based on its total balance on the network                                                                                                                                                                                                    |

## Relations

The `Account` entity has the following relations with other entities:

| Entity                                                           | Mapping property                            | Description                                                                                                                                               |
| ---------------------------------------------------------------- | ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`AccountInfo`](/rest-api/account-info)                          | `account_hash`                              | Account can have account info data if provided by the owner to the [Account Info contract](https://github.com/make-software/casper-account-info-contract) |
| [`Bidder`](/rest-api/bidder)                                     | `public_key`                                | Account can be a bidder in the auction                                                                                                                    |
| [`Contract package`](/rest-api/contract-package)                 | `owner_public_key`                          | Account can deploy contracts to the network                                                                                                               |
| [`Deploy`](/rest-api/deploy)                                     | `caller_public_key`                         | Account can call deploys on the network                                                                                                                   |
| [`Delegation`](/rest-api/delegation)                             | `proposer_public_key`                       | Account can have delegations to validators                                                                                                                |
| [`Delegator reward`](/rest-api/delegator-reward)                 | `public_key`                                | Account can receive delegator rewards                                                                                                                     |
| [`Fungible token ownership`](/rest-api/fungible-token-ownership) | `owner_hash`                                | Account can own fungible tokens                                                                                                                           |
| [`Fungible token action`](/rest-api/fungible-token-action)       | `from_hash`, `to_hash`                      | Account can be on the sending or receiving end of a fungible token action                                                                                 |
| [`NFT`](/rest-api/non-fungible-token)                            | `owner_hash`                                | Account can own NFTs                                                                                                                                      |
| [`NFT action`](/rest-api/non-fungible-token-action)              | `from_hash`, `to_hash`                      | Account can be on the sending or receiving end of a fungible token action                                                                                 |
| [`NFT ownership`](/rest-api/non-fungible-token-ownership)        | `owner_hash`                                | Account can own multiple NFTs in one NFT contract                                                                                                         |
| [`Transfer`](/rest-api/transfer)                                 | `initiator_account_hash`, `to_account_hash` | Account can initiate transfers and be a transfer recipient                                                                                                |
| [`Validator`](/rest-api/validator)                               | `public_key`                                | Account can be a validator                                                                                                                                |

## Endpoints

The `Account` entity has the following endpoints:

* [Get account](/rest-api/account/get-account)
* [Get accounts](/rest-api/account/get-accounts)
* [Get account associations](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/account/get-account-associations.md)

## Relation endpoints

The `Account` entity has the following relation endpoints:

* [Get account contract packages](/rest-api/contract-package/get-account-contract-packages)
* [Get account delegations](/rest-api/delegation/get-account-delegations)
* [Get account delegation rewards](/rest-api/delegator-reward/get-account-delegation-rewards)
* [Get total account delegation rewards](/rest-api/delegator-reward/get-account-total-delegation-rewards)
* [Get account deploys](/rest-api/deploy/get-account-deploys)
* [Get account fungible token ownership](/rest-api/fungible-token-ownership/get-account-fungible-token-ownership)
* [Get account fungible token actions](/rest-api/fungible-token-action/get-account-token-actions)
* [Get account NFTs](/rest-api/non-fungible-token/get-account-tokens)
* [Get account NFT actions](/rest-api/non-fungible-token-action/get-account-token-actions)
* [Get account transfers](/rest-api/transfer/get-account-transfers)


# Get account

Get account by its identifier (public key or account hash)

```
GET /accounts/{account_identifier}
```

## Query params

None

## Sorting

None

## Optional properties

| Property                   | Type                                                           | Description                                                                                                 |
| -------------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `auction_status`           | `string`                                                       | Account auction status: `inactive_bidder`, `active_bidder`, `active_validator`, `pending_validator`         |
| `delegated_balance`        | `uint64`                                                       | Total funds delegated across all validators                                                                 |
| `staked_balance`           | `uint64`                                                       | Total funds staked as validator                                                                             |
| `undelegating_balance`     | `uint64`                                                       | Total undelegated funds that will be returned to the account main purse after the 7 era lockdown period     |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the account owner |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                |
| `cspr_name`                | `string`                                                       | Primary CSPR.name of the account                                                                            |
| `rank`                     | `uint64`                                                       | Rank of the account based on its total balance on the network                                               |

## Response

[`Account`](/rest-api/account)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "account_hash": "fa12d2dd5547714f8c2754d418aa8c9d59dc88780350cb4254d622e2d4ef7e69",
    "balance": "1815031538762200",
    "deployment_threshold": 1,
    "genesis_balance": "1000000000000",
    "key_management_threshold": 1,
    "main_purse_uref": "uref-bb9f47c30ddbe192438fad10b7db8200247529d6592af7159d92c5f3aa7716a1-007",
    "public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
  }
}
```


# Get accounts

Get the paginated list of accounts

```
GET /accounts
```

## Query params

| Query param    | Description                            |
| -------------- | -------------------------------------- |
| `account_hash` | Comma-separated list of account hashes |

## Sorting

| Property        | Description                                                               |
| --------------- | ------------------------------------------------------------------------- |
| `balance`       | Sort accounts by the main purse balance                                   |
| `total_balance` | Sort accounts by the total account balance, including the delegated funds |

Default sorting is `total_balance DESC`

## Optional properties

| Property                   | Type                                                           | Description                                                                                                 |
| -------------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `auction_status`           | `string`                                                       | Account auction status: `inactive_bidder`, `active_bidder`, `active_validator`, `pending_validator`         |
| `delegated_balance`        | `uint64`                                                       | Total funds delegated across all validators                                                                 |
| `staked_balance`           | `uint64`                                                       | Total funds staked as validator                                                                             |
| `undelegating_balance`     | `uint64`                                                       | Total undelegated funds that will be returned to the account main purse after the 7 era lockdown period     |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the account owner |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                |
| `cspr_name`                | `string`                                                       | Primary CSPR.name of the account                                                                            |
| `rank`                     | `uint64`                                                       | Rank of the account based on its total balance on the network                                               |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Account>`](/rest-api/account)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "account_hash": "b383c7cc23d18bc1b42406a1b2d29fc8dba86425197b6f553d7fd61375b5e446",
      "balance": "8744504704680363000",
      "deployment_threshold": 1,
      "genesis_balance": "9999995600000000000",
      "key_management_threshold": 1,
      "main_purse_uref": "uref-b06a1ab0cfb52b5d4f9a08b68a5dbe78e999de0b0484c03e64f5c03897cf637b-007",
      "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02"
    },
    {
      "account_hash": "681a66e75cdeacd4c00ec94b1508b75f2e4dbb4b04ca732be688a006317f47d6",
      "balance": "57000019000000000",
      "deployment_threshold": 1,
      "genesis_balance": null,
      "key_management_threshold": 1,
      "main_purse_uref": "uref-b1376e532a6af911a692cec42b3468c90e6d84f6edeea4b20c824062affa7c4e-007",
      "public_key": "0202036ef47003f6f2dbb7d2d9f00d191146e4890ed289e31b7fab02035c1ddd8ca3"
    },
    ...
    {
      "account_hash": "9081ded33b9d55aab6801da9c2fa5ce0750aee6eac158ae4989ee733def542f3",
      "balance": "2122653718133811",
      "deployment_threshold": 1,
      "genesis_balance": null,
      "key_management_threshold": 1,
      "main_purse_uref": "uref-ee882b37ed505a6fb240b2cc843c82c5a8107fafc2a234c5838ac9013b98046e-007",
      "public_key": "015ac0d71b2142f35c974471589876bc7684bf4e495354a885ebd0ac2b1ffbcc01"
    }
  ],
  "item_count": 101225,
  "page_count": 10123
}
```


# Account Info

The `AccountInfo` entity provides off-chain account information provided by the account owner with [Casper Account Info Standard](https://github.com/make-software/casper-account-info-standard) contract. Additional account info is often provided by validators or contract owners to prove their identity.

## Properties

The `AccountInfo` entity has the following properties:

| Property                  | Type         | Description                                                                                                                                                |
| ------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account_hash`            | `string(64)` | Account hash represented as a hexadecimal string                                                                                                           |
| `url`                     | `string`     | The top level domain URL that holds the account information                                                                                                |
| `is_active`               | `boolean`    | Indicate whether account information is active or was deactivated by the owner                                                                             |
| `info`                    | `JSON`       | JSON representation of the account info data                                                                                                               |
| `deploy_hash`             | `string(64)` | Hash of the [Casper Account Info Contract](https://github.com/make-software/casper-account-info-contract#) call deploy represented as a hexadecimal string |
| `verified_account_hashes` | `[]string`   | List of verified account hashes that share the same account info                                                                                           |
| `created`                 | `datetime`   | Account info creation timestamp                                                                                                                            |
| `updated`                 | `datetime`   | Account info last update timestamp                                                                                                                         |

**Example**

```json
{
  "account_hash": "fa12d2dd5547714f8c2754d418aa8c9d59dc88780350cb4254d622e2d4ef7e69",
  "url": "http://makestake.io",
  "is_active": true,
  "info": {
    "nodes": [
      {
        "location": {
          "name": "Ashburn, VA",
          "country": "US",
          "latitude": 39.04372,
          "longitude": -77.48749
        },
        "public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca",
        "description": "MAKE's first Casper Testnet validator",
        "functionality": [
          "validator"
        ]
      },
      {
        "location": {
          "name": "Ashburn, VA",
          "country": "US",
          "latitude": 39.04372,
          "longitude": -77.48749
        },
        "public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e",
        "description": "MAKE's second Casper Testnet validator",
        "functionality": [
          "validator"
        ]
      }
    ],
    "owner": {
      "name": "MAKE",
      "type": [
        "validator",
        "corporation"
      ],
      "email": "hello@makestake.io",
      "social": {
        "github": "make-software",
        "medium": "",
        "reddit": "",
        "wechat": "",
        "keybase": "",
        "twitter": "@WeAreTeamMAKE",
        "youtube": "",
        "facebook": "",
        "telegram": ""
      },
      "website": "https://makestake.io",
      "branding": {
        "logo": {
          "svg": "https://make.services/logo.svg",
          "png_256": "https://make.services/logo256.png",
          "png_1024": "https://make.services/logo1024.png"
        }
      },
      "identity": {
        "other": null,
        "ownership_disclosure_url": "https://makestake.io/ownership-disclosure",
        "casper_association_kyc_url": "",
        "casper_association_kyc_onchain": ""
      },
      "location": {
        "name": "Cheyenne, WY",
        "country": "US",
        "latitude": 41.14,
        "longitude": -104.820274
      },
      "resources": {
        "other": [],
        "privacy_policy_url": "https://makestake.io/privacy",
        "code_of_conduct_url": "",
        "terms_of_service_url": "https://makestake.io/tos"
      },
      "description": "MAKE is the leading technology provider for the Casper Network and creator of the CSPR Product Suite",
      "affiliated_accounts": [
        {
          "public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e"
        },
        {
          "public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
        },
        {
          "public_key": "0202859e04bab609744b291b54ef97b55cb3120c940cd620977f8d2687ca5bd0168c"
        },
        {
          "public_key": "01fc3b35c25fdce6fc6127fc5da32a828d51eaacab816e80611f23f4cf063bc319"
        }
      ]
    }
  },
  "deploy_hash": "5a9b3853d596243fd1b8f0a107ec7c7042ab226e628c7e742c455deab15e9719",
  "verified_account_hashes": [
    "21EAEA584903E79365BCB1F7607179CC118807033C8919CFF7489A91C3A822D1",
    "D3CCFD0DAF03E656CB4E86158E5F54BE686D9FAA91CAE3ED9310E167E65592E5",
    "FA12D2DD5547714F8C2754D418AA8C9D59DC88780350CB4254D622E2D4EF7E69"
  ],
  "created": "2021-09-17T20:24:35Z",
  "updated": "2023-09-12T00:00:01Z"
}
```

## Optional properties

None

## Relations

The `AccountInfo` entity has the following relations with other entities:

| Entity                                                           | Mapping property | Description                                                                                                           |
| ---------------------------------------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------- |
| [`Deploy`](/rest-api/deploy)                                     | `deploy_hash`    | Contracts are deployed to the network with a deploy call                                                              |
| [`Account`](/rest-api/account)                                   | `account_hash`   | Account info provides information about an account                                                                    |
| [`Bidder`](/rest-api/bidder)                                     | `account_hash`   | Bidder accounts may have account info provided                                                                        |
| [`Block`](/rest-api/block)                                       | `account_hash`   | Block proposer accounts may have account info provided                                                                |
| [`Contract package`](/rest-api/contract-package)                 | `account_hash`   | Contract package owners may have account info provided                                                                |
| [`CSPR.name resolution`](http://CSPR.name)                       | `account_hash`   | CSPR.name resolution target accounts may have account info provided                                                   |
| [`Delegation`](/rest-api/delegation)                             | `account_hash`   | Both delegators and validators may have account info provided                                                         |
| [`Delegator reward`](/rest-api/delegator-reward)                 | `account_hash`   | Both delegators and validators may have account info provided                                                         |
| [`Fungible token action`](/rest-api/fungible-token-action)       | `account_hash`   | Fungible token action sender and recipient accounts, as well as deploy caller accounts may have account info provided |
| [`Fungible token ownership`](/rest-api/fungible-token-ownership) | `account_hash`   | Fungible token owner accounts may have account info provided                                                          |
| [`Fungible token ownership`](/rest-api/fungible-token-ownership) | `account_hash`   | Fungible token owner accounts may have account info provided                                                          |
| [`NFT action`](/rest-api/non-fungible-token-action)              | `account_hash`   | NFT action sender and recipient accounts, as well as deploy caller accounts may have account info provided            |
| [`NFT ownership`](/rest-api/non-fungible-token-ownership)        | `account_hash`   | NFT owner accounts may have account info provided                                                                     |
| [`Transfer`](/rest-api/transfer)                                 | `account_hash`   | Transfer sender and recipient accounts, as well as deploy caller accounts may have account info provided              |
| [`Validator`](/rest-api/validator)                               | `account_hash`   | Validator accounts may have account info provided                                                                     |

## Endpoints

The `AccountInfo` entity has the following endpoints:

* [Get account info](/rest-api/account-info/get-account-info)
* [Get account infos](/rest-api/account-info/get-account-infos)

## Relation endpoints

None


# Get account info

Get account info by account hash.

## Endpoint

```
GET /account-info/{account_hash}
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

[`AccountInfo`](/rest-api/account-info)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/account-info/fa12d2dd5547714f8c2754d418aa8c9d59dc88780350cb4254d622e2d4ef7e69' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "account_hash": "fa12d2dd5547714f8c2754d418aa8c9d59dc88780350cb4254d622e2d4ef7e69",
    "url": "http://makestake.io",
    "is_active": true,
    "info": {
      "nodes": [
        {
          "location": {
            "name": "Ashburn, VA",
            "country": "US",
            "latitude": 39.04372,
            "longitude": -77.48749
          },
          "public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca",
          "description": "MAKE's first Casper Testnet validator",
          "functionality": [
            "validator"
          ]
        },
        {
          "location": {
            "name": "Ashburn, VA",
            "country": "US",
            "latitude": 39.04372,
            "longitude": -77.48749
          },
          "public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e",
          "description": "MAKE's second Casper Testnet validator",
          "functionality": [
            "validator"
          ]
        }
      ],
      "owner": {
        "name": "MAKE",
        "type": [
          "validator",
          "corporation"
        ],
        "email": "hello@makestake.io",
        "social": {
          "github": "make-software",
          "medium": "",
          "reddit": "",
          "wechat": "",
          "keybase": "",
          "twitter": "@WeAreTeamMAKE",
          "youtube": "",
          "facebook": "",
          "telegram": ""
        },
        "website": "https://makestake.io",
        "branding": {
          "logo": {
            "svg": "https://make.services/logo.svg",
            "png_256": "https://make.services/logo256.png",
            "png_1024": "https://make.services/logo1024.png"
          }
        },
        "identity": {
          "other": null,
          "ownership_disclosure_url": "https://makestake.io/ownership-disclosure",
          "casper_association_kyc_url": "",
          "casper_association_kyc_onchain": ""
        },
        "location": {
          "name": "Cheyenne, WY",
          "country": "US",
          "latitude": 41.14,
          "longitude": -104.820274
        },
        "resources": {
          "other": [],
          "privacy_policy_url": "https://makestake.io/privacy",
          "code_of_conduct_url": "",
          "terms_of_service_url": "https://makestake.io/tos"
        },
        "description": "MAKE is the leading technology provider for the Casper Network and creator of the CSPR Product Suite",
        "affiliated_accounts": [
          {
            "public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e"
          },
          {
            "public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
          },
          {
            "public_key": "0202859e04bab609744b291b54ef97b55cb3120c940cd620977f8d2687ca5bd0168c"
          },
          {
            "public_key": "01fc3b35c25fdce6fc6127fc5da32a828d51eaacab816e80611f23f4cf063bc319"
          }
        ]
      }
    },
    "deploy_hash": "5a9b3853d596243fd1b8f0a107ec7c7042ab226e628c7e742c455deab15e9719",
    "verified_account_hashes": [
      "21EAEA584903E79365BCB1F7607179CC118807033C8919CFF7489A91C3A822D1",
      "D3CCFD0DAF03E656CB4E86158E5F54BE686D9FAA91CAE3ED9310E167E65592E5",
      "FA12D2DD5547714F8C2754D418AA8C9D59DC88780350CB4254D622E2D4EF7E69"
    ],
    "created": "2021-09-17T20:24:35Z",
    "updated": "2023-09-12T00:00:01Z"
  }
}
```


# Get account infos

Get account infos

## Endpoint

```
GET /account-info
```

## Query params

| Name           | Type       | Description                            |
| -------------- | ---------- | -------------------------------------- |
| `account_hash` | `[]string` | Comma-separated list of account hashes |

To overcome the URL length limitations of the GET request, it's possible to use the POST endpoint:

```
POST /account-info
```

## Sorting

None

## Optional properties

None

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<AccountInfo>`](/rest-api/account-info)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/account-info?account_hash=fa12d2dd5547714f8c2754d418aa8c9d59dc88780350cb4254d622e2d4ef7e69,21eaea584903e79365bcb1f7607179cc118807033c8919cff7489a91c3a822d1,d3ccfd0daf03e656cb4e86158e5f54be686d9faa91cae3ed9310e167e65592e5' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "account_hash": "21eaea584903e79365bcb1f7607179cc118807033c8919cff7489a91c3a822d1",
      "url": "http://makestake.io",
      "is_active": true,
      "info": {
        "nodes": [
          {
            "location": {
              "name": "Ashburn, VA",
              "country": "US",
              "latitude": 39.04372,
              "longitude": -77.48749
            },
            "public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca",
            "description": "MAKE's first Casper Testnet validator",
            "functionality": [
              "validator"
            ]
          },
          {
            "location": {
              "name": "Ashburn, VA",
              "country": "US",
              "latitude": 39.04372,
              "longitude": -77.48749
            },
            "public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e",
            "description": "MAKE's second Casper Testnet validator",
            "functionality": [
              "validator"
            ]
          }
        ],
        "owner": {
          "name": "MAKE",
          "type": [
            "validator",
            "corporation"
          ],
          "email": "hello@makestake.io",
          "social": {
            "github": "make-software",
            "medium": "",
            "reddit": "",
            "wechat": "",
            "keybase": "",
            "twitter": "@WeAreTeamMAKE",
            "youtube": "",
            "facebook": "",
            "telegram": ""
          },
          "website": "https://makestake.io",
          "branding": {
            "logo": {
              "svg": "https://make.services/logo.svg",
              "png_256": "https://make.services/logo256.png",
              "png_1024": "https://make.services/logo1024.png"
            }
          },
          "identity": {
            "other": null,
            "ownership_disclosure_url": "https://makestake.io/ownership-disclosure",
            "casper_association_kyc_url": "",
            "casper_association_kyc_onchain": ""
          },
          "location": {
            "name": "Cheyenne, WY",
            "country": "US",
            "latitude": 41.14,
            "longitude": -104.820274
          },
          "resources": {
            "other": [],
            "privacy_policy_url": "https://makestake.io/privacy",
            "code_of_conduct_url": "",
            "terms_of_service_url": "https://makestake.io/tos"
          },
          "description": "MAKE is the leading technology provider for the Casper Network and creator of the CSPR Product Suite",
          "affiliated_accounts": [
            {
              "public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e"
            },
            {
              "public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
            },
            {
              "public_key": "0202859e04bab609744b291b54ef97b55cb3120c940cd620977f8d2687ca5bd0168c"
            },
            {
              "public_key": "01fc3b35c25fdce6fc6127fc5da32a828d51eaacab816e80611f23f4cf063bc319"
            }
          ]
        }
      },
      "deploy_hash": "722e4c7e25c1a3c50b6c4cdeea7b3f205f14977f5c915761ab34fc702561dd3b",
      "verified_account_hashes": [
        "21EAEA584903E79365BCB1F7607179CC118807033C8919CFF7489A91C3A822D1",
        "D3CCFD0DAF03E656CB4E86158E5F54BE686D9FAA91CAE3ED9310E167E65592E5",
        "FA12D2DD5547714F8C2754D418AA8C9D59DC88780350CB4254D622E2D4EF7E69"
      ],
      "created": "2021-09-17T20:24:35Z",
      "updated": "2023-09-12T00:00:01Z"
    },
    ...
  ],
  "item_count": 3,
  "page_count": 1
}
```


# Auction metrics

The `AuctionMetrics` entity represents calculated metrics for the era retrieved from [auction info](https://docs.casper.network/developers/json-rpc/json-rpc-pos/#state-get-auction-info)

## Properties

The `AuctionMetrics` entity has the following properties:

| Property                  | Type     | Description                                                 |
| ------------------------- | -------- | ----------------------------------------------------------- |
| `current_era_id`          | `uint32` | Current era identifier                                      |
| `active_validator_number` | `uint32` | Current number of active validators                         |
| `total_bids_number`       | `uint32` | Total number of [bidders](/rest-api/bidder)                 |
| `active_bids_number`      | `uint32` | Number of active [bidders](/rest-api/bidder)                |
| `total_active_era_stake`  | `uint64` | Total sum of all validator stakes from current and next era |

**Example**

```json
{
  "data": {
    "current_era_id": 12137,
    "active_validator_number": 100,
    "total_bids_number": 256,
    "active_bids_number": 110,
    "total_active_era_stake": "17143148308665709822"
  }
}
```

## Optional properties

None

## Relations

| Entity                             | Mapping property                       | Description                                                  |
| ---------------------------------- | -------------------------------------- | ------------------------------------------------------------ |
| [`Bidder`](/rest-api/bidder)       | `total_bids_number,active_bids_number` | Validators with active bids are bidders in the auction era   |
| [`Validator`](/rest-api/validator) | `total_active_era_stake`               | Validators of the current and next era hold active era stake |

## Endpoints

The `AuctionMetrics` entity has the following endpoints:

* [Get auction metrics](/rest-api/auction-metrics/get-auction-metrics)

## Relation endpoints

None


# Get auction metrics

Get auction metrics

```
GET /auction-metrics
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

[`AuctionMetrics`](/rest-api/auction-metrics)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/auction-metrics' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "current_era_id": 12137,
    "active_validator_number": 100,
    "total_bids_number": 256,
    "active_bids_number": 110,
    "total_active_era_stake": "17143148308665709822"
  }
}
```


# Awaiting deploy

`AwaitingDeploy` is a Casper deploy that is awaiting submission, and temporarily stored on CSPR.cloud before submission, in order to perform some additional modifications, such as collecting additional signatures. A perfect use case for this functionality is [Multisig Deploys](https://docs.casper.network/developers/cli/transfers/multisig-deploy-transfer/)

{% hint style="info" %}
This API is not available for the "Free" tier
{% endhint %}

## Properties

The `AwaitingDeploy` entity has the following properties:

| Property | Type            | Description       |
| -------- | --------------- | ----------------- |
| `deploy` | `casper.Deploy` | Casper raw deploy |

**Example**

```json
{
  "deploy": {
    "hash": "aa46828cd1b756686c2ed1af7fcd8ab0b37305a208164dd55aaf19d23607dfa9",
    "header": {
      "ttl": "30m",
      "account": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
      "body_hash": "3d5b08d531e9bd979d20f40b8ba74fc47ae5d209a42f64a345220661e5000254",
      "gas_price": 1,
      "timestamp": "2024-02-08T09:13:35.291Z",
      "chain_name": "casper-test",
      "dependencies": []
    },
    "payment": {
      "ModuleBytes": {
        "args": [
          [
            "amount",
            {
              "bytes": "0400f90295",
              "parsed": "2500000000",
              "cl_type": "U512"
            }
          ]
        ],
        "module_bytes": ""
      }
    },
    "session": {
      "StoredContractByHash": {
        "args": [
          [
            "validator",
            {
              "bytes": "010e5669b070545e2b32bc66363b9d3d4390fca56bf52a05f1411b7fa18ca311c7",
              "parsed": "010e5669b070545e2b32bc66363b9d3d4390fca56bf52a05f1411b7fa18ca311c7",
              "cl_type": "PublicKey"
            }
          ],
          [
            "amount",
            {
              "bytes": "050006e78aa5",
              "parsed": "711000000000",
              "cl_type": "U512"
            }
          ],
          [
            "delegator",
            {
              "bytes": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
              "parsed": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
              "cl_type": "PublicKey"
            }
          ]
        ],
        "hash": "93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2",
        "entry_point": "undelegate"
      }
    },
    "approvals": [
      {
        "signer": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
        "signature": "013815f5f7ca37cb16ffd1277afdc11e3bc765a072d839e9ebf1bf3798f3671c1cf77cb1d6c8367b6ab11a014829e4d03c4950721705fc0eec3f9e91fb9a8d180d"
      },
      {
        "signer": "01b687decf949c368be61262a622bb302d0ce2b12cad9b2f01d7ba08aa9e3e3f03",
        "signature": "0106689cf2941047a36cc4b1dc096fdafb54534f5b102192529213361087a319d6c478d5dba27263e45b4b6aa2e379b18a61bf3740af48ea9b7b5f74328e13f901"
      },
      {
        "signer": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
        "signature": "0140ead54fe89528216ed9cbb3ee45648ed2a965f9d2f8dfeb3f1446f4e42ae832857384fc6129545b0655f5a71c2213199e19eb4616e36b71c733d3131a043608"
      }
    ]
  }
}
```

## Optional properties

None

## Relations

None

## Endpoints

The `AwaitingDeploy` entity has the following endpoints:

* [Create Awaiting Deploy](/rest-api/awaiting-deploy/create-awaiting-deploy)
* [Add Awaiting Deploy signatures](/rest-api/awaiting-deploy/add-awaiting-deploy-signatures)
* [Get Awaiting Deploy](/rest-api/awaiting-deploy/get-awaiting-deploy)

## Relation endpoints

None


# Create Awaiting Deploy

Creates awaiting deploy

```
POST /awaiting-deploys
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

Status \[`boolean`]

## Example

```bash
curl -X 'POST' \
  'https://api.testnet.cspr.cloud/awaiting-deploys' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
  -d '{
    "hash": "aa46828cd1b756686c2ed1af7fcd8ab0b37305a208164dd55aaf19d23607dfa9",
    "header": {
      "ttl": "30m",
      "account": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
      "body_hash": "3d5b08d531e9bd979d20f40b8ba74fc47ae5d209a42f64a345220661e5000254",
      "gas_price": 1,
      "timestamp": "2024-02-08T09:13:35.291Z",
      "chain_name": "casper-test",
      "dependencies": []
    },
    "payment": {
      "ModuleBytes": {
        "args": [
          [
            "amount",
            {
              "bytes": "0400f90295",
              "parsed": "2500000000",
              "cl_type": "U512"
            }
          ]
        ],
        "module_bytes": ""
      }
    },
    "session": {
      "StoredContractByHash": {
        "args": [
          [
            "validator",
            {
              "bytes": "010e5669b070545e2b32bc66363b9d3d4390fca56bf52a05f1411b7fa18ca311c7",
              "parsed": "010e5669b070545e2b32bc66363b9d3d4390fca56bf52a05f1411b7fa18ca311c7",
              "cl_type": "PublicKey"
            }
          ],
          [
            "amount",
            {
              "bytes": "050006e78aa5",
              "parsed": "711000000000",
              "cl_type": "U512"
            }
          ],
          [
            "delegator",
            {
              "bytes": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
              "parsed": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
              "cl_type": "PublicKey"
            }
          ]
        ],
        "hash": "93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2",
        "entry_point": "undelegate"
      }
    },
    "approvals": [
      {
        "signer": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
        "signature": "013815f5f7ca37cb16ffd1277afdc11e3bc765a072d839e9ebf1bf3798f3671c1cf77cb1d6c8367b6ab11a014829e4d03c4950721705fc0eec3f9e91fb9a8d180d"
      }
    ]
  }'
```

HTTP Status Created (201)

```json
{
  "data": true
}
```


# Add Awaiting Deploy signatures

Add more signatures to awaiting deploy

```
POST /awaiting-deploys/{deploy_hash}/approvals
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

Status \[`boolean`]

## Example

```bash
curl -X 'POST' \
  'https://api.testnet.cspr.cloud/awaiting-deploys/aa46828cd1b756686c2ed1af7fcd8ab0b37305a208164dd55aaf19d23607dfa9' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
  -d '{
        "signer": "01b687decf949c368be61262a622bb302d0ce2b12cad9b2f01d7ba08aa9e3e3f03",
        "signature": "01dcb1af7af51f02e67cb1f3dad48ddaa8ede92e72f428d298f69ffbbe53441ab52beb19a5405968c9c60b9262a980d8ccb93f56a358aaee67ff16b73ab9879103"
      }'
```

HTTP Status Created (201)

```json
{
  "data": true
}
```


# Get Awaiting Deploy

Get awaiting deploy by its hash

```
GET /awaiting-deploys/{deploy_hash}
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

[`AwaitingDeploy`](/rest-api/awaiting-deploy)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/awaiting-deploys/aa46828cd1b756686c2ed1af7fcd8ab0b37305a208164dd55aaf19d23607dfa9' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "deploy": {
    "hash": "aa46828cd1b756686c2ed1af7fcd8ab0b37305a208164dd55aaf19d23607dfa9",
    "header": {
      "ttl": "30m",
      "account": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
      "body_hash": "3d5b08d531e9bd979d20f40b8ba74fc47ae5d209a42f64a345220661e5000254",
      "gas_price": 1,
      "timestamp": "2024-02-08T09:13:35.291Z",
      "chain_name": "casper-test",
      "dependencies": []
    },
    "payment": {
      "ModuleBytes": {
        "args": [
          [
            "amount",
            {
              "bytes": "0400f90295",
              "parsed": "2500000000",
              "cl_type": "U512"
            }
          ]
        ],
        "module_bytes": ""
      }
    },
    "session": {
      "StoredContractByHash": {
        "args": [
          [
            "validator",
            {
              "bytes": "010e5669b070545e2b32bc66363b9d3d4390fca56bf52a05f1411b7fa18ca311c7",
              "parsed": "010e5669b070545e2b32bc66363b9d3d4390fca56bf52a05f1411b7fa18ca311c7",
              "cl_type": "PublicKey"
            }
          ],
          [
            "amount",
            {
              "bytes": "050006e78aa5",
              "parsed": "711000000000",
              "cl_type": "U512"
            }
          ],
          [
            "delegator",
            {
              "bytes": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
              "parsed": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
              "cl_type": "PublicKey"
            }
          ]
        ],
        "hash": "93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2",
        "entry_point": "undelegate"
      }
    },
    "approvals": [
      {
        "signer": "0176197d7191ce519ed043221956a2227921abf30364d4362970229027ec828f04",
        "signature": "013815f5f7ca37cb16ffd1277afdc11e3bc765a072d839e9ebf1bf3798f3671c1cf77cb1d6c8367b6ab11a014829e4d03c4950721705fc0eec3f9e91fb9a8d180d"
      }
    ]
  }
}
```


# Block

The `Block` entity provides a normalized representation of the Casper Network block. It doesn't contain the executed deploy hashes as the network block object. However, they could be queried separately using the [Deploy](/rest-api/deploy) API.

## Properties

The `Block` entity has the following properties:

| Property                     | Type         | Description                                                                                               |
| ---------------------------- | ------------ | --------------------------------------------------------------------------------------------------------- |
| `block_height`               | `uint64`     | Block height. Primary block identifier                                                                    |
| `block_hash`                 | `string(64)` | Block hash represented as a hexadecimal string. Secondary block identifier                                |
| `parent_block_hash`          | `string(64)` | Parent block hash represented as a hexadecimal string                                                     |
| `state_root_hash`            | `string(64)` | Identifier of the network's state after executing the block's deploys represented as a hexadecimal string |
| `era_id`                     | `uint32`     | Era ID in which the block was created                                                                     |
| `proposer_public_key`        | `string(68)` | Public key of the validator who proposed the block represented as a hexadecimal string                    |
| `is_switch_block`            | `bool`       | `true` if the block is the last one in the era                                                            |
| `gas_price`                  | `uint8`      | The gas price (cost per unit of gas) used for deploys in the block                                        |
| `version_id`                 | `uint8`      | Block version identifier. Value is `1` for Casper 2.0 blocks, and `0` for 1.X versions blocks             |
| `native_transfers_number`    | `uint16`     | Number of native transfer deploys included in the block                                                   |
| `contract_calls_number`      | `uint16`     | Number of contract calls included in the block                                                            |
| `auction_txn_number`         | `uint16`     | Number of auction-related transactions included in the block                                              |
| `install_upgrade_txn_number` | `uint16`     | Number of install or upgrade transactions in the block                                                    |
| `small_txn_number`           | `uint16`     | Number of `small` transactions in the block \*                                                            |
| `medium_txn_number`          | `uint16`     | Number of `medium` transactions in the block \*                                                           |
| `large_txn_number`           | `uint16`     | Number of `large` transactions in the block \*                                                            |
| `timestamp`                  | `datetime`   | The timestamp from when the block was proposed                                                            |

* Please refer to the network `chainspec.toml` file for the exact configuration for `small`, `medium` and `large` transactions.

**Example**

```json
{
  "auction_txn_number": 1,
  "block_hash": "cb549c2a75fa7d3aa5f7007642d7f6b36f44c2cd1b24d54f5b0e07ca1c3c3614",
  "block_height": 4685962,
  "contract_calls_number": 1,
  "era_id": 17221,
  "gas_price": 1,
  "install_upgrade_txn_number": 0,
  "is_switch_block": false,
  "large_txn_number": 0,
  "medium_txn_number": 0,
  "native_transfers_number": 0,
  "parent_block_hash": "46a73212616c1477581fca4c991bcd65bb56bb1e69df50aa7ee4048bb68d98e8",
  "proposer_public_key": "011330bc6ba272373ce0294efc7d78cc3d41a147ecfd89f7d9ab6435d32ac1cb14",
  "small_txn_number": 0,
  "state_root_hash": "f63e5228c2da89226a837c6e9aeeb06fdab97255e0c95e776dfba5160ca7875a",
  "timestamp": "2025-03-18T16:23:17Z",
  "version_id": 1
}
```

## Optional properties

Depending on the endpoint some of the following optional properties may be included in the `Block` entity:

| Property                            | Type                                                           | Description                                                                                                    |
| ----------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `proposer_account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the proposer account |
| `proposer_centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                   |
| `proposer_cspr_name`                | `string`                                                       | Primary CSPR.name of the block proposer account                                                                |

## Relations

| Entity                                                     | Mapping property      | Description                                                       |
| ---------------------------------------------------------- | --------------------- | ----------------------------------------------------------------- |
| [`Deploy`](/rest-api/deploy)                               | `block_hash`          | Blocks can have deploys                                           |
| [`Validator`](/rest-api/validator)                         | `proposer_public_key` | Blocks are proposed by validators                                 |
| [`Contract`](/rest-api/contract)                           | `block_hash`          | Contract deployment is a transaction in block                     |
| [`Fungible token action`](/rest-api/fungible-token-action) | `block_hash`          | Fungible token actions are results of deploy execution in a block |
| [`NFT action`](/rest-api/non-fungible-token-action)        | `block_hash`          | NFT actions are results of deploy execution in a block            |
| [`Transfer`](/rest-api/transfer)                           | `block_hash`          | Transfers are results of deploy execution in a block              |

## Endpoints

The `Block` entity has the following endpoints:

* [Get block](/rest-api/block/get-block)
* [Get blocks](/rest-api/block/get-blocks)
* [Get validator blocks](/rest-api/block/get-validator-blocks)

## Relation endpoints

The `Block` entity has the following relation endpoints:

* [Get block deploys](/rest-api/deploy/get-block-deploys)


# Get block

Get block by its identifier (block height or block hash)

```
GET /blocks/{block_identifier}
```

## Query params

None

## Sorting

None

## Optional properties

| Property                            | Type                                                           | Description                                                                                                  |
| ----------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `proposer_account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the block proposer |
| `proposer_centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                 |
| `proposer_cspr_name`                | `string`                                                       | Primary CSPR.name of the block proposer account                                                              |

## Response

[`Block`](/rest-api/block)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/blocks/CB549C2A75FA7D3AA5F7007642D7F6B36F44C2CD1B24D54F5B0E07CA1C3C3614' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "auction_txn_number": 1,
    "block_hash": "cb549c2a75fa7d3aa5f7007642d7f6b36f44c2cd1b24d54f5b0e07ca1c3c3614",
    "block_height": 4685962,
    "contract_calls_number": 1,
    "era_id": 17221,
    "gas_price": 1,
    "install_upgrade_txn_number": 0,
    "is_switch_block": false,
    "large_txn_number": 0,
    "medium_txn_number": 0,
    "native_transfers_number": 0,
    "parent_block_hash": "46a73212616c1477581fca4c991bcd65bb56bb1e69df50aa7ee4048bb68d98e8",
    "proposer_public_key": "011330bc6ba272373ce0294efc7d78cc3d41a147ecfd89f7d9ab6435d32ac1cb14",
    "small_txn_number": 0,
    "state_root_hash": "f63e5228c2da89226a837c6e9aeeb06fdab97255e0c95e776dfba5160ca7875a",
    "timestamp": "2025-03-18T16:23:17Z",
    "version_id": 1
  }
}
```


# Get blocks

Get paginated list of blocks

```
GET /blocks
```

## Query params

| Query param           | Description         |
| --------------------- | ------------------- |
| `proposer_public_key` | Proposer public key |

## Sorting

| Property       | Description                 |
| -------------- | --------------------------- |
| `block_height` | Sort blocks by block height |
| `timestamp`    | Sort blocks by timestamp    |

Default sorting is `block_height DESC`

## Optional properties

| Property                            | Type                                                           | Description                                                                                                  |
| ----------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `proposer_account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the block proposer |
| `proposer_centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                 |
| `proposer_cspr_name`                | `string`                                                       | Primary CSPR.name of the block proposer account                                                              |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Block>`](/rest-api/block)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/blocks' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 5048237,
  "page_count": 504824,
  "data": [
    {
      "auction_txn_number": 0,
      "block_hash": "c1dde749603911524b24114bf4c59d79bb43f08c94165886c98728c6fbb5a3d4",
      "block_height": 5048236,
      "contract_calls_number": 0,
      "era_id": 18046,
      "gas_price": 1,
      "install_upgrade_txn_number": 0,
      "is_switch_block": false,
      "large_txn_number": 0,
      "medium_txn_number": 0,
      "native_transfers_number": 1,
      "parent_block_hash": "c4b3c15b7038e3bb68a6c155f38b8a44bc3bde3897a427296a000f659f43a7d9",
      "proposer_public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e",
      "small_txn_number": 0,
      "state_root_hash": "30f593517434343a88a7ed8f039aa755367cd66a90f606af0de7e19f1c144ff6",
      "timestamp": "2025-05-26T07:35:27Z",
      "version_id": 1
    },
    {
      "auction_txn_number": 0,
      "block_hash": "c4b3c15b7038e3bb68a6c155f38b8a44bc3bde3897a427296a000f659f43a7d9",
      "block_height": 5048235,
      "contract_calls_number": 0,
      "era_id": 18046,
      "gas_price": 1,
      "install_upgrade_txn_number": 0,
      "is_switch_block": false,
      "large_txn_number": 0,
      "medium_txn_number": 0,
      "native_transfers_number": 1,
      "parent_block_hash": "204a6e71e09bc24a575692906c1a40f0556e07f619dd0dca294fa9797652870f",
      "proposer_public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e",
      "small_txn_number": 0,
      "state_root_hash": "6765672909cb75b1c9d358a77101f329e349156901790d6c65b510d472e58942",
      "timestamp": "2025-05-26T07:35:11Z",
      "version_id": 1
    },
    ...
    {
      "auction_txn_number": 0,
      "block_hash": "e39d93e7d3d6e99d8276a37a450aed2392c2842d581696fd0ea4c4e1ac90bef4",
      "block_height": 5048227,
      "contract_calls_number": 0,
      "era_id": 18046,
      "gas_price": 1,
      "install_upgrade_txn_number": 0,
      "is_switch_block": false,
      "large_txn_number": 0,
      "medium_txn_number": 0,
      "native_transfers_number": 1,
      "parent_block_hash": "136bda9ac5c9f52519e6df1431446e0a04e96b843fed75ef4f5bcf83d1efb6ed",
      "proposer_public_key": "01bfcf41313859cc7246b26307bdc3736ff585beb2165b0879fb9e6535fb0549c3",
      "small_txn_number": 0,
      "state_root_hash": "620df7f266b0b0ae850c15f61f4744844d282ea1ba1ee56783c4c6bd6472d24b",
      "timestamp": "2025-05-26T07:33:00Z",
      "version_id": 1
    }
  ]
}
```


# Get validator blocks

Get paginated list of blocks proposed by the validator

```
GET /validators/{public_key}/blocks
```

## Query params

None

## Sorting

| Property       | Description                 |
| -------------- | --------------------------- |
| `block_height` | Sort blocks by block height |
| `timestamp`    | Sort blocks by timestamp    |

Default sorting is `block_height DESC`

## Optional properties

| Property                            | Type                                                           | Description                                                                                                  |
| ----------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `proposer_account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the block proposer |
| `proposer_centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                 |
| `proposer_cspr_name`                | `string`                                                       | Primary CSPR.name of the block proposer account                                                              |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Block>`](/rest-api/block)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/validators/0109b48a169e6163078a07b6248f330133236c6e390fe915813c187c3f268c213e/blocks' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 121621,
  "page_count": 12163,
  "data": [
    {
      "auction_txn_number": 0,
      "block_hash": "395f06783487e3b7b81264e7b5827f6c4e557e45124cbf819b87bcfd04c7c395",
      "block_height": 4100662,
      "contract_calls_number": 0,
      "era_id": 15874,
      "gas_price": 0,
      "install_upgrade_txn_number": 0,
      "is_switch_block": false,
      "large_txn_number": 0,
      "medium_txn_number": 0,
      "native_transfers_number": 0,
      "parent_block_hash": "1acf69cb331262f2d8dfec60c7815da23e3b3fb533120977774c5d206629eee1",
      "proposer_public_key": "0109b48a169e6163078a07b6248f330133236c6e390fe915813c187c3f268c213e",
      "small_txn_number": 0,
      "state_root_hash": "f84b0b0037e8c544d165efedfa020b342212d44566a1a7547ebe128805f3ae74",
      "timestamp": "2024-11-26T07:50:43Z",
      "version_id": 0
    },
    {
      "auction_txn_number": 0,
      "block_hash": "d9e9dfce630b03c43403b36dd743ee034282d37a23c984a5f1147d8085e38752",
      "block_height": 4095223,
      "contract_calls_number": 0,
      "era_id": 15861,
      "gas_price": 0,
      "install_upgrade_txn_number": 0,
      "is_switch_block": false,
      "large_txn_number": 0,
      "medium_txn_number": 0,
      "native_transfers_number": 0,
      "parent_block_hash": "ab976fe681989836735153a30752981e7403f230cd5ab1bbdcc019bccd889096",
      "proposer_public_key": "0109b48a169e6163078a07b6248f330133236c6e390fe915813c187c3f268c213e",
      "small_txn_number": 0,
      "state_root_hash": "ea6dbd16eb8536884963369ad126f75b3852f0bcb3abd11f8673a53a2b285a75",
      "timestamp": "2024-11-25T07:00:35Z",
      "version_id": 0
    },
    ...
    {
      "auction_txn_number": 0,
      "block_hash": "3bcc967cc03ad21719c949837dcf83ad60c93e19aef7eeb4234b7307cce565b2",
      "block_height": 3514642,
      "contract_calls_number": 1,
      "era_id": 14536,
      "gas_price": 0,
      "install_upgrade_txn_number": 0,
      "is_switch_block": false,
      "large_txn_number": 0,
      "medium_txn_number": 0,
      "native_transfers_number": 0,
      "parent_block_hash": "38063ac07af15a19a0cc9c060a673583e8add86481861b172f80cb505f7181d9",
      "proposer_public_key": "0109b48a169e6163078a07b6248f330133236c6e390fe915813c187c3f268c213e",
      "small_txn_number": 0,
      "state_root_hash": "5dc125e23336716476885c926488ae38cae65b41fa87c1f30113c757bfaf3d40",
      "timestamp": "2024-08-06T19:27:35Z",
      "version_id": 0
    }
  ]
}
```


# Bidder

The `Bidder` entity represents an account participating in the [auction](https://docs.casper.network/concepts/glossary/A/#auction) to become a [Validator](/rest-api/validator) for the era after the next one. It has the same properties as the Validator entity, with the network share value being projected instead of actual.

The `Bidder` entity has the following properties:

| Property                    | Type         | Description                                                                                                                                                                                                        |
| --------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `era_id`                    | `uint32`     | Auction era identifier                                                                                                                                                                                             |
| `rank`                      | `uint8`      | Projected validator rank based on total bid amount                                                                                                                                                                 |
| `public_key`                | `string(68)` | Bidder account public key represented as a hexadecimal string                                                                                                                                                      |
| `is_active`                 | `bool`       | Describes whether the bidder is active or not                                                                                                                                                                      |
| `bid_amount`                | `uint64`     | Amount of bidder bid stake                                                                                                                                                                                         |
| `self_stake`                | `uint64`     | Bidder self-stake calculated as a sum of the bidder stake and the stakes of the affiliated accounts provided via the [Casper Account Info Standard](https://github.com/make-software/casper-account-info-contract) |
| `delegators_stake`          | `uint64`     | Cumulative stake of all delegators                                                                                                                                                                                 |
| `total_stake`               | `uint64`     | Total bidder stake. The sum of the self-stake and the delegator stakes.                                                                                                                                            |
| `self_share`                | `float32`    | Percentage of the bidder's self-stake to its total stake                                                                                                                                                           |
| `network_share`             | `float32`    | Projected network stake share if the bidder becomes a validator                                                                                                                                                    |
| `fee`                       | `float32`    | Percentage of the rewards the bidder will retain for its services once becomes a validator                                                                                                                         |
| `delegators_number`         | `uint64`     | Number of delegators staked to the bidder                                                                                                                                                                          |
| `reserved_slots`            | `uint32`     | Number of delegator slots reserved for specific delegators                                                                                                                                                         |
| `minimum_delegation_amount` | `uint64`     | Minimum delegation amount in motes. Delegations below this amount will not be accepted and will be automatically undelegated if at any point the amount drops below the minimum                                    |
| `maximum_delegation_amount` | `uint64`     | Maximum delegation amount in motes. Delegations above this amount will not be accepted and the exceed funds will be automatically undelegated if at any points the amount goes above the maximum                   |

**Example**

```json
{
  "bid_amount": "6899807212331106",
  "delegators_number": 128,
  "delegators_stake": "99739883251183826",
  "era_id": 18011,
  "fee": 10,
  "is_active": true,
  "maximum_delegation_amount": "1000000000000000000",
  "minimum_delegation_amount": "500000000000",
  "network_share": "9.72010436555974",
  "public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca",
  "rank": 1,
  "reserved_slots": 0,
  "self_share": "6.47020558887665",
  "self_stake": "6899807212331106",
  "total_stake": "106639690463514932"
}
```

## Optional properties

Depending on the endpoint some of the following optional properties may be included in the `Bidder` entity:

| Property                   | Type                                                           | Description                                                                                                            |
| -------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | Bidder [account info](https://github.com/make-software/casper-account-info-contract) provided by the account owner     |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) |                                                                                                                        |
| `cspr_name`                | `string`                                                       | Primary CSPR.name of the account                                                                                       |
| `average_performance`      | [`ValidatorPerformance`](/rest-api/validator-performance)      | Moving average of validator performance based on the received rewards over the past 360 eras (approximately one month) |

## Relations

| Entity                                                     | Mapping property | Description                                                                    |
| ---------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------ |
| [`Account`](/rest-api/account)                             | `public_key`     | Auction bids are made by accounts                                              |
| [`Validator performance`](/rest-api/validator-performance) | `public_key`     | Bidders that were validators in the past have associated validator performance |
| [`Validator`](/rest-api/validator)                         | `public_key`     | Bidder become a Validator for the era after next one                           |

## Endpoints

The `Bidder` entity has the following endpoints:

* [Get bidder](/rest-api/bidder/get-bidder)
* [Get bidders](/rest-api/bidder/get-bidders)

## Relation endpoints

None


# Get bidder

Get bidder by public key

```
GET /bidders/{public_key}?era_id={era_id}
```

## Query params

| Query param | Description                                                                                                                                         |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `era_id`    | Active auction era identifier. Data for older eras aren't persistent for long, and will eventually become unavailable. This is a required parameter |

## Sorting

None

## Optional properties

| Property                   | Type                                                           | Description                                                                                                            |
| -------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the bidder                   |
| `average_performance`      | [`ValidatorPerformance`](/rest-api/validator-performance)      | Moving average of validator performance based on the received rewards over the past 360 eras (approximately one month) |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                           |
| `cspr_name`                | `string`                                                       | Primary CSPR.name of the account                                                                                       |

## Response

[`Bidder`](/rest-api/bidder)

## Example

{% hint style="info" %}
Since this API works only with recent eras, you'll need to replace the era ID with the latest one, which you can fetch using the [Get auction metrics API](/rest-api/auction-metrics/get-auction-metrics).
{% endhint %}

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/bidders/0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca?era_id=18011' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "bid_amount": "6899807212331106",
    "delegators_number": 128,
    "delegators_stake": "99739883251183826",
    "era_id": 18011,
    "fee": 10,
    "is_active": true,
    "maximum_delegation_amount": "1000000000000000000",
    "minimum_delegation_amount": "500000000000",
    "network_share": "9.72010436555974",
    "public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca",
    "rank": 1,
    "reserved_slots": 0,
    "self_share": "6.47020558887665",
    "self_stake": "6899807212331106",
    "total_stake": "106639690463514932"
  }
}
```


# Get bidders

Get a paginated list of bidders

```
GET /bidders
```

## Query params

| Query param  | Description                                                                                                                                         |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `era_id`     | Active auction era identifier. Data for older eras aren't persistent for long, and will eventually become unavailable. This is a required parameter |
| `is_active`  | Bidder active filter param                                                                                                                          |
| `public_key` | Comma-separated list of public key                                                                                                                  |

## Sorting

| Property            | Description                       |
| ------------------- | --------------------------------- |
| `rank`              | Sort bidders by rank              |
| `fee`               | Sort bidders by fee               |
| `delegators_number` | Sort bidders by delegators number |
| `total_stake`       | Sort bidders by total stake       |
| `self_stake`        | Sort bidders by self stake        |
| `network_share`     | Sort bidders by network share     |

Default sorting is `total_stake DESC`

## Optional properties

| Property                   | Type                                                           | Description                                                                                                            |
| -------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the bidder                   |
| `average_performance`      | [`ValidatorPerformance`](/rest-api/validator-performance)      | Moving average of validator performance based on the received rewards over the past 360 eras (approximately one month) |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                           |
| `cspr_name`                | `string`                                                       | Primary CSPR.name of the account                                                                                       |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Bidder>`](/rest-api/bidder)

## Example

{% hint style="info" %}
Since this API works only with recent eras, you'll need to replace the era ID with the latest one, which you can fetch using the [Get auction metrics API](/rest-api/auction-metrics/get-auction-metrics).
{% endhint %}

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/bidders?era_id=18011' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 18535,
  "page_count": 1854,
  "data": [
    {
      "bid_amount": "6899807212331106",
      "delegators_number": 128,
      "delegators_stake": "99739883251183826",
      "era_id": 18011,
      "fee": 10,
      "is_active": true,
      "maximum_delegation_amount": "1000000000000000000",
      "minimum_delegation_amount": "500000000000",
      "network_share": "9.72010436555974",
      "public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca",
      "rank": 1,
      "reserved_slots": 0,
      "self_share": "6.47020558887665",
      "self_stake": "6899807212331106",
      "total_stake": "106639690463514932"
    },
    {
      "bid_amount": "6415352079691783",
      "delegators_number": 135,
      "delegators_stake": "99951428143765168",
      "era_id": 18011,
      "fee": 5,
      "is_active": true,
      "maximum_delegation_amount": "1000000000000000000",
      "minimum_delegation_amount": "500000000000",
      "network_share": "9.69522886184941",
      "public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e",
      "rank": 2,
      "reserved_slots": 0,
      "self_share": "6.03134932374028",
      "self_stake": "6415352079691783",
      "total_stake": "106366780223456951"
    },
    ...
    {
      "bid_amount": "15140291996766",
      "delegators_number": 19,
      "delegators_stake": "19888517346318",
      "era_id": 18011,
      "fee": 4,
      "is_active": true,
      "maximum_delegation_amount": "1000000000000000000",
      "minimum_delegation_amount": "500000000000",
      "network_share": "0.00319284200035",
      "public_key": "01075ec8809c691a1d1b0250ba9ea75da5460e3df43c3172771c6975c989457159",
      "rank": 92,
      "reserved_slots": 0,
      "self_share": "43.22239973524895",
      "self_stake": "15140291996766",
      "total_stake": "35028809343084"
    }
  ]
}
```


# Centralized account info

The `CentralizedAccountInfo` entity provides account information collected by the CSPR.cloud team for well-known accounts in the Casper ecosystem.

## Properties

The `CentralizedAccountInfo` entity has the following properties:

| Property       | Type         | Description                                                 |
| -------------- | ------------ | ----------------------------------------------------------- |
| `account_hash` | `string(64)` | Account hash represented as a hexadecimal string            |
| `name`         | `string`     | A known display name for the account                        |
| `url`          | `string`     | The top level domain URL that holds the account information |
| `avatar_url`   | `string`     | The URL of the account's avatar image                       |

**Example**

```json
{
  "data": {
    "account_hash": "02faaa3d8155039a88589d531f8107335476589c2e920980a6981f905671e20d",
    "avatar_url": "https://casper-assets.s3.amazonaws.com/accounts/casper-association.png",
    "name": "Casper Association - Developer grants",
    "url": null
  }
}
```

## Optional properties

None

## Relations

The `CentralizedAccountInfo` entity has the following relations with other entities:

| Entity                                                           | Mapping property | Description                                                                                                           |
| ---------------------------------------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------- |
| [`Account`](/rest-api/account)                                   | `account_hash`   | Account info provides information about an account                                                                    |
| [`Bidder`](/rest-api/bidder)                                     | `account_hash`   | Bidder accounts may have account info provided                                                                        |
| [`Block`](/rest-api/block)                                       | `account_hash`   | Block proposer accounts may have account info provided                                                                |
| [`Contract package`](/rest-api/contract-package)                 | `account_hash`   | Contract package owners may have account info provided                                                                |
| [`CSPR.name resolution`](http://CSPR.name)                       | `account_hash`   | CSPR.name resolution target accounts may have account info provided                                                   |
| [`Delegation`](/rest-api/delegation)                             | `account_hash`   | Both delegators and validators may have account info provided                                                         |
| [`Delegator reward`](/rest-api/delegator-reward)                 | `account_hash`   | Both delegators and validators may have account info provided                                                         |
| [`Fungible token action`](/rest-api/fungible-token-action)       | `account_hash`   | Fungible token action sender and recipient accounts, as well as deploy caller accounts may have account info provided |
| [`Fungible token ownership`](/rest-api/fungible-token-ownership) | `account_hash`   | Fungible token owner accounts may have account info provided                                                          |
| [`Fungible token ownership`](/rest-api/fungible-token-ownership) | `account_hash`   | Fungible token owner accounts may have account info provided                                                          |
| [`NFT action`](/rest-api/non-fungible-token-action)              | `account_hash`   | NFT action sender and recipient accounts, as well as deploy caller accounts may have account info provided            |
| [`NFT ownership`](/rest-api/non-fungible-token-ownership)        | `account_hash`   | NFT owner accounts may have account info provided                                                                     |
| [`Transfer`](/rest-api/transfer)                                 | `account_hash`   | Transfer sender and recipient accounts, as well as deploy caller accounts may have account info provided              |
| [`Validator`](/rest-api/validator)                               | `account_hash`   | Validator accounts may have account info provided                                                                     |

## Endpoints

The `CentralizedAccountInfo` entity has the following endpoints:

* [Get centralized account info](/rest-api/centralized-account-info/get-centralized-account-info)
* [Get centralized account infos](/rest-api/centralized-account-info/get-centralized-account-infos)

## Relation endpoints

None


# Get centralized account info

Get centralized account info by account identifier.

## Endpoint

```
GET /centralized-account-info/{account_identifier}
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

[`CentralizedAccountInfo`](/rest-api/centralized-account-info)

## Example

```bash
curl -X 'GET' \
  'https://api.cspr.cloud/centralized-account-info/02FAAA3D8155039A88589D531F8107335476589C2E920980A6981F905671E20D' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "account_hash": "02faaa3d8155039a88589d531f8107335476589c2e920980a6981f905671e20d",
    "avatar_url": "https://casper-assets.s3.amazonaws.com/accounts/casper-association.png",
    "name": "Casper Association - Developer grants",
    "url": null
  }
}
```


# Get centralized account infos

Get centralized account infos

## Endpoint

```
GET /centralized-account-info
```

## Query params

| Name           | Type       | Description                            |
| -------------- | ---------- | -------------------------------------- |
| `account_hash` | `[]string` | Comma-separated list of account hashes |

## Sorting

| Property       | Description                            |
| -------------- | -------------------------------------- |
| `account_hash` | Comma-separated list of account hashes |

## Optional properties

None

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<CentralizedAccountInfo>`](/rest-api/centralized-account-info)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/centralized-account-info?account_hash=02FAAA3D8155039A88589D531F8107335476589C2E920980A6981F905671E20D' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "account_hash": "02faaa3d8155039a88589d531f8107335476589c2e920980a6981f905671e20d",
      "avatar_url": "https://casper-assets.s3.amazonaws.com/accounts/casper-association.png",
      "name": "Casper Association - Developer grants",
      "url": null
    }
  ],
  "item_count": 1,
  "page_count": 1
}
```


# Contract

The `Contract` entity offers a normalized representation of the Casper Network [Contract](https://docs.casper.network/developers/json-rpc/types_chain/#contract) without including entry point hashes, which can be queried separately using the [Contract entry point](/rest-api/contract-entry-point) API. Additionally, this entity omits the contract's named keys but utilizes them for identifying the contract's type.

## Properties

The `Contract` entity has the following properties:

| Property                | Type         | Description                                                                                                          |
| ----------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------- |
| `contract_hash`         | `string(64)` | Contract hash represented as a hexadecimal string. Unique contract identifier                                        |
| `contract_package_hash` | `string(64)` | Hash of the contract package, this contract version is a part of, represented as a hexadecimal string                |
| `block_height`          | `uint64`     | Height of the block in which the contract was deployed to the network                                                |
| `deploy_hash`           | `string(64)` | Hash of the deploy that deployed the contract to the network represented as a hexadecimal string                     |
| `contract_type_id`      | `uint8`      | Identifier representing the type of the contract, check the types list [here](/rest-api/contract/get-contract-types) |
| `timestamp`             | `uint16`     | Timestamp indicating when the contract was created                                                                   |
| `contract_version`      | `uint16`     | Version number associated with the contract                                                                          |
| `is_disabled`           | `bool`       | Indicates whether the contract is currently disabled                                                                 |
| `timestamp`             | `datetime`   | Timestamp indicating when the contract was created                                                                   |
| `contract_version`      | `uint16`     | Version number associated with the contract                                                                          |
| `is_disabled`           | `bool`       | Indicates whether the contract is currently disabled                                                                 |

**Example**

```json
{
  "contract_hash": "8a2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e732",
  "contract_package_hash": "ae2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e744",
  "deploy_hash": "1a2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e755",
  "block_height": 2764649,
  "contract_type_id": 2,
  "timestamp": "2023-01-01T12:00:00Z",
  "contract_version": 1,
  "is_disabled": false
}
```

## Optional properties

Depending on the endpoint, the following optional properties may be included in the `Contract` entity:

| Property           | Type                                          | Description                                          |
| ------------------ | --------------------------------------------- | ---------------------------------------------------- |
| `contract_package` | [ContractPackage](/rest-api/contract-package) | Contract package, this contract version is a part of |

## Relations

The `Contract` entity has the following relations with other entities:

| Entity                                                 | Mapping property             | Description                                                                                |
| ------------------------------------------------------ | ---------------------------- | ------------------------------------------------------------------------------------------ |
| [`Deploy`](/rest-api/deploy)                           | `contract_hash, deploy_hash` | Contracts are deployed to the network with a deploy call. Deploys can be the contract call |
| [`ContractEntrypoint`](/rest-api/contract-entry-point) | `contract_hash`              | Contracts can have endpoints                                                               |
| [`ContractPackage`](/rest-api/contract-package)        | `contract_package_hash`      | Contracts are different versions of the same smart contract under the contract package     |

## Endpoints

The `Contract` entity has the following endpoints:

* [Get contract](/rest-api/contract/get-contract)
* [Get contracts](/rest-api/contract/get-contracts)
* [Get contract package contracts](/rest-api/contract/get-contracts-by-contract-package)

## Relation endpoints

The `Contract` entity has the following relation endpoints:

* [Get contract entry points](/rest-api/contract-entry-point/get-contract-entry-points)
* [Get contract types](/rest-api/contract/get-contract-types)


# Get contract

Get contract by its hash.

```
GET /contracts/{contract_hash}
```

## Query params

None

## Sorting

None

## Optional properties

| Property           | Type                                          | Description                                          |
| ------------------ | --------------------------------------------- | ---------------------------------------------------- |
| `contract_package` | [ContractPackage](/rest-api/contract-package) | Contract package, this contract version is a part of |

## Response

[`Contract`](/rest-api/contract)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contracts/8a2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e732' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "contract_hash": "8a2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e732",
    "contract_package_hash": "ae2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e744",
    "deploy_hash": "1a2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e755",
    "block_height": 2404577,
    "contract_type_id": 2,
    "timestamp": "2023-01-01T12:00:00Z",
    "contract_version": 1,
    "is_disabled": false
  }
}
```


# Get contracts

Get a paginated list of contracts.

```
GET /contracts
```

## Query params

| Query param             | Description                                                  |
| ----------------------- | ------------------------------------------------------------ |
| `deploy_hash`           | Hash of the deploy that deployed the contract to the network |
| `contract_package_hash` | Contract Package hash.                                       |
| `from_block_height`     | From block height range                                      |
| `to_block_height`       | To block height range                                        |

## Sorting

| Property    | Description                 |
| ----------- | --------------------------- |
| `timestamp` | Sort contracts by timestamp |

Default sorting is `timestamp DESC`

## Optional properties

| Property           | Type                                          | Description                                          |
| ------------------ | --------------------------------------------- | ---------------------------------------------------- |
| `contract_package` | [ContractPackage](/rest-api/contract-package) | Contract package, this contract version is a part of |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Contract>`](/rest-api/contract)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contracts' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "contract_hash": "8a2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e732",
      "contract_package_hash": "ae2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e744",
      "deploy_hash": "1a2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e755",
      "block_height": 2404577,
      "contract_type_id": 2,
      "timestamp": "2023-01-01T12:00:00Z",
      "contract_version": 1,
      "is_disabled": false
    },
    {
      "contract_hash": "5e718fa0918ae95e58b9a320f412b935af6544b04b6b89fb2ca9982cab0dd261",
      "contract_package_hash": "8e718fa0918ae95e58b9a320f412b935af6544b04b6b89fb2ca9982cab0dd262",
      "deploy_hash": "2e718fa0918ae95e58b9a320f412b935af6544b04b6b89fb2ca9982cab0dd263",
      "block_height": 2404576,
      "contract_type_id": 4,
      "timestamp": "2023-01-02T12:00:00Z",
      "contract_version": 2,
      "is_disabled": false
    },
    ...
    {
      "contract_hash": "7894d8458c82388f6d276c07c1c52033ac37b175fa722b9cc40e7a0157ce17fc",
      "contract_package_hash": "8894d8458c82388f6d276c07c1c52033ac37b175fa722b9cc40e7a0157ce17fd",
      "deploy_hash": "9894d8458c82388f6d276c07c1c52033ac37b175fa722b9cc40e7a0157ce17fe",
      "block_height": 2404571,
      "contract_type_id": 7,
      "timestamp": "2023-01-03T12:00:00Z",
      "contract_version": 3,
      "is_disabled": false
    }
  ],
  "item_count": 100,
  "page_count": 10
}
```


# Get contracts by contract package

Retrieve contracts associated with a specific contract package.

```
GET /contract-packages/{contract_package_hash}/contracts
```

This endpoint allows you to retrieve contracts associated with a specific contract package. You can filter the results by deploy hash and choose to include optional fields such as contract package data. The example demonstrates a sample response with details for each contract, including contract hash, contract package hash, deploy hash, contract type ID, timestamp, contract version, and disabled status.

## Query params

| Query param   | Description                                                  |
| ------------- | ------------------------------------------------------------ |
| `deploy_hash` | Hash of the deploy that deployed the contract to the network |

## Sorting

None

## Optional properties

| Property           | Type                                          | Description                                          |
| ------------------ | --------------------------------------------- | ---------------------------------------------------- |
| `contract_package` | [ContractPackage](/rest-api/contract-package) | Contract package, this contract version is a part of |

## Sorting

| Property    | Description                 |
| ----------- | --------------------------- |
| `timestamp` | Sort contracts by timestamp |

Default sorting is `timestamp DESC`

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Contract>`](/rest-api/contract)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contract-packages/ae2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e744/contracts' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "contract_hash": "8a2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e732",
      "contract_package_hash": "ae2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e744",
      "deploy_hash": "1a2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e755",
      "contract_type_id": 2,
      "timestamp": "2023-01-01T12:00:00Z",
      "contract_version": 1,
      "is_disabled": false
    },
    {
      "contract_hash": "5e718fa0918ae95e58b9a320f412b935af6544b04b6b89fb2ca9982cab0dd261",
      "contract_package_hash": "8e718fa0918ae95e58b9a320f412b935af6544b04b6b89fb2ca9982cab0dd262",
      "deploy_hash": "2e718fa0918ae95e58b9a320f412b935af6544b04b6b89fb2ca9982cab0dd263",
      "contract_type_id": 4,
      "timestamp": "2023-01-02T12:00:00Z",
      "contract_version": 2,
      "is_disabled": false
    },
    ...
  ],
  "item_count": 100,
  "page_count": 10
}
```


# Get contract types

Get all contract types with their id and name.

```
GET /contract-types
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

List of value objects describing the available contract types

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contract-types' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "id": 2,
      "name": "CEP18"
    },
    {
      "id": 3,
      "name": "Modified CEP18"
    },
    {
      "id": 4,
      "name": "CEP47"
    },
    {
      "id": 5,
      "name": "Modified CEP47"
    },
    {
      "id": 6,
      "name": "DEFI"
    },
    {
      "id": 7,
      "name": "CEP78"
    },
    {
      "id": 8,
      "name": "Modified CEP78"
    },
    {
      "id": 9,
      "name": "NFT"
    },
    {
      "id": 10,
      "name": "CEP-95"
    }
  ]
}
```


# Contract entry point

The `ContractEntryPoint` entity offers a normalized representation of the Casper Network [EntryPoint](https://docs.casper.network/concepts/glossary/E/#entry-point). Entry points are associated with the [Contract](/rest-api/contract) entity and describe how to interact with it. In CSPR.Cloud, only the name of the entry point and its relations to the Contract and ContractPackage are stored.

## Properties

The `ContractEntryPoint` entity has the following properties:

| Property                | Type         | Description                                                                                           |
| ----------------------- | ------------ | ----------------------------------------------------------------------------------------------------- |
| `contract_hash`         | `string(64)` | Contract hash represented as a hexadecimal string. Unique contract identifier                         |
| `contract_package_hash` | `string(64)` | Hash of the contract package, this contract version is a part of, represented as a hexadecimal string |
| `name`                  | `string`     | Name of the entry point                                                                               |

**Example**

```json
{
    "contract_hash": "a0a1d2d3d4d5d6d7d8d9e0e1e2e3e4e5e6e7e8e9f0f1f2f3f4f5f6f7f8f9a0a1",
    "contract_package_hash": "b0b1b2b3b4b5b6b7b8b9c0c1c2c3c4c5c6c7c8c9d0d1d2d3d4d5d6d7d8d9e0e1",
    "name": "transfer"
}
```

## Optional properties

None

## Relations

The `ContractEntryPoint` entity has the following relations with other entities:

| Entity                                          | Mapping property        | Description                                                                           |
| ----------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------- |
| [`Contract`](/rest-api/contract)                | `contract_hash`         | Entry point is associated with a contract                                             |
| [`ContractPackage`](/rest-api/contract-package) | `contract_package_hash` | Entry point is associated with a contract, that is a version of the contract package. |

## Endpoints

The `ContractEntryPoint` entity has the following endpoints:

* [Get contract entry points](/rest-api/contract-entry-point/get-contract-entry-points)
* [Get entry points](/rest-api/contract-entry-point/get-entry-points)

## Relation endpoints

* [Get contract entry point costs](/rest-api/contract-entry-point/get-contract-entry-point-costs)


# Get contract entry points

Get contract entry points by contract hash

```
GET /contracts/{contract_hash}/entry-points
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<ContractEntryPoint>`](/rest-api/contract-entry-point)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contracts/93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2/entry-points' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "id": 11,
      "contract_hash": "93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2",
      "contract_package_hash": "e375d42c29c0e4b2baefa63cf2d70af34439eda851e08129d8515515d63bd6a9",
      "name": "activate_bid",
      "action_type_id": null
    },
    {
      "id": 12,
      "contract_hash": "93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2",
      "contract_package_hash": "e375d42c29c0e4b2baefa63cf2d70af34439eda851e08129d8515515d63bd6a9",
      "name": "add_bid",
      "action_type_id": null
    },
    ...
    {
      "id": 19,
      "contract_hash": "93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2",
      "contract_package_hash": "e375d42c29c0e4b2baefa63cf2d70af34439eda851e08129d8515515d63bd6a9",
      "name": "undelegate",
      "action_type_id": null
    }
  ],
  "item_count": 11,
  "page_count": 2
}
```


# Get entry points

Get contract entry points by contract package hash or contract hash, with optional entry point name.

```
GET /contract-entry-points
```

## Query params

At least one of `contract_package_hash` or `contract_hash` is required.

| Parameter               | Type         | Required | Description                  |
| ----------------------- | ------------ | -------- | ---------------------------- |
| `contract_package_hash` | `string(64)` | No       | Contract package hash filter |
| `contract_hash`         | `string(64)` | No       | Contract hash filter         |
| `name`                  | `string`     | No       | Entry point name             |

## Sorting

| Parameter         | Type     | Required | Description                                |
| ----------------- | -------- | -------- | ------------------------------------------ |
| `order_by`        | `string` | No       | Comma-separated list of sorting fields     |
| `order_direction` | `string` | No       | Sorting direction. Possible: `ASC`, `DESC` |

Supported sorting fields: `id`, `contract_hash`, `contract_package_hash`, `name`.

## Optional properties

None

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<ContractEntryPoint>`](/rest-api/contract-entry-point)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contract-entry-points?contract_package_hash=e375d42c29c0e4b2baefa63cf2d70af34439eda851e08129d8515515d63bd6a9&name=undelegate' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "id": 19,
      "contract_hash": "93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2",
      "contract_package_hash": "e375d42c29c0e4b2baefa63cf2d70af34439eda851e08129d8515515d63bd6a9",
      "name": "undelegate",
      "action_type_id": null
    }
  ],
  "item_count": 1,
  "page_count": 1
}
```


# Get contract entry point costs

Get deploys costs and payment amounts, aggregated by contract hash and entry point name

```
GET /contracts/{contract_hash}/entry-points/{entry_point_name}/costs
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

```json
{
  "data": {
    "deploys_num": number,
    "since": datetime,
    "avg_cost": number,
    "min_cost": number,
    "max_cost": number,
    "avg_payment_amount": number,
    "min_payment_amount": number,
    "max_payment_amount": number
  }
}

```

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contracts/93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2/entry-points/activate_bid/costs' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "deploys_num": 100,
    "since": "2023-10-12T07:21:07Z",
    "avg_cost": 25009900,
    "min_cost": 10000,
    "max_cost": 2500000000,
    "avg_payment_amount": 19550007300,
    "min_payment_amount": 10000,
    "max_payment_amount": 950000000000
  }
}
```


# Contract package

The `ContractPackage` entity provides a normalized representation of the Casper Network [Contract Package](https://docs.casper.network/developers/json-rpc/types_chain/#contractpackge). It includes the contract package's metadata based on Contract's type and named keys values and the latest version of the contract type within the package.

## Properties

The `ContractPackage` entity has the following properties:

| Property                          | Type                      | Description                                                                                                                                                                    |
| --------------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `contract_package_hash`           | `string(64)`              | Contract package hash represented as a hexadecimal string. Unique contract package identifier                                                                                  |
| `owner_public_key`                | `string(68)`              | Public key of the owner of the contract package. May be `null` if the public key is not known, but the `owner_hash` will still be present. Represented as a hexadecimal string |
| `owner_hash`                      | `string(64)`              | Hash of the owner of the contract package. Represented as a hexadecimal string                                                                                                 |
| `name`                            | `string`                  | Name of the contract package.                                                                                                                                                  |
| `description`                     | `string`                  | Description of the contract package.                                                                                                                                           |
| `metadata`                        | `ContractPackageMetadata` | Metadata associated with the contract package. Details described in the next table.                                                                                            |
| `latest_version_contract_type_id` | `uint8`                   | [Contract type](/rest-api/contract/get-contract-types) identifier of the latest contract version                                                                               |
| `timestamp`                       | `datetime`                | Timestamp indicating when the contract package was created.                                                                                                                    |
| `icon_url`                        | `string`                  | URL pointing to an icon representing the contract package.                                                                                                                     |
| `website_url`                     | `string`                  | URL pointing to the website representing the contract.                                                                                                                         |

Metadata Property:

| Metadata Property           | Type         | Description                                                                                                                                                                                    |
| --------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`                      | `string`     | Name associated with the contract package.                                                                                                                                                     |
| `symbol`                    | `string`     | Contract package name pulled from the last version named keys. Contract package symbol pulled from the last version named keys. Applicable only for token contracts.                           |
| `decimals`                  | `uint8`      | Contract package token decimals pulled from the last version named keys. Applicable only for token contracts.                                                                                  |
| `balances_uref`             | `string(72)` | Contract package balances dictionary URef pulled from the last version named keys. Applicable only for token contracts.                                                                        |
| `total_supply_uref`         | `string(72)` | Contract package total supply URef pulled from the last version named keys. Applicable only for token contracts.                                                                               |
| `ownership_mode`            | `uint8`      | CEP-78 contract [ownership mode](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/modalities.md#ownership). Applicable only for CEP-78 contracts.                         |
| `nft_kind`                  | `uint8`      | CEP-78 contract [NFT kind](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/modalities.md#nftkind). Applicable only for CEP-78 contracts.                                 |
| `nft_metadata_kind`         | `uint8`      | CEP-78 contract [NFT metadata kind](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/modalities.md#nftmetadatakind). Applicable only for CEP-78 contracts.                |
| `whitelist_mode`            | `uint8`      | CEP-78 contract [whitelist mode](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/modalities.md#whitelistmode). Applicable only for CEP-78 contracts.                     |
| `holder_mode`               | `uint8`      | CEP-78 contract [holder mode](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/modalities.md#nftholdermode). Applicable only for CEP-78 contracts.                        |
| `minting_mode`              | `uint8`      | CEP-78 contract [minting mode](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/modalities.md#minting). Applicable only for CEP-78 contracts.                             |
| `burn_mode`                 | `uint8`      | CEP-78 contract [burn mode](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/modalities.md#burnmode). Applicable only for CEP-78 contracts.                               |
| `identifier_mode`           | `uint8`      | CEP-78 contract [identifier mode](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/modalities.md#nftidentifiermode). Applicable only for CEP-78 contracts.                |
| `metadata_mutability`       | `uint8`      | CEP-78 contract [metadata mutability mode](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/modalities.md#metadata-mutability). Applicable only for CEP-78 contracts.     |
| `owner_reverse_lookup_mode` | `uint8`      | CEP-78 contract [owner reverse lookup mode](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/modalities.md#ownerreverselookupmode). Applicable only for CEP-78 contracts. |
| `events_mode`               | `uint8`      | CEP-78 contract [events mode](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/modalities.md#eventsmode). Applicable only for CEP-78 contracts.                           |

## Optional properties

Depending on the endpoint, the following optional property may be included in the `ContractPackage` entity:

| Property            | Type                                    | Description                                                                                                                                                                                                                 |
| ------------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `deploys_number`    | `int`                                   | Number of deploys in the specified number of the past days. It's a [function includer](/documentation/overview/optional-properties#functions) that accepts the number of days as an argument.                               |
| `owner_cspr_name`   | `string`                                | Owner's primary CSPR.name                                                                                                                                                                                                   |
| `token_market_data` | [`TokenMarketData[]`](#tokenmarketdata) | Token market data derived from indexed DEX swaps in the requested `currency`. It's a [function includer](/documentation/overview/optional-properties#functions) that accepts `currency_id` and optional `dex_id` arguments. |

**Example**

```json
{
  "contract_package_hash": "ae2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e744",
  "owner_public_key": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01",
  "name": "MyContractPackage",
  "description": "A sample contract package",
  "metadata": {
    "name": "MyToken",
    "symbol": "MT",
    "decimals": 18,
    "balances_uref": "uref-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
    "total_supply_uref": "uref-abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
    "ownership_mode": 1,
    "nft_kind": 2,
    "nft_metadata_kind": 1,
    "whitelist_mode": 0,
    "holder_mode": 1,
    "minting_mode": 2,
    "burn_mode": 1,
    "identifier_mode": 0,
    "metadata_mutability": 1,
    "owner_reverse_lookup_mode": 1,
    "events_mode": 2
  },
  "latest_version_contract_type_id": 3,
  "timestamp": "2023-01-01T12:00:00Z",
  "icon_url": "https://example.com/icon.png",
  "website_url": "https://example.com",
  "deploys_number": 42
}
```

### **TokenMarketData**:

```json
{
  "dex_id": 1,
  "token_contract_package_hash": "ae2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e744",
  "currency_id": 1,
  "latest_rate": 2.5,
  "volume_24h": "37.500000000000000000",
  "token_volume_24h": "15.000000000000000000",
  "timestamp": "2023-01-01T12:00:00Z"
}
```

`volume_24h` is represented in the requested currency, while `token_volume_24h` represents the raw token amount.

## Relations

The `ContractPackage` entity has the following relations with other entities:

| Entity                                                                     | Mapping property                                                    | Description                                                                                  |
| -------------------------------------------------------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| [`Account`](/rest-api/account)                                             | `owner_hash`                                                        | Account owns the contract package                                                            |
| [`Deploy`](/rest-api/deploy)                                               | `contract_package_hash`                                             | Contracts packages are deployed to the network with a deploy call                            |
| [`Contract`](/rest-api/contract)                                           | `contract_package_hash`                                             | Contracts are different versions of the same smart contract included in the contract package |
| [`Fungible token action`](/rest-api/fungible-token-action)                 | `contract_package_hash`                                             | Occurs within the contract package that defines the fungible token                           |
| [`Fungible token ownership`](/rest-api/fungible-token-ownership)           | `contract_package_hash`                                             | Indicates which accounts own tokens from a specific contract package                         |
| [`Fungible token rate`](/rest-api/fungible-token-rate)                     | `token_contract_package_hash`                                       | Tradable fungible token have their rates tracked                                             |
| [`Fungible token daily rate`](/rest-api/fungible-token-daily-rate)         | `token_contract_package_hash`                                       | Tradable fungible token have their daily rates tracked                                       |
| [`Fungible token DEX rate`](/rest-api/fungible-token-dex-rate)             | `token_contract_package_hash`, `target_token_contract_package_hash` | Tradable fungible token pairs have their DEX rates tracked                                   |
| [`Fungible token daily DEX rate`](/rest-api/fungible-token-daily-dex-rate) | `token_contract_package_hash`, `target_token_contract_package_hash` | Tradable fungible token pairs have their daily DEX rates tracked                             |
| [`NFT action`](/rest-api/non-fungible-token-action)                        | `contract_package_hash`                                             | Takes place within the contract package that defines the NFT collection                      |
| [`NFT ownership`](/rest-api/non-fungible-token-ownership)                  | `contract_package_hash`                                             | Indicates which accounts own NFTs from a specific contract package                           |

## Endpoints

The `ContractPackage` entity has the following endpoints:

* [Get contract package](/rest-api/contract-package/get-contract-package)
* [Get contract packages](/rest-api/contract-package/get-contract-packages)

## Relation endpoints

The `ContractPackage` entity has the following relation endpoints:

* [Get contract package contracts](/rest-api/contract/get-contracts-by-contract-package)
* [Get contract package NFT tokens](/rest-api/non-fungible-token/get-contract-package-tokens) (applicable only to NFT contract packages)
* [Get contract package NFT token actions](/rest-api/non-fungible-token-action/get-contract-package-token-actions) (applicable only to NFT contract package)
* [Get contract package NFT token ownership](/rest-api/non-fungible-token-ownership/get-contract-package-token-ownership) (applicable only to NFT contract package)
* [Get contract package fungible token ownership](/rest-api/fungible-token-ownership/get-contract-package-fungible-token-ownership) (applicable only to fungible token contract package)
* [Get contract package fungible token actions](/rest-api/fungible-token-action/get-account-token-actions) (applicable only to fungible token contract package)
* [Get the latest fungible token contract rate](/rest-api/fungible-token-rate/get-latest-token-contract-rate)
* [Get historical fungible token contract rates](/rest-api/fungible-token-rate/get-token-contract-rates)
* [Get the latest daily fungible token contract rate](/rest-api/fungible-token-daily-rate/get-latest-daily-token-contract-rate)
* [Get historical daily fungible token contract rates](/rest-api/fungible-token-daily-rate/get-daily-token-contract-rates)
* [Get the latest fungible token DEX rate](/rest-api/fungible-token-dex-rate/get-latest-token-dex-rate)
* [Get historical fungible token DEX rates](/rest-api/fungible-token-dex-rate/get-token-dex-rates)
* [Get the latest fungible token daily DEX rate](/rest-api/fungible-token-daily-dex-rate/get-latest-daily-token-dex-rate)
* [Get historical fungible token daily DEX rates](/rest-api/fungible-token-daily-dex-rate/get-daily-token-dex-rates)


# Get contract package

Get a contract package by its identifier (contract package hash).

```
GET /contract-packages/{contract_package_hash}
```

This endpoint allows you to retrieve detailed information about a specific contract package using its unique identifier, the contract package hash. The response includes various properties such as owner public key, name, description, metadata, latest version contract type ID, timestamp, icon URL, and deploys number.

## Query params

None

## Sorting

None

## Optional properties

| Property                   | Type                                                              | Description                                                                                                                                                                                                                                                                                                |
| -------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                           | ContractPackage owner account info                                                                                                                                                                                                                                                                         |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info)    | ContractPackage centralized account info                                                                                                                                                                                                                                                                   |
| `cspr_name`                | `string`                                                          | Owner's primary CSPR.name                                                                                                                                                                                                                                                                                  |
| `token_market_data`        | [`TokenMarketData[]`](/rest-api/contract-package#tokenmarketdata) | Token market data derived from indexed DEX swaps in the requested `currency`. It's a [function includer](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/overview/optional-properties.md#functions) that accepts `currency_id` and optional `dex_id` arguments. |

## Response

[`ContractPackage`](/rest-api/contract-package)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contract-packages/ae2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e744' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "contract_package_hash": "ae2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e744",
    "owner_public_key": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01",
    "name": "MyContractPackage",
    "description": "A sample contract package",
    "metadata": {
      "name": "MyToken",
      "symbol": "MT",
      "decimals": 18,
      "balances_uref": "uref-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
      "total_supply_uref": "uref-abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
      "ownership_mode": 1,
      "nft_kind": 2,
      "nft_metadata_kind": 1,
      "whitelist_mode": 0,
      "holder_mode": 1,
      "minting_mode": 2,
      "burn_mode": 1,
      "identifier_mode": 0,
      "metadata_mutability": 1,
      "owner_reverse_lookup_mode": 1,
      "events_mode": 2
    },
    "latest_version_contract_type_id": 3,
    "timestamp": "2023-01-01T12:00:00Z",
    "icon_url": "https://example.com/icon.png",
    "website_url": "https://example.com",
    "deploys_number": 42
  }
}
```


# Get contract packages

Get a paginated list of contract packages.

```
GET /contract-packages
```

This endpoint allows you to retrieve a paginated list of contract packages. You can filter the results by owner public key, specify the page number and size, and choose the sorting order and field. Additionally, you can include optional deploys number data in the response. The example shows a sample response with relevant details for each contract package, including contract package hash, owner public key, name, description, metadata, latest version contract type ID, timestamp, icon URL, and deploys number.

## Query params

| Query param  | Description        |
| ------------ | ------------------ |
| `owner_hash` | Owner hash filter. |

## Sorting

| Property    | Description                          |
| ----------- | ------------------------------------ |
| `timestamp` | Sort contract packages by timestamp. |

Default sorting is `timestamp DESC`

## Optional properties

| Property                   | Type                                                              | Description                                                                                                                                                                                                                 |
| -------------------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `deploys_number`           | `int`                                                             | Number of deploys in the specified number of the past days. It's a [function includer](/documentation/overview/optional-properties#functions) that accepts the number of days as an argument.                               |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                           | ContractPackage owner account info                                                                                                                                                                                          |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info)    | ContractPackage centralized account info                                                                                                                                                                                    |
| `cspr_name`                | `string`                                                          | Owner's primary CSPR.name                                                                                                                                                                                                   |
| `token_market_data`        | [`TokenMarketData[]`](/rest-api/contract-package#tokenmarketdata) | Token market data derived from indexed DEX swaps in the requested `currency`. It's a [function includer](/documentation/overview/optional-properties#functions) that accepts `currency_id` and optional `dex_id` arguments. |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<ContractPackage>`](/rest-api/contract-package)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contract-packages' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "contract_package_hash": "ae2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e744",
      "owner_public_key": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01",
      "name": "MyContractPackage1",
      "description": "A sample contract package",
      "metadata": {
        "name": "MyToken1",
        "symbol": "MT1",
        "decimals": 18,
        "balances_uref": "uref-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
        "total_supply_uref": "uref-abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
        "ownership_mode": 1,
        "nft_kind": 2,
        "nft_metadata_kind": 1,
        "whitelist_mode": 0,
        "holder_mode": 1,
        "minting_mode": 2,
        "burn_mode": 1,
        "identifier_mode": 0,
        "metadata_mutability": 1,
        "owner_reverse_lookup_mode": 1,
        "events_mode": 2
      },
      "latest_version_contract_type_id": 3,
      "timestamp": "2023-01-01T12:00:00Z",
      "icon_url": "https://example.com/icon1.png",
      "website_url": "https://example.com",
      "deploys_number": 42
    },
    {
      "contract_package_hash": "be2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e745",
      "owner_public_key": "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
      "name": "MyContractPackage2",
      "description": "Another sample contract package",
      "metadata": {
        "name": "MyToken2",
        "symbol": "MT2",
        "decimals": 18,
        "balances_uref": "uref-abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
        "total_supply_uref": "uref-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
        "ownership_mode": 1,
        "nft_kind": 2,
        "nft_metadata_kind": 1,
        "whitelist_mode": 0,
        "holder_mode": 1,
        "minting_mode": 2,
        "burn_mode": 1,
        "identifier_mode": 0,
        "metadata_mutability": 1,
        "owner_reverse_lookup_mode": 1,
        "events_mode": 2
      },
      "latest_version_contract_type_id": 4,
      "timestamp": "2023-01-02T12:00:00Z",
      "icon_url": "https://example.com/icon2.png",
      "website_url": "https://example.com",
      "deploys_number": 56
    },
    ...
  ],
  "item_count": 100,
  "page_count": 10
}
```


# Get account contract packages

Get a paginated list of account contract packages.

```
GET /accounts/{public_key}/contract-packages
```

This endpoint allows you to retrieve a paginated list of account contract packages. You can filter the results by owner public key, specify the page number and size, and choose the sorting order and field. Additionally, you can include optional deploys number data in the response. The example shows a sample response with relevant details for each contract package, including contract package hash, owner public key, name, description, metadata, latest version contract type ID, timestamp, icon URL, and deploys number.

## Query params

None

## Sorting

| Property    | Description                          |
| ----------- | ------------------------------------ |
| `timestamp` | Sort contract packages by timestamp. |

Default sorting is `timestamp DESC`

## Optional properties

| Property                   | Type                                                           | Description                                                                                                                                                                                   |
| -------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `deploys_number`           | `int`                                                          | Number of deploys in the specified number of the past days. It's a [function includer](/documentation/overview/optional-properties#functions) that accepts the number of days as an argument. |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | ContractPackage owner account info                                                                                                                                                            |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | ContractPackage centralized account info                                                                                                                                                      |
| `cspr_name`                | `string`                                                       | Owner's primary CSPR.name                                                                                                                                                                     |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<ContractPackage>`](/rest-api/contract-package)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/017E80955A6D493A4A4B9F1B5DD23D2EDCDC2C8B00FCD9689F2F735F501BD088C5/contract-packages' \
  -H 'Accept: application/json' \
  -H 'Authorization: your_access_token_here'
```

```json
{
  "data": [
    {
      "contract_package_hash": "0038a63a09e0b600158d4648745930239aba43eb7a5e725ab1af12b49077100c",
      "owner_public_key": "017e80955a6d493a4a4b9f1b5dd23d2edcdc2c8b00fcd9689f2f735f501bd088c5",
      "name": null,
      "description": null,
      "metadata": {},
      "latest_version_contract_type_id": null,
      "timestamp": "2023-04-12T05:38:48Z",
      "icon_url": null,
      "website_url": null
    },
    {
      "contract_package_hash": "004f02d03d1011ea71397363a34fbf038496be30ee2b1d88820c37cc9b9daeee",
      "owner_public_key": "017e80955a6d493a4a4b9f1b5dd23d2edcdc2c8b00fcd9689f2f735f501bd088c5",
      "name": "Wrap BTC",
      "description": null,
      "metadata": {
        "name": "Wrap BTC",
        "symbol": "WBTC",
        "decimals": 8,
        "balances_uref": "uref-4744c56c1ca94c6c1f3d2076d8b3fe474b03a86736143ad1921505b71b693b1f-007",
        "total_supply_uref": "uref-f3771de0504c0dd74feb56f6e327add0ba89562022ff2816e98a8700673124e3-003"
      },
      "latest_version_contract_type_id": 2,
      "timestamp": "2023-03-31T08:22:32Z",
      "icon_url": null,
      "website_url": null
    },
    ...
    {
      "contract_package_hash": "0342537e19667f5c9b5ab976e302bcdfce04b5e681a6c535d330ae0c534203ab",
      "owner_public_key": "017e80955a6d493a4a4b9f1b5dd23d2edcdc2c8b00fcd9689f2f735f501bd088c5",
      "name": null,
      "description": null,
      "metadata": {},
      "latest_version_contract_type_id": null,
      "timestamp": "2022-11-11T05:14:46Z",
      "icon_url": null,
      "website_url": null
    }
  ],
  "item_count": 459,
  "page_count": 46
}
```


# Currency

`Currency` entity represents currencies used by [CSPR Rate](/rest-api/cspr-rate) and [Fungible token rate](/rest-api/fungible-token-rate) APIs.

### Properties

The `Currency` entity has the following properties:

| Property  | Type     | Description                                     |
| --------- | -------- | ----------------------------------------------- |
| `id`      | `int`    | Currency identifier                             |
| `code`    | `string` | Currency code                                   |
| `type_id` | `int`    | `1` for fiat currency, `2` for cryptocurrencies |

**Example**

```json
{
  "id": 1,
  "code": "USD",
  "type_id": 1
}
```

### Optional properties

None

### Relations

The `Currency` entity has the following relations with other entities:

| Entity                                                             | Mapping property | Description                                                      |
| ------------------------------------------------------------------ | ---------------- | ---------------------------------------------------------------- |
| [`CSPR Rate`](/rest-api/cspr-rate)                                 | `currency_id`    | Native CSPR rate are returned for different currencies           |
| [`Fungible token rate`](/rest-api/fungible-token-rate)             | `currency_id`    | Fungible token rates are returned for different currencies       |
| [`Fungible token daily rate`](/rest-api/fungible-token-daily-rate) | `currency_id`    | Fungible token daily rates are returned for different currencies |

## Endpoints

The `Currency` entity has the following endpoints:

* [Get currencies](/rest-api/currency/get-currencies)


# Get currencies

Get a paginated list of currencies.

```
GET /currencies
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

[`Currency`](/rest-api/currency)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/currencies' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "id": 1,
      "code": "USD",
      "type_id": 1
    },
    {
      "id": 2,
      "code": "EUR",
      "type_id": 1
    },
    ...
    {
      "id": 10,
      "code": "ETH",
      "type_id": 2
    }
  ]
}
```


# Delegation

The `Delegation` entity represents a record of a delegation transaction in the context of Casper Network [Staking vs. Delegating process](https://docs.casper.network/staking/)

## Properties

The `Delegation` entity has the following properties:

| Property                       | Type         | Description                                                                                                                                                        |
| ------------------------------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `delegator_identifier`         | `string(64)` | A representation of the delegator identifier, which can be either: a hex-encoded public key, or a purse URef, depending on `delegator_identifier_type_id`          |
| `delegator_identifier_type_id` | `uint8`      | Identifier representing the type of the delegator identifier: `0` for PublicKey, `1` for purse URef\`                                                              |
| `public_key`                   | `string(68)` | Public key of the delegator represented as a hexadecimal string (deprecated: use `delegator_identifier` instead, this property will be removed in future versions) |
| `validator_public_key`         | `string(68)` | Public key of the validator represented as a hexadecimal string                                                                                                    |
| `stake`                        | `string`     | Delegation amount in motes. The type is string to avoid overflow in languages that don't support uint64, which is the correct type.                                |
| `bonding_purse`                | `string(72)` | URef of the purse from which the delegation was made in the `uref-dead...beef-007` format                                                                          |

**Example**

```json
{
  "bonding_purse": "uref-2bd212c2b75dbc99a6ac8ea7d543b322967f39132ad7bc2c927cfed21d3fce4a-007",
  "delegator_identifier": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
  "delegator_identifier_type_id": 0,
  "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
  "stake": "10118248961309619",
  "validator_public_key": "0107a9a673f54c231da8a9cf96e041701293e15c7f05dd5e7fddb2678ccb411555"
}
```

## Optional properties

Depending on the endpoint some of the following optional properties may be included in the `Delegation` entity:

| Property                   | Type                                                           | Description                                                                                             |
| -------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `account_info`             | [AccountInfo](/rest-api/account-info)                          | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the delegator |
| `validator_account_info`   | [AccountInfo](/rest-api/account-info)                          | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the validator |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                            |
| `bidder`                   | [`Bidder`](/rest-api/bidder)                                   | Bidder auction info of the validator                                                                    |
| `cspr_name`                | `string`                                                       | Primary CSPR.name of the account                                                                        |
| `validator_cspr_name`      | `string`                                                       | Primary CSPR.name of the validator account                                                              |

## Relations

The `Delegation` entity has the following relations with other entities:

| Entity                             | Mapping property       | Description                                                   |
| ---------------------------------- | ---------------------- | ------------------------------------------------------------- |
| [`Account`](/rest-api/account)     | `public_key`           | Delegations are made by accounts                              |
| [`Validator`](/rest-api/validator) | `validator_public_key` | Delegations are made to validators                            |
| [`Bidder`](/rest-api/bidder)       | `validator_public_key` | Delegations can be made to bidders who are not validators yet |

## Endpoints

The `Delegation` entity has the following endpoints:

* [Get account delegations](/rest-api/delegation/get-account-delegations)
* [Get purse delegations](/rest-api/delegation/get-purse-uref-delegations)
* [Get validator delegations](/rest-api/delegation/get-validator-delegations)

## Relation endpoints

None


# Get account delegations

Get paginated list of delegations made by an account.

```
GET /accounts/{public_key}/delegations
```

## Query params

None

## Sorting

| Property | Description          |
| -------- | -------------------- |
| `stake`  | Sort by stake amount |

Default sorting is `stake DESC`

## Optional properties

| Property                   | Type                                                                                                                                                          | Description                                                                                             |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `account_info`             | [AccountInfo](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/delegation/account-info.md)                          | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the delegator |
| `validator_account_info`   | [AccountInfo](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/delegation/account-info.md)                          | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the validator |
| `centralized_account_info` | [`CentralizedAccountInfo`](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/delegation/centralized-account-info.md) | Account information available for known accounts provided by CSPR.cloud team                            |
| `bidder`                   | [`Bidder`](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/delegation/bidder.md)                                   | Bidder auction info of the validator                                                                    |
| `cspr_name`                | `string`                                                                                                                                                      | Primary CSPR.name of the account                                                                        |
| `validator_cspr_name`      | `string`                                                                                                                                                      | Primary CSPR.name of the validator account                                                              |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Delegation>`](/rest-api/delegation)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02/delegations?limit=2&offset=0' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 93,
  "page_count": 10,
  "data": [
    {
      "bonding_purse": "uref-0ac1ba0100574729337b63b11e1f933b91d1d0f220823bef502bd8957305976b-007",
      "delegator_identifier": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "delegator_identifier_type_id": 0,
      "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "stake": "99588555735468641",
      "validator_public_key": "017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e"
    },
    {
      "bonding_purse": "uref-917e1aeba7e7d3a322e89069e88b6e0877a59d781840c0ce8223e990e0342d42-007",
      "delegator_identifier": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "delegator_identifier_type_id": 0,
      "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "stake": "99348274926678796",
      "validator_public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
    },
    ...
    {
      "bonding_purse": "uref-2bd212c2b75dbc99a6ac8ea7d543b322967f39132ad7bc2c927cfed21d3fce4a-007",
      "delegator_identifier": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "delegator_identifier_type_id": 0,
      "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "stake": "10118248961309619",
      "validator_public_key": "0107a9a673f54c231da8a9cf96e041701293e15c7f05dd5e7fddb2678ccb411555"
    }
  ]
}
```


# Get purse delegations

Get paginated list of purse delegations identified by its URef.

```
GET /purse-urefs/{purse_uref}/delegations
```

## Query params

None

## Sorting

| Property | Description          |
| -------- | -------------------- |
| `stake`  | Sort by stake amount |

Default sorting is `stake DESC`

## Optional properties

| Property                   | Type                                                           | Description                                                                                             |
| -------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `account_info`             | [AccountInfo](/rest-api/account-info)                          | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the delegator |
| `validator_account_info`   | [AccountInfo](/rest-api/account-info)                          | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the validator |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                            |
| `bidder`                   | [`Bidder`](/rest-api/bidder)                                   | Bidder auction info of the validator                                                                    |
| `cspr_name`                | `string`                                                       | Primary CSPR.name of the account                                                                        |
| `validator_cspr_name`      | `string`                                                       | Primary CSPR.name of the validator account                                                              |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Delegation>`](/rest-api/delegation)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/purse-urefs/uref-2765FDC748EE7AB6F0CE1C13FD97E54EEB6403159602C07E2F950C565C07CFD0-007/delegations?limit=2&offset=0' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 1,
  "page_count": 1,
  "data": [
    {
      "bonding_purse": "uref-b6c8e1e97ae7783f0a65051d68cb61a24fcf90f08615cd78e0e5e0eb6e2192a6-007",
      "delegator_identifier": "uref-2765fdc748ee7ab6f0ce1c13fd97e54eeb6403159602c07e2f950c565c07cfd0-007",
      "delegator_identifier_type_id": 1,
      "stake": "6102866096569",
      "validator_public_key": "01075ec8809c691a1d1b0250ba9ea75da5460e3df43c3172771c6975c989457159"
    }
  ]
}
```


# Get validator delegations

Get paginated list of delegations made to a validator.

```
GET /validators/{public_key}/delegations
```

## Query params

None

## Sorting

| Property | Description          |
| -------- | -------------------- |
| `stake`  | Sort by stake amount |

Default sorting is `stake DESC`

## Optional properties

| Property                   | Type                                                                                                                                                          | Description                                                                                             |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `account_info`             | [AccountInfo](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/delegation/account-info.md)                          | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the delegator |
| `validator_account_info`   | [AccountInfo](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/delegation/account-info.md)                          | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the validator |
| `centralized_account_info` | [`CentralizedAccountInfo`](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/delegation/centralized-account-info.md) | Account information available for known accounts provided by CSPR.cloud team                            |
| `bidder`                   | [`Bidder`](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/delegation/bidder.md)                                   | Bidder auction info of the validator                                                                    |
| `cspr_name`                | `string`                                                                                                                                                      | Primary CSPR.name of the account                                                                        |
| `validator_cspr_name`      | `string`                                                                                                                                                      | Primary CSPR.name of the validator account                                                              |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Delegation>`](/rest-api/delegation)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/validators/0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca/delegations?limit=2&offset=0' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 128,
  "page_count": 13,
  "data": [
    {
      "bonding_purse": "uref-917e1aeba7e7d3a322e89069e88b6e0877a59d781840c0ce8223e990e0342d42-007",
      "delegator_identifier": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "delegator_identifier_type_id": 0,
      "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "stake": "99348274926678796",
      "validator_public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
    },
    {
      "bonding_purse": "uref-ee8e4e63ee02f7cd38838b07bdd591cc8986bf6e8e5724dd0d54328e76b8dda0-007",
      "delegator_identifier": "011b5b2e370411b6df3a3d8ac0063b35e2003994a634dba48dd5422247fc1e7c41",
      "delegator_identifier_type_id": 0,
      "public_key": "011b5b2e370411b6df3a3d8ac0063b35e2003994a634dba48dd5422247fc1e7c41",
      "stake": "159326721297057",
      "validator_public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
    },
    ...
    {
      "bonding_purse": "uref-0979efcbf321998cd0c65a755a668f555be56ad1c0a063fe289fbdc4467f7519-007",
      "delegator_identifier": "0111dad2c2c4769e5fb723fa4fdb432a7d39c48a575a361dca1ff8693e715642df",
      "delegator_identifier_type_id": 0,
      "public_key": "0111dad2c2c4769e5fb723fa4fdb432a7d39c48a575a361dca1ff8693e715642df",
      "stake": "3791559906526",
      "validator_public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
    }
  ]
}
```


# Delegator reward

The `DelegatorReward` entity offers a normalized representation of the Casper Network [Reward](https://docs.casper.network/concepts/glossary/R/#reward) related to the delegator account.

## Properties

The `DelegatorReward` entity contains the following properties:

| Property                       | Type         | Description                                                                                                                                                                                                |
| ------------------------------ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `delegator_identifier`         | `string(64)` | A representation of the delegator identifier, which can be either: a hex-encoded public key, or a purse URef, depending on `delegator_identifier_type_id`. Primary identifier                              |
| `delegator_identifier_type_id` | `uint8`      | Identifier representing the type of the delegator identifier: `0` for PublicKey, `1` for purse URef                                                                                                        |
| `public_key`                   | `string(64)` | The public key of the delegator account represented as a hexadecimal string. Primary account identifier (deprecated: use `delegator_identifier` instead, this property will be removed in future versions) |
| `validator_public_key`         | `string(64)` | Public key of the validator represented as a hexadecimal string. Unique validator identifier                                                                                                               |
| `era_id`                       | `uint32`     | Era identifier                                                                                                                                                                                             |
| `amount`                       | `uint64`     | Amount of the reward received by the delegator.                                                                                                                                                            |
| `timestamp`                    | `datetime`   | Timestamp indicating when the last block was proposed.                                                                                                                                                     |

**Example**

```json
{
  "amount": "44272516539",
  "delegator_identifier": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
  "delegator_identifier_type_id": 0,
  "era_id": 17997,
  "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
  "timestamp": "2025-05-22T07:03:50Z",
  "validator_public_key": "01fe8594026624b992c840281cb528515bd8574d281c38222deaa6eb22546c7656"
}
```

## Optional properties

Depending on the endpoint, the following optional properties may be included in the `DelegatorReward` entity:

| Property                   | Type                                                           | Description                                                                                                                                                                 |
| -------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `rate`                     | `float32`                                                      | The rate that was relevant at the moment when the last block was proposed. To get more details see [Including CSPR rates](/documentation/highlights/including-cspr-rates) . |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the account owner                                                                 |
| `validator_account_info`   | [AccountInfo](/rest-api/account-info)                          | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the validator                                                                     |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                                                                                |
| `cspr_name`                | `string`                                                       | Primary CSPR.name of the account                                                                                                                                            |
| `validator_cspr_name`      | `string`                                                       | Primary CSPR.name of the validator account                                                                                                                                  |

## Relations

The `DelegatorReward` entity has the following relations with other entities:

| Entity                             | Mapping property                                       | Description                                                                        |
| ---------------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------- |
| [`Account`](/rest-api/account)     | `delegator_identifier`, `delegator_identifier_type_id` | Accounts receive rewards for delegating to validators.                             |
| [`Purse`](/rest-api/purse-uref)    | `delegator_identifier`, `delegator_identifier_type_id` | Purses receive rewards for delegating to validators.                               |
| [`Validator`](/rest-api/validator) | `validator_public_key`                                 | Delegation rewards are associated with the validator, that distributed the rewards |

## Endpoints

The `DelegatorReward` entity has the following endpoints:

* [Get account delegation rewards](/rest-api/delegator-reward/get-account-delegation-rewards)
* [Get total account delegation rewards](/rest-api/delegator-reward/get-account-total-delegation-rewards)
* [Get purse delegation rewards](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/delegator-reward/get-purse-uref-delegation-rewards.md)
* [Get total purse delegation rewards](https://github.com/make-software/casper-middleware/blob/documentation/docs/public/rest-api/delegator-reward/get-purse-uref-total-delegation-rewards.md)
* [Get total validator delegators' rewards](/rest-api/delegator-reward/get-total-validator-delegators-rewards)


# Get account delegator rewards

Get a paginated list of delegator rewards for an account.

```
GET /accounts/{public_key}/delegation-rewards
```

## Query params

| Query param            | Description                                                        |
| ---------------------- | ------------------------------------------------------------------ |
| `validator_public_key` | The public key of the validator to whom the stakes were delegated. |
| `from_era_id`          | From era id range                                                  |
| `to_era_id`            | To era id range                                                    |

## Sorting

| Property | Description                              |
| -------- | ---------------------------------------- |
| `era_id` | Sort validator rewards by era identifier |

Default sorting is `era_id DESC`

## Optional properties

| Property                   | Type                                                           | Description                                                                                                                                                                 |
| -------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `rate`                     | `float32`                                                      | The rate that was relevant at the moment when the last block was proposed. To get more details see [Including CSPR rates](/documentation/highlights/including-cspr-rates) . |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the account owner                                                                 |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                                                                                |
| `cspr_name`                | `string`                                                       | Primary CSPR.name of the account                                                                                                                                            |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<DelegatorReward>`](/rest-api/delegator-reward)

## Example

```bash
curl -X 'GET' \
   'https://api.testnet.cspr.cloud/accounts/018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02/delegation-rewards' \
   -H 'Accept: application/json' \
   -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 643865,
  "page_count": 64387,
  "data": [
    {
      "amount": "44272516539",
      "delegator_identifier": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "delegator_identifier_type_id": 0,
      "era_id": 17997,
      "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "timestamp": "2025-05-22T07:03:50Z",
      "validator_public_key": "01fe8594026624b992c840281cb528515bd8574d281c38222deaa6eb22546c7656"
    },
    {
      "amount": "70613172245",
      "delegator_identifier": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "delegator_identifier_type_id": 0,
      "era_id": 17997,
      "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "timestamp": "2025-05-22T07:03:50Z",
      "validator_public_key": "01fa3c25a6f41e9a8fb8bc9fba74dcfe98ed93de298b668f208eb1ab2ce8131898"
    },
    ...
    {
      "amount": "44271155773",
      "delegator_identifier": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "delegator_identifier_type_id": 0,
      "era_id": 17997,
      "public_key": "018afa98ca4be12d613617f7339a2d576950a2f9a92102ca4d6508ee31b54d2c02",
      "timestamp": "2025-05-22T07:03:50Z",
      "validator_public_key": "01ddcc7915ce438786b79d5689d8cd0f08ff605bd408dfca29a792f6479b53ecb0"
    }
  ]
}
```


# Get total account delegation rewards

Get total amount of delegation rewards for an account.

```
GET /accounts/{public_key}/total-delegation-rewards
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

uint64

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/01D4C0E543A1DBE84EC437C34E9E788A82F00580E5E12D8A2B187C6C4883479B1A/total-delegation-rewards' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": 184403853254
}
```


# Get purse delegation rewards

Get a paginated list of delegator rewards for a purse by its URef

```
GET /purse-urefs/{uref}/delegation-rewards
```

## Query params

| Query param            | Description                                                        |
| ---------------------- | ------------------------------------------------------------------ |
| `validator_public_key` | The public key of the validator to whom the stakes were delegated. |
| `from_era_id`          | From era id range                                                  |
| `to_era_id`            | To era id range                                                    |

## Sorting

| Property | Description                              |
| -------- | ---------------------------------------- |
| `era_id` | Sort validator rewards by era identifier |

Default sorting is `era_id DESC`

## Optional properties

| Property                   | Type                                                           | Description                                                                                                                                                                 |
| -------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `rate`                     | `float32`                                                      | The rate that was relevant at the moment when the last block was proposed. To get more details see [Including CSPR rates](/documentation/highlights/including-cspr-rates) . |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the account owner                                                                 |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                                                                                |
| `cspr_name`                | `string`                                                       | Primary CSPR.name of the account                                                                                                                                            |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<DelegatorReward>`](/rest-api/delegator-reward)

## Example

```bash
curl -X 'GET' \
   'https://api.testnet.cspr.cloud/purse-urefs/uref-2765FDC748EE7AB6F0CE1C13FD97E54EEB6403159602C07E2F950C565C07CFD0-007/delegation-rewards' \
   -H 'Accept: application/json' \
   -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 796,
  "page_count": 80,
  "data": [
    {
      "amount": "23367843",
      "delegator_identifier": "uref-2765fdc748ee7ab6f0ce1c13fd97e54eeb6403159602c07e2f950c565c07cfd0-007",
      "delegator_identifier_type_id": 1,
      "era_id": 17997,
      "timestamp": "2025-05-22T07:03:50Z",
      "validator_public_key": "01075ec8809c691a1d1b0250ba9ea75da5460e3df43c3172771c6975c989457159"
    },
    {
      "amount": "23367863",
      "delegator_identifier": "uref-2765fdc748ee7ab6f0ce1c13fd97e54eeb6403159602c07e2f950c565c07cfd0-007",
      "delegator_identifier_type_id": 1,
      "era_id": 17996,
      "timestamp": "2025-05-22T05:03:48Z",
      "validator_public_key": "01075ec8809c691a1d1b0250ba9ea75da5460e3df43c3172771c6975c989457159"
    },
    ...
    {
      "amount": "23368234",
      "delegator_identifier": "uref-2765fdc748ee7ab6f0ce1c13fd97e54eeb6403159602c07e2f950c565c07cfd0-007",
      "delegator_identifier_type_id": 1,
      "era_id": 17988,
      "timestamp": "2025-05-21T13:03:39Z",
      "validator_public_key": "01075ec8809c691a1d1b0250ba9ea75da5460e3df43c3172771c6975c989457159"
    }
  ]
}
```


# Get total purse delegation rewards

Get total amount of delegation rewards for a purse by its URef.

```
GET /purse-urefs/{uref}/total-delegation-rewards
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

uint64

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/purse-urefs/uref-2765FDC748EE7AB6F0CE1C13FD97E54EEB6403159602C07E2F950C565C07CFD0-007/total-delegation-rewards' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": 184403853254
}
```


# Get total validator delegators' rewards

Get total amount of delegator rewards for a validator.

```
GET /validators/{public_key}/total-delegator-rewards
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

uint64

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/validators/0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca/total-delegator-rewards' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": 3448524944825704
}
```


# Deploy

The `Deploy` entity provides a normalized representation of the Casper Network deploy. It is enriched with normalized contract data to make it possible to filter deploys by the contract regardless of the execution type.

## Properties

The `Deploy` entity has the following properties:

| Property                | Type          | Description                                                                                                                                                                                                                                             |
| ----------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `deploy_hash`           | `string(64)`  | Deploy hash represented as a hexadecimal string. Primary deploy identifier.                                                                                                                                                                             |
| `block_hash`            | `string(64)`  | Hash of the block containing the deploy represented as a hexadecimal string.                                                                                                                                                                            |
| `block_height`          | `uint64`      | Height of the block containing the deploy.                                                                                                                                                                                                              |
| `caller_public_key`     | `string(68)`  | Public key of the deploy caller account represented as a hexademical string. May be `null` if the public key is not known, but the `caller_hash` will still be present.                                                                                 |
| `caller_hash`           | `string(64)`  | Hash of the deploy caller account represented as a hexademical string.                                                                                                                                                                                  |
| `version_id`            | `uint8`       | Deploy version identifier: `0` for Casper 1.X deploys, `1` for Casper 2.0 deploys, and `2` for Casper 2.0 transactions.                                                                                                                                 |
| `pricing_mode_id`       | `uint8`       | Pricing mode identifier. Indicates which pricing model applies to the deploy \*                                                                                                                                                                         |
| `gas_price_limit`       | `uint8`       | Maximum allowed gas price that was specified by the caller (used only in `Limited(0)` pricing mode)                                                                                                                                                     |
| `is_standard_payment`   | `uint8`       | Indicates whether the deploy uses the standard payment mechanism or a custom payment contract                                                                                                                                                           |
| `runtime_type_id`       | `uint8`       | Identifies how the deploy was executed: `0` for native execution, `1` for VM version 1, and `2` for VM version 2                                                                                                                                        |
| `consumed_gas`          | `uint8`       | Represents the total amount of gas consumed during the execution of the deploy                                                                                                                                                                          |
| `refund_amount`         | `uint8`       | The amount of gas cost that was refunded to the caller account. In the current Mainnet configuration, 75% of unused payment amount is refunded.                                                                                                         |
| `execution_type_id`     | `uint8`       | [`DeployExecutionType`](/rest-api/deploy/get-deploy-execution-types) identifier, that tells what type of the deploy was executed                                                                                                                        |
| `contract_package_hash` | `string(64)`  | Hash of the contract package called by the deploy represented as a hexadecimal string. `null` if the deploy had no contract call.                                                                                                                       |
| `contract_hash`         | `string(64)`  | Hash of the contract called by the deploy represented as a hexadecimal string. `null` if the deploy had no contract call.                                                                                                                               |
| `entry_point_id`        | `uint32`      | Identifier of the [`ContractEntrypoint`](/rest-api/contract-entry-point) called by deploy. `null` if the deploy had no contract call.                                                                                                                   |
| `args`                  | `JSON`        | Deploy sessions arguments provided for contract execution.                                                                                                                                                                                              |
| `payment_amount`        | `string`      | Payment amount provided by the caller in motes. The type is string to avoid overflow in languages that don't support `uint64`, which is the correct type. `null` if a custom payment contract was provided to the deploy instead of the value in motes. |
| `cost`                  | `string`      | Deploy execution cost. The type is `string` to avoid overflow in languages that don't support `uint64`, which is the correct type.                                                                                                                      |
| `error_message`         | `string(128)` | Error message in case of a failed deploy. `null` for successful. deploys.                                                                                                                                                                               |
| `status`                | `string`      | Deploy status (`pending`, `expired`, or `processed`).                                                                                                                                                                                                   |
| `timestamp`             | `string`      | Deploy creation timestamp in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.                                                                                                                                                             |

### Pricing Mode Supported Values

| Name      | Value | Description                                                                  |
| --------- | ----- | ---------------------------------------------------------------------------- |
| `Limited` | `0`   | Default pricing mode used in Casper 1.X versions.                            |
| `Fixed`   | `1`   | Introduced in Casper 2.0. Uses a flat-fee model for deploy execution.        |
| `Prepaid` | `2`   | Allows users to prepay for deploys. Intended for future or custom use cases. |

**Example**

```json
{
  "args": {
    "amount": {
      "cl_type": "U512",
      "parsed": "2500000000"
    },
    "id": {
      "cl_type": {
        "Option": "U64"
      },
      "parsed": null
    },
    "target": {
      "cl_type": {
        "ByteArray": 32
      },
      "parsed": "536345751b7c6c6299d5ef10862d76736ed062bc32c1dabcd1179c06469d93ca"
    }
  },
  "block_hash": "d76b4ce5281f2306911a0e5e9ac0b29f1f4daf36f4636e78599ce64a7f7528a1",
  "block_height": 2404577,
  "caller_hash": "048a54220799a48171743407c086668bdcc788e2a31e4185fe52d0682634f888",
  "caller_public_key": "020304811a7b142c32860cb1c114f23b0754215918d819f485b0a201af6cde70fa6c",
  "consumed_gas": "100000000",
  "contract_hash": "010c3fe81b7b862e50c77ef9a958a05bfa98444f26f96f23d37a13c96244cfb7",
  "contract_package_hash": "9824d60dc3a5c44a20b9fd260a412437933835b52fc683d8ae36e4ec2114843e",
  "cost": "100000000",
  "deploy_hash": "88461218a5e972fcda1d764d7cc4edb2e0c3a538123b97890d484f43c55935f5",
  "entry_point_id": 10,
  "error_message": null,
  "execution_type_id": 6,
  "gas_price_limit": 1,
  "is_standard_payment": false,
  "payment_amount": "100000000",
  "pricing_mode_id": 0,
  "refund_amount": "0",
  "runtime_type_id": 0,
  "status": "processed",
  "timestamp": "2024-01-08T15:24:47Z",
  "version_id": 0
}
```

## Optional properties

Depending on the endpoint some of the following optional properties may be included in the `Deploy` entity:

| Property                   | Type                                                           | Description                                                                                                         |
| -------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the deploy caller account |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                        |
| `caller_cspr_name`         | `string`                                                       | Primary CSPR.name of the deploy caller account                                                                      |
| `contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | [`ContractPackage`](/rest-api/contract-package) called by deploy.                                                   |
| `contract`                 | [`Contract`](/rest-api/contract)                               | [`Contract`](/rest-api/contract) called by deploy.                                                                  |
| `contract_entrypoint`      | [`ContractEntrypoint`](/rest-api/contract-entry-point)         | [`ContractEntrypoint`](/rest-api/contract-entry-point) called by deploy.                                            |
| `rate`                     | `float32`                                                      | CSPR rate for specified currency that was relevant at the moment of deploy creation.                                |
| `transfers`                | \[][`Transfer`](/rest-api/transfer)                            | List of transfers executed during deploy execution                                                                  |

## Relations

The `Deploy` entity has the following relations with other entities:

| Entity                                                               | Mapping property        | Description                                                                                                                                    |
| -------------------------------------------------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| [`Account`](/rest-api/account)                                       | `caller_public_key`     | Deploys are called by accounts.                                                                                                                |
| [`Block`](/rest-api/block)                                           | `block_hash`            | Deploys are executed in blocks.                                                                                                                |
| [`Contract`](/rest-api/contract)                                     | `contract_hash`         | Deploys can call contracts, and contracts are deployed with deploys.                                                                           |
| [`ContractEntrypoint`](/rest-api/contract-package)                   | `entry_point`           | Deploys can call entry points.                                                                                                                 |
| [`ContractPackage`](/rest-api/contract-package)                      | `contract_package_hash` | Deploys can call contracts in contract packages.                                                                                               |
| [`DeployExecutionType`](/rest-api/deploy/get-deploy-execution-types) | `execution_type_id`     | Deploys call contracts via different [execution types](https://docs.casper.network/developers/writing-onchain-code/calling-contracts/).        |
| [`Fungible token action`](/rest-api/fungible-token-action)           | `deploy_hash`           | Fungible token actions are result of deploy execution.                                                                                         |
| [`NFT`](/rest-api/non-fungible-token)                                |                         | NFTs are created as result of deploy execution. There is no direct mapping, but rather a semantic relationship between deploys and nft tokens. |
| [`NFT Action`](/rest-api/non-fungible-token-action)                  | `deploy_hash`           | NFT actions are result of deploy execution.                                                                                                    |
| [`Transfer`](/rest-api/transfer)                                     | `deploy_hash`           | Transfers are result of deploy execution.                                                                                                      |

## Endpoints

The `Deploy` entity has the following endpoints:

* [Get deploy](/rest-api/deploy/get-deploy)
* [Get deploys](/rest-api/deploy/get-deploys)
* [Get account deploys](/rest-api/deploy/get-account-deploys)
* [Get block deploys](/rest-api/deploy/get-block-deploys)

## Relation endpoints

* [Get deploy execution types](/rest-api/deploy/get-deploy-execution-types)


# Get deploy

Get deploy by its hash.

```
GET /deploys/{deploy_hash}
```

## Query params

None

## Sorting

None

## Optional properties

| Property                   | Type                                                           | Description                                                                                                 |
| -------------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the deploy caller |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                |
| `caller_cspr_name`         | `string`                                                       | Primary CSPR.name of the deploy caller account                                                              |
| `contract_package`         | `ContractPackage`                                              | `ContractPackage` entity.                                                                                   |
| `contract`                 | `Contract`                                                     | `Contract` entity.                                                                                          |
| `contract_entrypoint`      | `ContractEntrypoint`                                           | `ContractEntrypoint` entity.                                                                                |
| `rate`                     | `float32`                                                      | CSPR rate for specified currency that was relevant at the moment of deploy creation.                        |
| `transfers`                | \[][`Transfer`](/rest-api/transfer)                            | List of `Transfer` entities.                                                                                |
| `nft_token_actions`        | \[] [`NFTTokenAction`](/rest-api/non-fungible-token-action)    | List of `NFTTokenAction` entities.                                                                          |
| `ft_token_actions`         | \[] [`FTTokenAction`](/rest-api/fungible-token-action)         | List of `Fungible token action` entities.                                                                   |

## Response

[`Deploy`](/rest-api/deploy)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/deploys/88461218a5e972fcda1d764d7cc4edb2e0c3a538123b97890d484f43c55935f5' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "args": {
      "amount": {
        "cl_type": "U512",
        "parsed": "2500000000"
      },
      "id": {
        "cl_type": {
          "Option": "U64"
        },
        "parsed": null
      },
      "target": {
        "cl_type": {
          "ByteArray": 32
        },
        "parsed": "536345751b7c6c6299d5ef10862d76736ed062bc32c1dabcd1179c06469d93ca"
      }
    },
    "block_hash": "d76b4ce5281f2306911a0e5e9ac0b29f1f4daf36f4636e78599ce64a7f7528a1",
    "block_height": 2404577,
    "caller_hash": "048a54220799a48171743407c086668bdcc788e2a31e4185fe52d0682634f888",
    "caller_public_key": "020304811a7b142c32860cb1c114f23b0754215918d819f485b0a201af6cde70fa6c",
    "consumed_gas": "100000000",
    "contract_hash": "010c3fe81b7b862e50c77ef9a958a05bfa98444f26f96f23d37a13c96244cfb7",
    "contract_package_hash": "9824d60dc3a5c44a20b9fd260a412437933835b52fc683d8ae36e4ec2114843e",
    "cost": "100000000",
    "deploy_hash": "88461218a5e972fcda1d764d7cc4edb2e0c3a538123b97890d484f43c55935f5",
    "entry_point_id": 10,
    "error_message": null,
    "execution_type_id": 6,
    "gas_price_limit": 1,
    "is_standard_payment": false,
    "payment_amount": "100000000",
    "pricing_mode_id": 0,
    "refund_amount": "0",
    "runtime_type_id": 0,
    "status": "processed",
    "timestamp": "2024-01-08T15:24:47Z",
    "version_id": 0
  }
}
```


# Get deploys

Get a paginated list of deploys.

```
GET /deploys
```

## Query params

| Query param              | Description                                          |
| ------------------------ | ---------------------------------------------------- |
| `caller_public_key`      | Deploy caller public key                             |
| `block_hash`             | Hash of the deploy block                             |
| `contract_package_hash`  | Contract package hash of the called contract         |
| `contract_hash`          | Called contract hash                                 |
| `contract_entrypoint_id` | Comma-separated called entry point IDs, e.g. `1,2,3` |
| `from_block_height`      | From block height range                              |
| `to_block_height`        | To block height range                                |

## Sorting

| Property    | Description               |
| ----------- | ------------------------- |
| `timestamp` | Sort deploys by timestamp |

Default sorting is `timestamp DESC`

## Optional properties

| Property                   | Type                                                           | Description                                                                                                 |
| -------------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the deploy caller |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                |
| `caller_cspr_name`         | `string`                                                       | Primary CSPR.name of the deploy caller account                                                              |
| `contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | `ContractPackage` entity.                                                                                   |
| `contract`                 | [`Contract`](/rest-api/contract)                               | `Contract` entity.                                                                                          |
| `contract_entrypoint`      | [`ContractEntrypoint`](/rest-api/contract-entry-point)         | `ContractEntrypoint` entity.                                                                                |
| `rate`                     | `float32`                                                      | CSPR rate for specified currency that was relevant at the moment of deploy creation.                        |
| `transfers`                | \[][`Transfer`](/rest-api/transfer)                            | List of `Transfer` entities.                                                                                |
| `nft_token_actions`        | \[] [`NFTTokenAction`](/rest-api/non-fungible-token-action)    | List of `NFTTokenAction` entities.                                                                          |
| `ft_token_actions`         | \[] [`FTTokenAction`](/rest-api/fungible-token-action)         | List of `Fungible token action` entities.                                                                   |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Deploy>`](/rest-api/deploy)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/deploys' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 9405323,
  "page_count": 940533,
  "data": [
    {
      "args": {
        "amount": {
          "cl_type": "U512",
          "parsed": "2760317840"
        },
        "id": {
          "cl_type": {
            "Option": "U64"
          },
          "parsed": 0
        },
        "target": {
          "cl_type": "PublicKey",
          "parsed": "01e07ec431dc15a21e7319dd7d172cfcb152c28dfeaba32b1ccade783a804beb62"
        }
      },
      "block_hash": "2742ae284dda52514016e69bd31aa63f7caa2e162cb1244a4d3ba3bc8c6a899e",
      "block_height": 5059752,
      "caller_hash": "56c423f6791fd5437f1c8307256951c810f484e934989457458c6d3ada54f22b",
      "caller_public_key": "01eeeb006b7c6734b3b76720525fa4bbff38060ec2eb974d26de0d03cd1019ce29",
      "consumed_gas": "100000000",
      "contract_hash": "010c3fe81b7b862e50c77ef9a958a05bfa98444f26f96f23d37a13c96244cfb7",
      "contract_package_hash": "9824d60dc3a5c44a20b9fd260a412437933835b52fc683d8ae36e4ec2114843e",
      "cost": "100000000",
      "deploy_hash": "aabe3b3845c1cb9e11bd8d1d16a27a80c0e6a69016cc77e0a1a181fb2835cc23",
      "entry_point_id": 10,
      "error_message": null,
      "execution_type_id": 6,
      "gas_price_limit": 1,
      "is_standard_payment": true,
      "payment_amount": "100000000",
      "pricing_mode_id": 0,
      "refund_amount": "0",
      "runtime_type_id": 0,
      "status": "processed",
      "timestamp": "2025-05-28T11:56:39Z",
      "version_id": 1
    },
    {
      "args": {
        "amount": {
          "cl_type": "U512",
          "parsed": "2760317840"
        },
        "id": {
          "cl_type": {
            "Option": "U64"
          },
          "parsed": 0
        },
        "target": {
          "cl_type": "PublicKey",
          "parsed": "01eeeb006b7c6734b3b76720525fa4bbff38060ec2eb974d26de0d03cd1019ce29"
        }
      },
      "block_hash": "74e7aa55ef32810fd897661973261c963a5baa510bb49ff565d6bef9a05e1c0d",
      "block_height": 5059751,
      "caller_hash": "81aeb5de673ec4b7c150d0961a2cb34e5d21a7281c6cf2dd4f8a93c8556dac4a",
      "caller_public_key": "01e07ec431dc15a21e7319dd7d172cfcb152c28dfeaba32b1ccade783a804beb62",
      "consumed_gas": "100000000",
      "contract_hash": "010c3fe81b7b862e50c77ef9a958a05bfa98444f26f96f23d37a13c96244cfb7",
      "contract_package_hash": "9824d60dc3a5c44a20b9fd260a412437933835b52fc683d8ae36e4ec2114843e",
      "cost": "100000000",
      "deploy_hash": "573de6ddae4b0c67439ff6b94f0e8ec638b9ef547cb63ba319e39b2f9c6d5d67",
      "entry_point_id": 10,
      "error_message": null,
      "execution_type_id": 6,
      "gas_price_limit": 1,
      "is_standard_payment": true,
      "payment_amount": "100000000",
      "pricing_mode_id": 0,
      "refund_amount": "0",
      "runtime_type_id": 0,
      "status": "processed",
      "timestamp": "2025-05-28T11:56:21Z",
      "version_id": 1
    },
    ...
    {
      "args": {
        "amount": {
          "cl_type": "U512",
          "parsed": "2856973008"
        },
        "id": {
          "cl_type": {
            "Option": "U64"
          },
          "parsed": 0
        },
        "target": {
          "cl_type": "PublicKey",
          "parsed": "01e07ec431dc15a21e7319dd7d172cfcb152c28dfeaba32b1ccade783a804beb62"
        }
      },
      "block_hash": "6800b675d1b59cc2ddc40a2cbd071db2c75ed0d03c9215c4a2b8cdf0eda37d68",
      "block_height": 5059741,
      "caller_hash": "56c423f6791fd5437f1c8307256951c810f484e934989457458c6d3ada54f22b",
      "caller_public_key": "01eeeb006b7c6734b3b76720525fa4bbff38060ec2eb974d26de0d03cd1019ce29",
      "consumed_gas": "100000000",
      "contract_hash": "010c3fe81b7b862e50c77ef9a958a05bfa98444f26f96f23d37a13c96244cfb7",
      "contract_package_hash": "9824d60dc3a5c44a20b9fd260a412437933835b52fc683d8ae36e4ec2114843e",
      "cost": "100000000",
      "deploy_hash": "cb05e0a4d1a2beb607ddfa79f5612bafd441ae1d6c5b7fa3b7f005758db74049",
      "entry_point_id": 10,
      "error_message": null,
      "execution_type_id": 6,
      "gas_price_limit": 1,
      "is_standard_payment": true,
      "payment_amount": "100000000",
      "pricing_mode_id": 0,
      "refund_amount": "0",
      "runtime_type_id": 0,
      "status": "processed",
      "timestamp": "2025-05-28T11:53:28Z",
      "version_id": 1
    }
  ]
}
```


# Get account deploys

Get deploys by the caller account public key.

```
GET /accounts/{public_key}/deploys
```

## Query params

| Query param              | Description                                          |
| ------------------------ | ---------------------------------------------------- |
| `contract_package_hash`  | Contract package hash of the called contract         |
| `contract_hash`          | Called contract hash                                 |
| `contract_entrypoint_id` | Comma-separated called entry point IDs, e.g. `1,2,3` |
| `from_block_height`      | From block height range                              |
| `to_block_height`        | To block height range                                |

## Sorting

| Property    | Description               |
| ----------- | ------------------------- |
| `timestamp` | Sort deploys by timestamp |

Default sorting is `timestamp DESC`

## Optional properties

| Property                   | Type                                                           | Description                                                                                                 |
| -------------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the deploy caller |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                |
| `caller_cspr_name`         | `string`                                                       | Primary CSPR.name of the deploy caller account                                                              |
| `contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | [`ContractPackage`](/rest-api/contract-package) called by deploy.                                           |
| `contract`                 | [`Contract`](/rest-api/contract)                               | [`Contract`](/rest-api/contract) called by deploy.                                                          |
| `contract_entrypoint`      | [`ContractEntrypoint`](/rest-api/contract-entry-point)         | [`ContractEntrypoint`](/rest-api/contract-entry-point) called by deploy.                                    |
| `rate`                     | `float32`                                                      | CSPR rate for specified currency that was relevant at the moment of deploy creation.                        |
| `transfers`                | \[][`Transfer`](/rest-api/transfer)                            | List of `Transfer` entities.                                                                                |
| `nft_token_actions`        | \[] [`NFTTokenAction`](/rest-api/non-fungible-token-action)    | List of `NFTTokenAction` entities.                                                                          |
| `ft_token_actions`         | \[] [`FTTokenAction`](/rest-api/fungible-token-action)         | List of `Fungible token action` entities.                                                                   |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Deploy>`](/rest-api/deploy)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/020304811a7b142c32860cb1c114f23b0754215918d819f485b0a201af6cde70fa6c/deploys' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 21,
  "page_count": 3,
  "data": [
    {
      "args": {
        "amount": {
          "cl_type": "U512",
          "parsed": "2500000000"
        },
        "id": {
          "cl_type": {
            "Option": "U64"
          },
          "parsed": null
        },
        "target": {
          "cl_type": {
            "ByteArray": 32
          },
          "parsed": "1b04049f2d03ad4e9bf31f7c65e53521ab688e9bf039716170b3cb4334f5deff"
        }
      },
      "block_hash": "d48d3e68f8ae373bc1b6aebaedad78c5d0d90b55231f0003686ce55d5a3eb0ee",
      "block_height": 2550963,
      "caller_hash": "048a54220799a48171743407c086668bdcc788e2a31e4185fe52d0682634f888",
      "caller_public_key": "020304811a7b142c32860cb1c114f23b0754215918d819f485b0a201af6cde70fa6c",
      "consumed_gas": "100000000",
      "contract_hash": "010c3fe81b7b862e50c77ef9a958a05bfa98444f26f96f23d37a13c96244cfb7",
      "contract_package_hash": "9824d60dc3a5c44a20b9fd260a412437933835b52fc683d8ae36e4ec2114843e",
      "cost": "100000000",
      "deploy_hash": "735bf84a6f4b0ec26e01afdc8abc83b02d8ec60ec98a497f41452c694fe0e987",
      "entry_point_id": 10,
      "error_message": null,
      "execution_type_id": 6,
      "gas_price_limit": 1,
      "is_standard_payment": false,
      "payment_amount": "100000000",
      "pricing_mode_id": 0,
      "refund_amount": "0",
      "runtime_type_id": 0,
      "status": "processed",
      "timestamp": "2024-02-05T11:41:35Z",
      "version_id": 0
    },
    {
      "args": {
        "amount": {
          "cl_type": "U512",
          "parsed": "2500000000"
        },
        "id": {
          "cl_type": {
            "Option": "U64"
          },
          "parsed": null
        },
        "target": {
          "cl_type": {
            "ByteArray": 32
          },
          "parsed": "536345751b7c6c6299d5ef10862d76736ed062bc32c1dabcd1179c06469d93ca"
        }
      },
      "block_hash": "d76b4ce5281f2306911a0e5e9ac0b29f1f4daf36f4636e78599ce64a7f7528a1",
      "block_height": 2404577,
      "caller_hash": "048a54220799a48171743407c086668bdcc788e2a31e4185fe52d0682634f888",
      "caller_public_key": "020304811a7b142c32860cb1c114f23b0754215918d819f485b0a201af6cde70fa6c",
      "consumed_gas": "100000000",
      "contract_hash": "010c3fe81b7b862e50c77ef9a958a05bfa98444f26f96f23d37a13c96244cfb7",
      "contract_package_hash": "9824d60dc3a5c44a20b9fd260a412437933835b52fc683d8ae36e4ec2114843e",
      "cost": "100000000",
      "deploy_hash": "88461218a5e972fcda1d764d7cc4edb2e0c3a538123b97890d484f43c55935f5",
      "entry_point_id": 10,
      "error_message": null,
      "execution_type_id": 6,
      "gas_price_limit": 1,
      "is_standard_payment": false,
      "payment_amount": "100000000",
      "pricing_mode_id": 0,
      "refund_amount": "0",
      "runtime_type_id": 0,
      "status": "processed",
      "timestamp": "2024-01-08T15:24:47Z",
      "version_id": 0
    },
    ...
    {
      "args": {
        "amount": {
          "cl_type": "U512",
          "parsed": "7000000000"
        },
        "id": {
          "cl_type": {
            "Option": "U64"
          },
          "parsed": 1684328907917
        },
        "target": {
          "cl_type": "PublicKey",
          "parsed": "02027bc80ed37801e3eeab2a4e98e2d0ef4b93da8d416e91b17d6f5ebbc4752d6198"
        }
      },
      "block_hash": "cc9395694d89630635c4bf208efe450aefdfa160d849c37cdbb8c3516c3b43eb",
      "block_height": 1730104,
      "caller_hash": "048a54220799a48171743407c086668bdcc788e2a31e4185fe52d0682634f888",
      "caller_public_key": "020304811a7b142c32860cb1c114f23b0754215918d819f485b0a201af6cde70fa6c",
      "consumed_gas": "100000000",
      "contract_hash": "010c3fe81b7b862e50c77ef9a958a05bfa98444f26f96f23d37a13c96244cfb7",
      "contract_package_hash": "9824d60dc3a5c44a20b9fd260a412437933835b52fc683d8ae36e4ec2114843e",
      "cost": "100000000",
      "deploy_hash": "4a114e03c84eb098afd0b6b5d09b654911e93624e07339d29e7418f1d15a0212",
      "entry_point_id": 10,
      "error_message": null,
      "execution_type_id": 6,
      "gas_price_limit": 1,
      "is_standard_payment": false,
      "payment_amount": "100000000",
      "pricing_mode_id": 0,
      "refund_amount": "0",
      "runtime_type_id": 0,
      "status": "processed",
      "timestamp": "2023-05-17T13:08:49Z",
      "version_id": 0
    }
  ]
}
```


# Get block deploys

Get deploys by block identifier (hash or height).

```
GET /blocks/{block_identifier}/deploys
```

## Query params

| Query param              | Description                                          |
| ------------------------ | ---------------------------------------------------- |
| `caller_public_key`      | Deploy caller public key                             |
| `contract_package_hash`  | Contract package hash of the called contract         |
| `contract_hash`          | Called contract hash                                 |
| `contract_entrypoint_id` | Comma-separated called entry point IDs, e.g. `1,2,3` |

## Sorting

| Property    | Description               |
| ----------- | ------------------------- |
| `timestamp` | Sort deploys by timestamp |

Default sorting is `timestamp DESC`

## Optional properties

| Property                   | Type                                                           | Description                                                                                                 |
| -------------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the deploy caller |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                |
| `caller_cspr_name`         | `string`                                                       | Primary CSPR.name of the deploy caller account                                                              |
| `contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | [`ContractPackage`](/rest-api/contract-package) called by deploy.                                           |
| `contract`                 | [`Contract`](/rest-api/contract)                               | [`Contract`](/rest-api/contract) called by deploy.                                                          |
| `contract_entrypoint`      | [`ContractEntrypoint`](/rest-api/contract-entry-point)         | [`ContractEntrypoint`](/rest-api/contract-entry-point) called by deploy.                                    |
| `rate`                     | `float32`                                                      | CSPR rate for specified currency that was relevant at the moment of deploy creation.                        |
| `transfers`                | \[][`Transfer`](/rest-api/transfer)                            | List of `Transfer` entities.                                                                                |
| `nft_token_actions`        | \[] [`NFTTokenAction`](/rest-api/non-fungible-token-action)    | List of `NFTTokenAction` entities.                                                                          |
| `ft_token_actions`         | \[] [`FTTokenAction`](/rest-api/fungible-token-action)         | List of `Fungible token action` entities.                                                                   |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Deploy>`](/rest-api/deploy)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/blocks/a6c2974d211fdf0ddadb15f4e81b2fb65a0274787c46f362301ef583764f26f4/deploys' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "item_count": 1,
  "page_count": 1,
  "data": [
    {
      "args": {
        "accounts": {
          "cl_type": {
            "List": "Key"
          },
          "parsed": [
            {
              "Account": "account-hash-9081ded33b9d55aab6801da9c2fa5ce0750aee6eac158ae4989ee733def542f3"
            }
          ]
        },
        "deployment_threshold": {
          "cl_type": "U8",
          "parsed": 1
        },
        "key_management_threshold": {
          "cl_type": "U8",
          "parsed": 1
        },
        "weights": {
          "cl_type": {
            "List": "U8"
          },
          "parsed": [
            1
          ]
        }
      },
      "block_hash": "a6c2974d211fdf0ddadb15f4e81b2fb65a0274787c46f362301ef583764f26f4",
      "block_height": 2314748,
      "caller_hash": "277b0c7e95cac71a985b337de99c9bec5338272bbb99617b664e4ab1400639fb",
      "caller_public_key": "020267411749de2c7d7cf5f50ec2daad281b9a3029ec09d8a119ac7e65fa3422e0d8",
      "consumed_gas": "511166580",
      "contract_hash": "a97d0f3da70d0427b03bf61a53ce6f72b49c45b65c32a6226e1d322c6d533a86",
      "contract_package_hash": "dbebb9cfc57c727c03c4108142560642b7e1fcf732dcc0457889ef3dec435634",
      "cost": "511166580",
      "deploy_hash": "1fdea0ea6500652c814d7c2f4980309a21b87309f90d209cc8feb61ebd382d69",
      "entry_point_id": 2430820,
      "error_message": null,
      "execution_type_id": 2,
      "gas_price_limit": 1,
      "is_standard_payment": false,
      "payment_amount": "1000000000",
      "pricing_mode_id": 0,
      "refund_amount": "0",
      "runtime_type_id": 0,
      "status": "processed",
      "timestamp": "2023-12-22T13:14:43Z",
      "version_id": 0
    }
  ]
}
```


# Get deploy execution types

Get deploy execution types.

```
GET /deploy-execution-types
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

List of value objects describing the available deploy execution types

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/deploy-execution-types' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "id": 1,
      "name": "ModuleBytes"
    },
    {
      "id": 2,
      "name": "StoredContractByHash"
    },
    {
      "id": 3,
      "name": "StoredContractByName"
    },
    {
      "id": 4,
      "name": "StoredVersionedContractByHash"
    },
    {
      "id": 5,
      "name": "StoredVersionedContractByName"
    },
    {
      "id": 6,
      "name": "Transfer"
    },
    {
      "id": 7,
      "name": "WASM (Odra ProxyCaller)"
    }
  ]
}
```


# DEX

`DEX` entity represents DEXes operating on the Casper Network.

### Properties

The `DEX` entity has the following properties:

| Property | Type     | Description    |
| -------- | -------- | -------------- |
| `id`     | `int`    | DEX identifier |
| `name`   | `string` | DEX name       |

**Example**

```json
{
  "id": 1,
  "name": "CSPR.trade"
}
```

### Optional properties

None

### Relations

The `DEX` entity has the following relations with other entities:

| Entity                                                                     | Mapping property | Description                                          |
| -------------------------------------------------------------------------- | ---------------- | ---------------------------------------------------- |
| [`Fungible token rate`](/rest-api/fungible-token-rate)                     | `dex_id`         | Fungible token rates are tracked for different DEXes |
| [`Fungible token daily rate`](/rest-api/fungible-token-daily-rate)         | `dex_ids`        | DEX identifiers used in the aggregation              |
| [`Fungible token DEX rate`](/rest-api/fungible-token-dex-rate)             | `dex_id`         | DEX rates are tracked for token pairs                |
| [`Fungible token daily DEX rate`](/rest-api/fungible-token-daily-dex-rate) | `dex_id`         | Daily DEX rates are tracked for token pairs          |

## Endpoints

The `DEX` entity has the following endpoints:

* [Get DEXes](/rest-api/dex/get-dexes)


# Get DEXes

Get a list of DEXes.

```
GET /dexes
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

[`DEX`](/rest-api/dex)

## Example

```bash
curl -X 'GET' \
  'https://api.cspr.cloud/dexes' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "id": 1,
      "name": "CSPR.trade"
    },
    {
      "id": 2,
      "code": "Friendly Market",
    },
    {
      "id": 3,
      "code": "CSPR.fun",
    }
  ]
}
```


# Swap

The `Swap` entity represents a fungible token trade on a DEX indexed from Casper smart contracts. Each swap provides the pair, tokens, amounts, and timestamp for a single trade.

## Properties

The `Swap` entity has the following properties:

| Property                       | Type         | Description                                                                     |
| ------------------------------ | ------------ | ------------------------------------------------------------------------------- |
| `pair_contract_package_hash`   | `string(64)` | Pair contract package hash represented as a hexadecimal string                  |
| `transaction_hash`             | `string(64)` | Transaction hash represented as a hexadecimal string                            |
| `transform_id`                 | `uint`       | Transform identifier of the swap within the transaction                         |
| `block_height`                 | `uint64`     | Block height at which the swap occurred                                         |
| `sender_hash`                  | `string(64)` | Sender account hash represented as a hexadecimal string                         |
| `dex_id`                       | `uint16`     | DEX identifier                                                                  |
| `token0_contract_package_hash` | `string(64)` | Token0 contract package hash represented as a hexadecimal string                |
| `token1_contract_package_hash` | `string(64)` | Token1 contract package hash represented as a hexadecimal string                |
| `decimals0`                    | `uint8`      | Token0 decimals                                                                 |
| `decimals1`                    | `uint8`      | Token1 decimals                                                                 |
| `amount0_in`                   | `string`     | Token0 amount in (raw units). Can be `null`                                     |
| `amount1_in`                   | `string`     | Token1 amount in (raw units). Can be `null`                                     |
| `amount0_out`                  | `string`     | Token0 amount out (raw units). Can be `null`                                    |
| `amount1_out`                  | `string`     | Token1 amount out (raw units). Can be `null`                                    |
| `timestamp`                    | `string`     | Swap timestamp in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format |

Swap amounts (`amount0_in`, `amount1_in`, `amount0_out`, `amount1_out`) are returned in raw on-chain units. They are not normalized by token decimals.

**Example**

```json
{
  "pair_contract_package_hash": "0f6b7e1a8d6e4f1b5a2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef12",
  "transaction_hash": "9c1b7f2a5d6e4f1b2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef1234",
  "transform_id": 42,
  "block_height": 2404577,
  "sender_hash": "2a1d7f6c8b9e0f1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f70819",
  "dex_id": 1,
  "token0_contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
  "token1_contract_package_hash": "3b7f9c2d4e5f60718293a4b5c6d7e8f90123456789abcdef0123456789abcdef",
  "decimals0": 9,
  "decimals1": 6,
  "amount0_in": "1000000000",
  "amount1_in": "0",
  "amount0_out": "0",
  "amount1_out": "2500000",
  "timestamp": "2024-02-01T10:00:00Z"
}
```

## Optional properties

Depending on the endpoint, some of the following optional properties may be included in the `Swap` entity:

| Property                          | Type                                                           | Description                                                                                                                                    |
| --------------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `sender_public_key`               | `string(68)`                                                   | Sender public key represented as a hexadecimal string                                                                                          |
| `sender_account_info`             | [`AccountInfo`](/rest-api/account-info)                        | Sender account info                                                                                                                            |
| `sender_centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Sender account information available for known accounts provided by CSPR.cloud team                                                            |
| `pair_contract_package`           | [`ContractPackage`](/rest-api/contract-package)                | Pair contract package details                                                                                                                  |
| `token0_contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | Token0 contract package details                                                                                                                |
| `token1_contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | Token1 contract package details                                                                                                                |
| `token0_ft_rate`                  | `float64`                                                      | Token0 rate in the specified currency at the swap timestamp. It's a [function includer](/documentation/overview/optional-properties#functions) |
| `token1_ft_rate`                  | `float64`                                                      | Token1 rate in the specified currency at the swap timestamp. It's a [function includer](/documentation/overview/optional-properties#functions) |

## Relations

The `Swap` entity has the following relations with other entities:

| Entity                                           | Mapping property                                                                             | Description                                 |
| ------------------------------------------------ | -------------------------------------------------------------------------------------------- | ------------------------------------------- |
| [`Account`](/rest-api/account)                   | `sender_hash`                                                                                | Sender account of the swap trade            |
| [`Contract package`](/rest-api/contract-package) | `token0_contract_package_hash`, `token1_contract_package_hash`, `pair_contract_package_hash` | Swap trade token and pair contract packages |
| [`DEX`](/rest-api/dex)                           | `dex_id`                                                                                     | DEX that produced the swap                  |

## Endpoints

The `Swap` entity has the following endpoints:

* [Get swaps](/rest-api/swap/get-swaps)

## Relation endpoints

None


# Get swaps

Get a paginated list of fungible token trades.

```
GET /swaps
```

This endpoint returns fungible token trades and supports filtering by token, pair, sender, and DEX. Results are paginated and sorted by timestamp by default.

Swap amounts are returned in raw on-chain units and are not normalized by token decimals.

## Query params

| Query param                   | Description                                                                                                                                                                                                                                |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `token_contract_package_hash` | Filter swaps where any of the provided token hashes appear in the swap (comma-separated)                                                                                                                                                   |
| `pair_contract_package_hash`  | Filter by pair contract package hash (comma-separated)                                                                                                                                                                                     |
| `sender_account_hash`         | Filter by sender account hash (comma-separated)                                                                                                                                                                                            |
| `dex_id`                      | Filter by DEX ids (comma-separated)                                                                                                                                                                                                        |
| `includes`                    | Optional fields schema. Supports `sender_public_key`, `sender_account_info{}`, `sender_centralized_account_info{}`, `pair_contract_package{}`, `token0_contract_package{}`, `token1_contract_package{}`, and `ft_rate(currency_id,dex_id)` |

## Sorting

| Property    | Description              |
| ----------- | ------------------------ |
| `timestamp` | Sort swaps by timestamp. |

Default sorting is `timestamp DESC`

## Optional properties

| Property                          | Type                                                           | Description                                                                                                                                                                                      |
| --------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `sender_public_key`               | `string(68)`                                                   | Sender public key represented as a hexadecimal string                                                                                                                                            |
| `sender_account_info`             | [`AccountInfo`](/rest-api/account-info)                        | Sender account info                                                                                                                                                                              |
| `sender_centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Sender account information available for known accounts provided by CSPR.cloud team                                                                                                              |
| `pair_contract_package`           | [`ContractPackage`](/rest-api/contract-package)                | Pair contract package details                                                                                                                                                                    |
| `token0_contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | Token0 contract package details                                                                                                                                                                  |
| `token1_contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | Token1 contract package details                                                                                                                                                                  |
| `token0_ft_rate`                  | `float64`                                                      | Token0 rate in the specified currency at the swap timestamp. It's a [function includer](/documentation/overview/optional-properties#functions) that accepts `currency_id` and `dex_id` arguments |
| `token1_ft_rate`                  | `float64`                                                      | Token1 rate in the specified currency at the swap timestamp. It's a [function includer](/documentation/overview/optional-properties#functions) that accepts `currency_id` and `dex_id` arguments |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<Swap>`](/rest-api/swap)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/swaps?token_contract_package_hash=3d80df21ba4ee4d66a2a1f60c32570dd5685e4b279f6538162a5fd1314847c1e&page=1&page_size=10&includes=sender_public_key,ft_rate(1,1)' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "pair_contract_package_hash": "0f6b7e1a8d6e4f1b5a2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef12",
      "transaction_hash": "9c1b7f2a5d6e4f1b2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef1234",
      "transform_id": 42,
      "block_height": 2404577,
      "sender_hash": "2a1d7f6c8b9e0f1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f70819",
      "dex_id": 1,
      "token0_contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
      "token1_contract_package_hash": "3b7f9c2d4e5f60718293a4b5c6d7e8f90123456789abcdef0123456789abcdef",
      "decimals0": 9,
      "decimals1": 6,
      "amount0_in": "1000000000",
      "amount1_in": "0",
      "amount0_out": "0",
      "amount1_out": "2500000",
      "timestamp": "2024-02-01T10:00:00Z",
      "sender_public_key": "01b9c4d8e2f3a4b5c6d7e8f90123456789abcdef0123456789abcdef0123456789",
      "token0_ft_rate": 2.5,
      "token1_ft_rate": 3.5
    }
  ],
  "item_count": 1,
  "page_count": 1
}
```


# Fungible token action

The `FTTokenAction` entity describes standard actions that can be performed on fungible tokens, such as mint, transfer, or burn. CSPR.cloud supports fungible tokens compatible with the [CEP-18](https://github.com/casper-ecosystem/cep18) Casper Network standard.

### Properties

The `FTTokenAction` entity has the following properties:

| Property                | Type         | Description                                                                                                                                      |
| ----------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `deploy_hash`           | `string(64)` | Deploy hash in which the token action occurred. First part of token action identifier, represented as a hexadecimal string                       |
| `block_height`          | `uint64`     | Height of the block in which the token action occurred.                                                                                          |
| `transform_idx`         | `int`        | ID of the transform in the deploy execution result containing performed token action in deploy execution. Second part of token action identifier |
| `contract_package_hash` | `string(64)` | Contract package hash of fungible token contract, represented as a hexadecimal string                                                            |
| `from_hash`             | `string(64)` | Action source account or contract hash, represented as a hexadecimal string                                                                      |
| `from_type`             | `uint8`      | Action source hash type: `0` for account, `1` for contract                                                                                       |
| `to_hash`               | `string(64)` | Action target account or contract hash, represented as a hexadecimal string                                                                      |
| `to_type`               | `uint8`      | Action target hash type: `0` for account, `1` for contract                                                                                       |
| `ft_action_type_id`     | `uint8`      | [Fungible token action type](/rest-api/fungible-token-action/get-token-action-types) type identifier                                             |
| `amount`                | `string`     | Tokens amount value used during the token action                                                                                                 |
| `timestamp`             | `uint16`     | The timestamp of performed token action                                                                                                          |

**Example**

```json
{
  "amount": "37357",
  "contract_package_hash": "883238e99639bc7f5f7858398d0df94138c8ad89f76bdef7fac5fdd3df7f033a",
  "deploy_hash": "0005f1e53afa9799a66a389a90caab84ab3cbd000ab7741e55e09f80c75002b6",
  "block_height": 2404571,
  "from_hash": "f41cc7553d271e7ac70899ead4d3584c72ca2e119f2a86fbb4641ca95f3ba9e7",
  "from_type": 0,
  "ft_action_type_id": 2,
  "timestamp": "2023-02-09T19:16:21Z",
  "to_hash": "a5a9a804a383f3b0e131c85d471542af2c6d4ec57bab39182ba93dd7bd86f46c",
  "to_type": 1,
  "transform_idx": 67
}
```

## Optional properties

Depending on the endpoint some of the following optional properties may be included in the `FTTokenAction` entity:

| Property                        | Type                                                           | Description                                                       |
| ------------------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------- |
| `contract_package`              | [`ContractPackage`](/rest-api/contract-package)                | Fungible contract package                                         |
| `deploy`                        | [`Deploy`](/rest-api/deploy)                                   | Deploy in which the token action occurred                         |
| `from_public_key`               | `string(68)`                                                   | Action source public key if it's an account                       |
| `to_public_key`                 | `string(68)`                                                   | Action target public key if it's an account                       |
| `to_account_info`               | [`AccountInfo`](/rest-api/account-info)                        | Action source account info if it's an account                     |
| `from_account_info`             | [`AccountInfo`](/rest-api/account-info)                        | Action target account info if it's an account                     |
| `to_centralized_account_info`   | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Action target centralized account info if it's an account         |
| `from_centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Action target centralized account info if it's an account         |
| `from_cspr_name`                | `string`                                                       | Primary CSPR.name of the source account, if it is an account      |
| `to_cspr_name`                  | `string`                                                       | Primary CSPR.name of the destination account, if it is an account |

### Relations

| Entity                                              | Mapping property        | Description                                                                                        |
| --------------------------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------- |
| [`Contract package`](/rest-api/contract-package)    | `contract_package_hash` | Fungible tokens actions belong to a contract package                                               |
| [`Account`](/rest-api/account)                      | `from_hash, to_hash`    | Fungible token actions could have accounts as the action source and target                         |
| [`Deploy`](/rest-api/deploy)                        | `deploy_hash`           | FT actions are result of deploy execution                                                          |
| [`FTOwnership`](/rest-api/fungible-token-ownership) | `from_hash, to_hash`    | Fungible token actions affect fungible token ownership by changing token balances between accounts |

### Endpoints

The `FTTokenAction` entity has the following endpoints:

* [Get fungible token actions](/rest-api/fungible-token-action/get-token-actions)
* [Get contract package fungible token actions](/rest-api/fungible-token-action/get-contract-package-token-actions)
* [Get account fungible token actions](/rest-api/fungible-token-action/get-account-token-actions)

### Relation endpoints

The `FTTokenAction` entity has the following relation endpoints:

* [Get fungible token action types](/rest-api/fungible-token-action/get-token-action-types)


# Get fungible token actions

Get fungible token actions

```
GET /ft-token-actions
```

## Query params

| Property                | Description                                   |
| ----------------------- | --------------------------------------------- |
| `contract_package_hash` | Filter token actions by contract package hash |
| `owner_hash`            | Filter token actions by owner hash            |
| `account_hash`          | Deprecated alias for `owner_hash`             |
| `from_block_height`     | From block height range                       |
| `to_block_height`       | To block height range                         |

## Sorting

| Property    | Description                              |
| ----------- | ---------------------------------------- |
| `timestamp` | Sort fungible token actions by timestamp |

Default sorting is `timestamp DESC`

## Optional properties

| Property                        | Type                                                           | Description                                                                          |
| ------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| `contract_package`              | [`ContractPackage`](/rest-api/contract-package)                | Fungible contract package                                                            |
| `deploy`                        | [`Deploy`](/rest-api/deploy)                                   | Deploy in which the token action occurred                                            |
| `from_public_key`               | `string(68)`                                                   | Action source public key if it's an account                                          |
| `to_public_key`                 | `string(68)`                                                   | Action target public key if it's an account                                          |
| `to_account_info`               | [`AccountInfo`](/rest-api/account-info)                        | Action source account info if it's an account                                        |
| `to_centralized_account_info`   | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Action target centralized account info if it's an account                            |
| `from_account_info`             | [`AccountInfo`](/rest-api/account-info)                        | Action target account info if it's an account                                        |
| `from_centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Action target centralized account info if it's an account                            |
| `rate`                          | `float32`                                                      | CSPR rate for specified currency that was relevant at the moment of deploy creation. |
| `from_cspr_name`                | `string`                                                       | Primary CSPR.name of the source account, if it is an account                         |
| `to_cspr_name`                  | `string`                                                       | Primary CSPR.name of the destination account, if it is an account                    |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<FTTokenAction>`](/rest-api/fungible-token-action)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/ft-token-actions?owner_hash=B6C26649540C59DECBC53274A67336D0588F6AD2AE0863A8A636DDDCC75689F0' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "amount": "24928248069",
      "contract_package_hash": "0885c63f5f25ec5b6f3b57338fae5849aea5f1a2c96fc61411f2bfc5e432de5a",
      "deploy_hash": "0005f1e53afa9799a66a389a90caab84ab3cbd000ab7741e55e09f80c75002b6",
      "block_height": 1475677,
      "from_hash": null,
      "from_type": 1,
      "ft_action_type_id": 1,
      "timestamp": "2023-02-09T19:16:21Z",
      "to_hash": "b6c26649540c59decbc53274a67336d0588f6ad2ae0863a8a636dddcc75689f0",
      "to_type": 1,
      "transform_idx": 92
    },
    {
      "amount": "24928248069",
      "contract_package_hash": "0885c63f5f25ec5b6f3b57338fae5849aea5f1a2c96fc61411f2bfc5e432de5a",
      "deploy_hash": "0005f1e53afa9799a66a389a90caab84ab3cbd000ab7741e55e09f80c75002b6",
      "block_height": 1475677,
      "from_hash": "b6c26649540c59decbc53274a67336d0588f6ad2ae0863a8a636dddcc75689f0",
      "from_type": 1,
      "ft_action_type_id": 2,
      "timestamp": "2023-02-09T19:16:21Z",
      "to_hash": "a5a9a804a383f3b0e131c85d471542af2c6d4ec57bab39182ba93dd7bd86f46c",
      "to_type": 1,
      "transform_idx": 104
    },
    ...
    {
      "amount": "22894649700",
      "contract_package_hash": "0885c63f5f25ec5b6f3b57338fae5849aea5f1a2c96fc61411f2bfc5e432de5a",
      "deploy_hash": "00194e8c2076ae84447a8ccabf39ad1eb1a090ab4e592989fd497961fb0b7293",
      "block_height": 1461592,
      "from_hash": "b6c26649540c59decbc53274a67336d0588f6ad2ae0863a8a636dddcc75689f0",
      "from_type": 1,
      "ft_action_type_id": 4,
      "timestamp": "2023-02-04T10:52:19Z",
      "to_hash": null,
      "to_type": 1,
      "transform_idx": 147
    }
  ],
  "item_count": 97704,
  "page_count": 9771
}
```


# Get fungible token action types

Get a list of fungible token action types

```
GET /ft-token-action-types
```

## Query params

None

## Sorting

None

## Optional properties

None

## Response

List of value objects describing the available fungible token action types

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/ft-token-action-types' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "id": 1,
      "name": "Mint"
    },
    {
      "id": 2,
      "name": "Transfer"
    },
    {
      "id": 3,
      "name": "Approve"
    },
    {
      "id": 4,
      "name": "Burn"
    }
  ]
}
```


# Get account fungible token actions

Get account fungible token actions by identifier (public key or account hash)

```
GET /accounts/{account_identifier}/ft-token-actions
```

## Query params

| Property            | Description                           |
| ------------------- | ------------------------------------- |
| `from_block_height` | From block height range               |
| `to_block_height`   | To block height range                 |
| `deploy_hash`       | Comma-separated list of deploy hashes |

## Sorting

| Property    | Description                              |
| ----------- | ---------------------------------------- |
| `timestamp` | Sort fungible token actions by timestamp |

Default sorting is `timestamp DESC`

## Optional properties

| Property                        | Type                                                           | Description                                                                          |
| ------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| `contract_package`              | [`ContractPackage`](/rest-api/contract-package)                | Fungible contract package                                                            |
| `deploy`                        | [`Deploy`](/rest-api/deploy)                                   | Deploy in which the token action occurred                                            |
| `from_public_key`               | `string(68)`                                                   | Action source public key if it's an account                                          |
| `to_public_key`                 | `string(68)`                                                   | Action target public key if it's an account                                          |
| `to_account_info`               | [`AccountInfo`](/rest-api/account-info)                        | Action source account info if it's an account                                        |
| `to_centralized_account_info`   | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Action target centralized account info if it's an account                            |
| `from_account_info`             | [`AccountInfo`](/rest-api/account-info)                        | Action target account info if it's an account                                        |
| `from_centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Action target centralized account info if it's an account                            |
| `rate`                          | `float32`                                                      | CSPR rate for specified currency that was relevant at the moment of deploy creation. |
| `from_cspr_name`                | `string`                                                       | Primary CSPR.name of the action source account, if it is an account                  |
| `to_cspr_name`                  | `string`                                                       | Primary CSPR.name of the destination account, if it is an account                    |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<FTTokenAction>`](/rest-api/fungible-token-action)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/B6C26649540C59DECBC53274A67336D0588F6AD2AE0863A8A636DDDCC75689F0/ft-token-actions' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "amount": "24928248069",
      "contract_package_hash": "0885c63f5f25ec5b6f3b57338fae5849aea5f1a2c96fc61411f2bfc5e432de5a",
      "deploy_hash": "0005f1e53afa9799a66a389a90caab84ab3cbd000ab7741e55e09f80c75002b6",
      "block_height": 1475677,
      "from_hash": null,
      "from_type": 1,
      "ft_action_type_id": 1,
      "timestamp": "2023-02-09T19:16:21Z",
      "to_hash": "b6c26649540c59decbc53274a67336d0588f6ad2ae0863a8a636dddcc75689f0",
      "to_type": 1,
      "transform_idx": 92
    },
    {
      "amount": "24928248069",
      "contract_package_hash": "0885c63f5f25ec5b6f3b57338fae5849aea5f1a2c96fc61411f2bfc5e432de5a",
      "deploy_hash": "0005f1e53afa9799a66a389a90caab84ab3cbd000ab7741e55e09f80c75002b6",
      "block_height": 1475677,
      "from_hash": "b6c26649540c59decbc53274a67336d0588f6ad2ae0863a8a636dddcc75689f0",
      "from_type": 1,
      "ft_action_type_id": 2,
      "timestamp": "2023-02-09T19:16:21Z",
      "to_hash": "a5a9a804a383f3b0e131c85d471542af2c6d4ec57bab39182ba93dd7bd86f46c",
      "to_type": 1,
      "transform_idx": 104
    },
    ...
    {
      "amount": "22894649700",
      "contract_package_hash": "0885c63f5f25ec5b6f3b57338fae5849aea5f1a2c96fc61411f2bfc5e432de5a",
      "deploy_hash": "00194e8c2076ae84447a8ccabf39ad1eb1a090ab4e592989fd497961fb0b7293",
      "block_height": 1461592,
      "from_hash": "b6c26649540c59decbc53274a67336d0588f6ad2ae0863a8a636dddcc75689f0",
      "from_type": 1,
      "ft_action_type_id": 4,
      "timestamp": "2023-02-04T10:52:19Z",
      "to_hash": null,
      "to_type": 1,
      "transform_idx": 147
    }
  ],
  "item_count": 97704,
  "page_count": 9771
}
```


# Get contract package fungible token actions

Get contract package fungible token actions by contract package hash

```
GET /contract-packages/{contract_package_hash}/ft-token-actions
```

## Query params

| Property            | Description                           |
| ------------------- | ------------------------------------- |
| `from_block_height` | From block height range               |
| `to_block_height`   | To block height range                 |
| `deploy_hash`       | Comma-separated list of deploy hashes |

## Sorting

| Property    | Description                              |
| ----------- | ---------------------------------------- |
| `timestamp` | Sort fungible token actions by timestamp |

Default sorting is `timestamp DESC`

## Optional properties

| Property                        | Type                                                           | Description                                                                          |
| ------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| `contract_package`              | [`ContractPackage`](/rest-api/contract-package)                | Fungible contract package                                                            |
| `deploy`                        | [`Deploy`](/rest-api/deploy)                                   | Deploy in which the token action occurred                                            |
| `from_public_key`               | `string(68)`                                                   | Action source public key if it's an account                                          |
| `to_public_key`                 | `string(68)`                                                   | Action target public key if it's an account                                          |
| `to_account_info`               | [`AccountInfo`](/rest-api/account-info)                        | Action source account info if it's an account                                        |
| `from_account_info`             | [`AccountInfo`](/rest-api/account-info)                        | Action target account info if it's an account                                        |
| `to_centralized_account_info`   | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Action target centralized account info if it's an account                            |
| `from_centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Action target centralized account info if it's an account                            |
| `rate`                          | `float32`                                                      | CSPR rate for specified currency that was relevant at the moment of deploy creation. |
| `from_cspr_name`                | `string`                                                       | Primary CSPR.name of the source account, if it is an account                         |
| `to_cspr_name`                  | `string`                                                       | Primary CSPR.name of the destination account, if it is an account                    |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<FTTokenAction>`](/rest-api/fungible-token-action)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contract-packages/0885c63f5f25ec5b6f3b57338fae5849aea5f1a2c96fc61411f2bfc5e432de5a/ft-token-actions' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "amount": "10000000000",
      "contract_package_hash": "0885c63f5f25ec5b6f3b57338fae5849aea5f1a2c96fc61411f2bfc5e432de5a",
      "deploy_hash": "22930a6a3b568ab2c7ed296072181c21a2a3b990998f5898fbc24acf7eec3d66",
      "block_height": 1382964,
      "from_hash": "24a56544c522eca7fba93fb7a6cef83e086706fd87b2f344f5c3dad3603d11f1",
      "from_type": 1,
      "ft_action_type_id": 3,
      "timestamp": "2023-01-05T13:39:09Z",
      "to_hash": "70417ab18bc39062176682e691afdaaf3691fde83e0e6afe77e4982c037b6796",
      "to_type": 1,
      "transform_idx": 13
    },
    {
      "amount": "10000000000",
      "contract_package_hash": "0885c63f5f25ec5b6f3b57338fae5849aea5f1a2c96fc61411f2bfc5e432de5a",
      "deploy_hash": "76518989d5ff8301ab53f1cc917dec29d6485ea8c7dedd99081956a5cb5b8717",
      "block_height": 1385600,
      "from_hash": "24a56544c522eca7fba93fb7a6cef83e086706fd87b2f344f5c3dad3603d11f1",
      "from_type": 0,
      "ft_action_type_id": 3,
      "timestamp": "2023-01-06T13:41:20Z",
      "to_hash": "b6c26649540c59decbc53274a67336d0588f6ad2ae0863a8a636dddcc75689f0",
      "to_type": 1,
      "transform_idx": 13
    },
    ...
    {
      "amount": "1999999999",
      "contract_package_hash": "0885c63f5f25ec5b6f3b57338fae5849aea5f1a2c96fc61411f2bfc5e432de5a",
      "deploy_hash": "01531f387d5d711c332adc15be7ff23ba55033a93c591204af9a6e36ec1c3e0f",
      "block_height": 1401132,
      "from_hash": null,
      "from_type": 1,
      "ft_action_type_id": 1,
      "timestamp": "2023-01-12T11:21:58Z",
      "to_hash": "b6c26649540c59decbc53274a67336d0588f6ad2ae0863a8a636dddcc75689f0",
      "to_type": 1,
      "transform_idx": 92
    }
  ],
  "item_count": 97704,
  "page_count": 9771
}
```


# Fungible token ownership

The `FTOwnership` entity represents a fungible token ownership relation between accounts and contract packages, as well as provides the corresponding token balances

### Properties

The `FTOwnership` entity has the following properties:

| Property                | Type         | Description                                                                                                   |
| ----------------------- | ------------ | ------------------------------------------------------------------------------------------------------------- |
| `owner_hash`            | `string(64)` | Owner hash represented as a hexadecimal string. First part of token ownership identifier                      |
| `contract_package_hash` | `string(64)` | Fungible contract package hash represented as a hexadecimal string. Second part of token ownership identifier |
| `owner_type`            | `uint8`      | Owber hash type: `0` for account, `1` for contract                                                            |
| `balance`               | `string`     | Fungible tokens balance in the network                                                                        |

**Example**

```json
{
  "balance": "99999999999999999000",
  "contract_package_hash": "0e6a10012d734417ef6ff74e4a7881ad75bcbb3c455ccd63a677f7dd55f1f203",
  "owner_hash": "d0bc9ca1353597c4004b8f881b397a89c1779004f5e547e04b57c2e7967c6269",
  "owner_type": 0
}
```

## Optional properties

Depending on the endpoint some of the following optional properties may be included in the `FTOwnership` entity:

| Property                   | Type                                                           | Description                         |
| -------------------------- | -------------------------------------------------------------- | ----------------------------------- |
| `contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | Fungible contract package           |
| `owner_public_key`         | `string(68)`                                                   | Owner public key if it's an account |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | Owner account info                  |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Owner centralized account info      |
| `owner_cspr_name`          | `string`                                                       | Owner account CSPR.name             |

### Relations

| Entity                                           | Mapping property        | Description                                                                                                                                      |
| ------------------------------------------------ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| [`Contract package`](/rest-api/contract-package) | `contract_package_hash` | Fungible token ownership represents fungible contract package token owners                                                                       |
| [`Account`](/rest-api/account)                   | `owner_hash`            | Account can be a token owner                                                                                                                     |
| [`Deploy`](/rest-api/deploy)                     |                         | Deploy can update fungible token ownership by creating or transferring FT tokens. There is no direct mapping, but rather a semantic relationship |

### Endpoints

The `FTOwnership` entity has the following endpoints:

* [Get contract package fungible token ownerships](/rest-api/fungible-token-ownership/get-contract-package-fungible-token-ownership)
* [Get account fungible token ownerships](/rest-api/fungible-token-ownership/get-account-fungible-token-ownership)
* [Get fungible token ownerships](/rest-api/fungible-token-ownership/get-fungible-token-ownerships)

### Relation endpoints

None


# Get account fungible token ownership

Get accounts fungible token ownership by identifier (public key or account hash)

```
GET /accounts/{account_identifier}/ft-token-ownership
```

## Query params

None

## Sorting

| Property  | Description                |
| --------- | -------------------------- |
| `balance` | Sort ownerships by balance |

## Optional properties

| Property                   | Type                                                           | Description                    |
| -------------------------- | -------------------------------------------------------------- | ------------------------------ |
| `contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | Fungible contract package      |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | Owner account info             |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Owner centralized account info |
| `owner_cspr_name`          | `string`                                                       | Owner account CSPR.name        |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<FTOwnership>`](/rest-api/fungible-token-ownership)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/accounts/d0bc9ca1353597c4004b8f881b397a89c1779004f5e547e04b57c2e7967c6269/ft-token-ownership' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "balance": "999992019999999999690000000",
      "contract_package_hash": "000f00b1c6b691b47c1006730bd39812c598f4660e2420a5f5e2f9106865fed1",
      "owner_hash": "d0bc9ca1353597c4004b8f881b397a89c1779004f5e547e04b57c2e7967c6269",
      "owner_type": 0
    },
    {
      "balance": "99999999999999999000",
      "contract_package_hash": "018c20d50c52518b6d9c0390b1d2298e3638507d8fe9694d44b89b6af23c703d",
      "owner_hash": "d0bc9ca1353597c4004b8f881b397a89c1779004f5e547e04b57c2e7967c6269",
      "owner_type": 0
    },
    ...
    {
      "balance": "1000000000000000000000000000018415616000000000000000000",
      "contract_package_hash": "155e3d29b6eea4df9e2159c5e91cf325b94c3460224ea3c789dd70772a9048d6",
      "owner_hash": "d0bc9ca1353597c4004b8f881b397a89c1779004f5e547e04b57c2e7967c6269",
      "owner_type": 0
    }
  ],
  "item_count": 176,
  "page_count": 18
}
```


# Get contract package fungible token ownership

Get contract package fungible token ownership

```
GET /contract-packages/{contract_package_hash}/ft-token-ownership
```

## Query params

None

## Sorting

| Property  | Description                |
| --------- | -------------------------- |
| `balance` | Sort ownerships by balance |

## Optional properties

| Property                   | Type                                                           | Description                    |
| -------------------------- | -------------------------------------------------------------- | ------------------------------ |
| `contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | Fungible contract package      |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | Owner account info             |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Owner centralized account info |
| `owner_cspr_name`          | `string`                                                       | Owner account CSPR.name        |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<FTOwnership>`](/rest-api/fungible-token-ownership)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contract-packages/000f00b1c6b691b47c1006730bd39812c598f4660e2420a5f5e2f9106865fed1/ft-token-ownership' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "balance": "999992019999999999690000000",
      "contract_package_hash": "000f00b1c6b691b47c1006730bd39812c598f4660e2420a5f5e2f9106865fed1",
      "owner_hash": "d0bc9ca1353597c4004b8f881b397a89c1779004f5e547e04b57c2e7967c6269",
      "owner_type": 0
    }
  ],
  "item_count": 1,
  "page_count": 1
}
```


# Get fungible token ownerships

Get fungible token ownerships by owner hash and optional owner type

```
GET /ft-token-ownerships
```

## Query params

| Property                | Type       | Description                             |
| ----------------------- | ---------- | --------------------------------------- |
| `owner_hash`            | `string`   | Hexadecimal account/hash value          |
| `owner_type`            | `uint`     | Owner type identifier                   |
| `contract_package_hash` | `[]string` | Comma-separated contract package hashes |

## Sorting

| Property  | Description                |
| --------- | -------------------------- |
| `balance` | Sort ownerships by balance |

## Optional properties

| Property                   | Type                                                           | Description                    |
| -------------------------- | -------------------------------------------------------------- | ------------------------------ |
| `contract_package`         | [`ContractPackage`](/rest-api/contract-package)                | Fungible contract package      |
| `account_info`             | [`AccountInfo`](/rest-api/account-info)                        | Owner account info             |
| `centralized_account_info` | [`CentralizedAccountInfo`](/rest-api/centralized-account-info) | Owner centralized account info |
| `owner_cspr_name`          | `string`                                                       | Owner account CSPR.name        |

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<FTOwnership>`](/rest-api/fungible-token-ownership)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/ft-token-ownerships?owner_hash=d0bc9ca1353597c4004b8f881b397a89c1779004f5e547e04b57c2e7967c6269' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "balance": "999992019999999999690000000",
      "contract_package_hash": "000f00b1c6b691b47c1006730bd39812c598f4660e2420a5f5e2f9106865fed1",
      "owner_hash": "d0bc9ca1353597c4004b8f881b397a89c1779004f5e547e04b57c2e7967c6269",
      "owner_type": 0
    },
    {
      "balance": "99999999999999999000",
      "contract_package_hash": "018c20d50c52518b6d9c0390b1d2298e3638507d8fe9694d44b89b6af23c703d",
      "owner_hash": "d0bc9ca1353597c4004b8f881b397a89c1779004f5e547e04b57c2e7967c6269",
      "owner_type": 0
    }
  ],
  "item_count": 176,
  "page_count": 18
}
```


# Fungible token rate

`FTRate` entity represents rates for fungible tokens traded on the Casper Network tracked in various [currencies](/rest-api/currency) .

### Properties

The `FTRate` entity has the following properties:

| Property                      | Type      | Description                                                                            |
| ----------------------------- | --------- | -------------------------------------------------------------------------------------- |
| `token_contract_package_hash` | `string`  | Fungible token contract package hash                                                   |
| `currency_id`                 | `uint16`  | [Currency](/rest-api/currency) identifier                                              |
| `amount`                      | `float64` | Rate amount in the specified currency                                                  |
| `volume`                      | `string`  | The swap volume the rate was calculated on                                             |
| `dex_id`                      | `uint16`  | [DEX](/rest-api/dex) identifier                                                        |
| `transaction_hash`            | `string`  | [Deploy](/rest-api/deploy) hash associated with this rate                              |
| `timestamp`                   | `string`  | Transaction timestamp in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format |

**Example**

```json
{
  "amount": "0.25",
  "volume": "1234.567",
  "transaction_hash": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6",
  "token_contract_package_hash": "b1c2d3e4f5g6h7i8j9k0l1m2n3o4p5q6r7s8t9u0v1w2x3y4z5a6",
  "dex_id": 2,
  "currency_id": 1,
  "timestamp": "2024-01-05T12:51:00Z"
}
```

### Optional properties

None

### Relations

The `FTRate` entity has the following relations with other entities:

| Entity                                          | Mapping property              | Description                                                          |
| ----------------------------------------------- | ----------------------------- | -------------------------------------------------------------------- |
| [`ContractPackage`](/rest-api/contract-package) | `token_contract_package_hash` | Rates are tracked for fungible token contracts                       |
| [`Currency`](/rest-api/currency)                | `currency_id`                 | Rates are calculated for different currencies                        |
| [`Deploy`](/rest-api/deploy)                    | `transaction_hash`            | Rates are calculated based on transactions (deploys) on Casper DEXes |
| [`DEX`](/rest-api/dex)                          | `dex_id`                      | Rates are calculated separately for different Casper DEXes           |

## Endpoints

The fungible token fiat rate endpoints are:

* [Get the latest fungible token contract rate](/rest-api/fungible-token-rate/get-latest-token-contract-rate)
* [Get historical fungible token contract rates](/rest-api/fungible-token-rate/get-token-contract-rates)


# Get the latest fungible token contract rate

Get the latest rate for a fungible token by its contract package hash.

```
GET /ft/{contract_package_hash}/rates/latest
```

## Query params

| Query param   | Description                                          |
| ------------- | ---------------------------------------------------- |
| `currency_id` | [Currency](/rest-api/currency) identifier (required) |
| `dex_id`      | [DEX](/rest-api/dex) identifier                      |

## Sorting

None

## Optional properties

None

## Response

[`FTRate`](/rest-api/fungible-token-rate)

## Example

```bash
curl -X 'GET' \
  'https://api.cspr.cloud/ft/F5E3729B502597FDD7BE9ECEDB6F73E4530F5E8A4C809F269D757677CBE49B78/rates/latest?currency_id=1' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "amount": "0.00012126881",
    "transaction_hash": "3124a6f8b33bde9754e37bfb87b5104aaad96678fcb5a6389614860bc41d657d",
    "token_contract_package_hash": "f5e3729b502597fdd7be9ecedb6f73e4530f5e8a4c809f269d757677cbe49b78",
    "dex_id": 2,
    "currency_id": 1,
    "timestamp": "2025-11-12T09:47:18Z"
  }
}
```


# Get historical fungible token contract rates

Get a paginated list of historical rates for a fungible token within the given time range by its contract package hash.

```
GET /ft/{contract_package_hash}/rates
```

## Query params

| Query param   | Description                                                                         |
| ------------- | ----------------------------------------------------------------------------------- |
| `currency_id` | [Currency](/rest-api/currency) identifier (required)                                |
| `dex_id`      | [DEX](/rest-api/dex) identifier                                                     |
| `from`        | Start of the range in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format |
| `to`          | End of the range in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format   |

## Sorting

| Property    | Description             |
| ----------- | ----------------------- |
| `timestamp` | Sort rates by timestamp |

Default sorting is `timestamp DESC`

## Optional properties

None

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<FTRate>`](/rest-api/fungible-token-rate)

## Example

```bash
curl -X 'GET' \
  'https://api.cspr.cloud/ft/F5E3729B502597FDD7BE9ECEDB6F73E4530F5E8A4C809F269D757677CBE49B78/rates?currency_id=1' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "amount": "0.00012126881",
      "transaction_hash": "3124a6f8b33bde9754e37bfb87b5104aaad96678fcb5a6389614860bc41d657d",
      "token_contract_package_hash": "f5e3729b502597fdd7be9ecedb6f73e4530f5e8a4c809f269d757677cbe49b78",
      "dex_id": 2,
      "currency_id": 1,
      "timestamp": "2025-11-12T09:47:18Z"
    },
    {
      "amount": "0.000116637406",
      "transaction_hash": "940ab4be6bb0536a7f88378121a0b78fe9646be66be24265a45c5714558f5989",
      "token_contract_package_hash": "f5e3729b502597fdd7be9ecedb6f73e4530f5e8a4c809f269d757677cbe49b78",
      "dex_id": 2,
      "currency_id": 1,
      "timestamp": "2025-11-12T09:46:48Z"
    },
    ...
    {
      "amount": "0.000082911945",
      "transaction_hash": "757ac982f71b2fb709bdc01bdcefbc3ef28b20a7a1a2f12de0ed9d8e9be62d4f",
      "token_contract_package_hash": "f5e3729b502597fdd7be9ecedb6f73e4530f5e8a4c809f269d757677cbe49b78",
      "dex_id": 2,
      "currency_id": 1,
      "timestamp": "2025-11-12T09:43:09Z"
    }
  ],
  "item_count": 1971,
  "page_count": 198
}
```


# Fungible token daily rate

`FTDailyRate` entity represents daily average rates for fungible tokens traded on the Casper Network tracked in various [currencies](/rest-api/currency) .

### Properties

The `FTDailyRate` entity has the following properties:

| Property                      | Type       | Description                                                           |
| ----------------------------- | ---------- | --------------------------------------------------------------------- |
| `token_contract_package_hash` | `string`   | Fungible token contract package hash                                  |
| `currency_id`                 | `uint16`   | [Currency](/rest-api/currency) identifier                             |
| `amount`                      | `float64`  | Volume-weighted average daily rate amount in the specified currency   |
| `volume`                      | `string`   | The total swap volume used to compute the daily rate                  |
| `dex_ids`                     | `[]uint16` | DEX identifiers used in the aggregation                               |
| `date`                        | `string`   | Date in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format |

**Example**

```json
{
  "amount": "0.25",
  "volume": "1234567890000000000",
  "token_contract_package_hash": "b1c2d3e4f5g6h7i8j9k0l1m2n3o4p5q6r7s8t9u0v1w2x3y4z5a6",
  "dex_ids": [2, 4],
  "currency_id": 1,
  "date": "2024-01-05T00:00:00Z"
}
```

### Optional properties

None

### Relations

The `FTDailyRate` entity has the following relations with other entities:

| Entity                                          | Mapping property              | Description                                         |
| ----------------------------------------------- | ----------------------------- | --------------------------------------------------- |
| [`ContractPackage`](/rest-api/contract-package) | `token_contract_package_hash` | Rates are tracked for fungible token contracts      |
| [`Currency`](/rest-api/currency)                | `currency_id`                 | Rates are calculated for different currencies       |
| [`DEX`](/rest-api/dex)                          | `dex_ids`                     | Rates aggregate trades across relevant Casper DEXes |

## Endpoints

The fungible token fiat rate endpoints are:

* [Get the latest daily fungible token contract rate](/rest-api/fungible-token-daily-rate/get-latest-daily-token-contract-rate)
* [Get historical daily fungible token contract rates](/rest-api/fungible-token-daily-rate/get-daily-token-contract-rates)


# Get the latest fungible token contract rate

Get the latest daily rate for a fungible token by its contract package hash.

```
GET /ft/{contract_package_hash}/daily-rates/latest
```

## Query params

| Query param   | Description                                          |
| ------------- | ---------------------------------------------------- |
| `currency_id` | [Currency](/rest-api/currency) identifier (required) |
| `dex_id`      | [DEX](/rest-api/dex) identifier                      |

## Sorting

None

## Optional properties

None

## Response

[`FTDailyRate`](/rest-api/fungible-token-daily-rate)

## Example

```bash
curl -X 'GET' \
  'https://api.cspr.cloud/ft/F5E3729B502597FDD7BE9ECEDB6F73E4530F5E8A4C809F269D757677CBE49B78/daily-rates/latest?currency_id=1' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "date": "2025-11-12T00:00:00Z",
    "amount": "0.00005880702226729934",
    "token_contract_package_hash": "f5e3729b502597fdd7be9ecedb6f73e4530f5e8a4c809f269d757677cbe49b78",
    "dex_ids": [
      2
    ],
    "currency_id": 1
  }
}
```


# Get historical fungible token contract rates

Get a paginated list of historical daily rates for a fungible token within the given time range by its contract package hash.

```
GET /ft/{contract_package_hash}/daily-rates
```

## Query params

| Query param   | Description                                                                         |
| ------------- | ----------------------------------------------------------------------------------- |
| `currency_id` | [Currency](/rest-api/currency) identifier (required)                                |
| `dex_id`      | [DEX](/rest-api/dex) identifier                                                     |
| `from`        | Start of the range in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format |
| `to`          | End of the range in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format   |

## Sorting

| Property | Description        |
| -------- | ------------------ |
| `date`   | Sort rates by date |

Default sorting is `date DESC`

## Optional properties

None

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<FTDailyRate>`](/rest-api/fungible-token-daily-rate)

## Example

```bash
curl -X 'GET' \
  'https://api.cspr.cloud/ft/F5E3729B502597FDD7BE9ECEDB6F73E4530F5E8A4C809F269D757677CBE49B78/daily-rates?currency_id=1' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "date": "2025-11-12T00:00:00Z",
      "amount": "0.00005880702226729934",
      "token_contract_package_hash": "f5e3729b502597fdd7be9ecedb6f73e4530f5e8a4c809f269d757677cbe49b78",
      "dex_ids": [
        2
      ],
      "currency_id": 1
    },
    {
      "date": "2025-11-10T00:00:00Z",
      "amount": "0.00003157395985908806",
      "token_contract_package_hash": "f5e3729b502597fdd7be9ecedb6f73e4530f5e8a4c809f269d757677cbe49b78",
      "dex_ids": [
        2
      ],
      "currency_id": 1
    },
    ...
    {
      "date": "2025-10-21T00:00:00Z",
      "amount": "0.000386411469662562",
      "token_contract_package_hash": "f5e3729b502597fdd7be9ecedb6f73e4530f5e8a4c809f269d757677cbe49b78",
      "dex_ids": [
        2
      ],
      "currency_id": 1
    }
  ],
  "item_count": 217,
  "page_count": 22
}
```


# Fungible token DEX rate

`DexRate` entity represents rates for fungible token pairs traded on Casper DEXes.

### Properties

The `DexRate` entity has the following properties:

| Property                             | Type      | Description                                                                            |
| ------------------------------------ | --------- | -------------------------------------------------------------------------------------- |
| `token_contract_package_hash`        | `string`  | Source fungible token contract package hash                                            |
| `target_token_contract_package_hash` | `string`  | Target fungible token contract package hash                                            |
| `amount`                             | `float64` | Rate amount expressed in the target token                                              |
| `volume`                             | `string`  | The swap volume the rate was calculated on                                             |
| `dex_id`                             | `uint16`  | [DEX](/rest-api/dex) identifier                                                        |
| `transaction_hash`                   | `string`  | [Deploy](/rest-api/deploy) hash associated with this rate                              |
| `timestamp`                          | `string`  | Transaction timestamp in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format |

`volume` is normalized using token decimals. For example, if the on-chain amount is `123450000` and token decimals are `6`, the normalized value is `123.45`.

**Example**

```json
{
  "amount": "0.0025",
  "volume": "1234.567",
  "transaction_hash": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6",
  "token_contract_package_hash": "b1c2d3e4f5g6h7i8j9k0l1m2n3o4p5q6r7s8t9u0v1w2x3y4z5a6",
  "target_token_contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
  "dex_id": 1,
  "timestamp": "2024-02-01T10:00:00Z"
}
```

### Optional properties

None

### Relations

The `DexRate` entity has the following relations with other entities:

| Entity                                          | Mapping property                                                    | Description                                                          |
| ----------------------------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------- |
| [`ContractPackage`](/rest-api/contract-package) | `token_contract_package_hash`, `target_token_contract_package_hash` | Rates are tracked for fungible token pairs                           |
| [`Deploy`](/rest-api/deploy)                    | `transaction_hash`                                                  | Rates are calculated based on transactions (deploys) on Casper DEXes |
| [`DEX`](/rest-api/dex)                          | `dex_id`                                                            | Rates are calculated separately for different Casper DEXes           |

## Endpoints

The fungible token DEX rate endpoints are:

* [Get the latest fungible token DEX rate](/rest-api/fungible-token-dex-rate/get-latest-token-dex-rate)
* [Get historical fungible token DEX rates](/rest-api/fungible-token-dex-rate/get-token-dex-rates)


# Get the latest fungible token DEX rate

Get the latest DEX rate for a fungible token pair using the source token contract package hash and target token contract package hash.

```
GET /ft/{contract_package_hash}/dex-rates/latest
```

## Query params

| Query param                    | Description                                                  |
| ------------------------------ | ------------------------------------------------------------ |
| `target_contract_package_hash` | Target token contract package hash for conversion (required) |
| `dex_id`                       | [DEX](/rest-api/dex) identifier                              |

## Sorting

None

## Optional properties

None

## Response

[`DexRate`](/rest-api/fungible-token-dex-rate)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/ft/0f6b7e1a8d6e4f1b5a2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef12/dex-rates/latest?target_contract_package_hash=ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495&dex_id=1' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": {
    "amount": "0.0025",
    "volume": "1234.567",
    "token_contract_package_hash": "0f6b7e1a8d6e4f1b5a2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef12",
    "target_token_contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
    "transaction_hash": "9c1b7f2a5d6e4f1b2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef1234",
    "dex_id": 1,
    "timestamp": "2024-02-01T10:00:00Z"
  }
}
```


# Get historical fungible token DEX rates

Get a paginated list of historical DEX rates for a fungible token pair using the source token contract package hash and target token contract package hash.

```
GET /ft/{contract_package_hash}/dex-rates
```

## Query params

| Query param                    | Description                                                                         |
| ------------------------------ | ----------------------------------------------------------------------------------- |
| `target_contract_package_hash` | Target token contract package hash for conversion (required)                        |
| `dex_id`                       | [DEX](/rest-api/dex) identifier                                                     |
| `from`                         | Start of the range in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format |
| `to`                           | End of the range in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format   |

## Sorting

| Property    | Description             |
| ----------- | ----------------------- |
| `timestamp` | Sort rates by timestamp |

Default sorting is `timestamp DESC`

## Optional properties

None

## Response

[`PaginatedResponse`](/documentation/overview/pagination)[`<DexRate>`](/rest-api/fungible-token-dex-rate)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/ft/0f6b7e1a8d6e4f1b5a2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef12/dex-rates?target_contract_package_hash=ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495&dex_id=1' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "amount": "0.0025",
      "volume": "1234.567",
      "token_contract_package_hash": "0f6b7e1a8d6e4f1b5a2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef12",
      "target_token_contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
      "transaction_hash": "9c1b7f2a5d6e4f1b2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef1234",
      "dex_id": 1,
      "timestamp": "2024-02-01T10:00:00Z"
    }
  ],
  "item_count": 1,
  "page_count": 1
}
```




---

[Next Page](/llms-full.txt/1)

