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.

Base URLs

The APIs can be accessed using the following base URLs

Mainnet

APIBase URL

CSPR.cloud REST API

CSPR.cloud Streaming API

Casper Node RPC API

Casper Node SSE API

Testnet

APIBase URL

CSPR.cloud REST API

CSPR.cloud Streaming API

Casper Node RPC API

Casper Node SSE API

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 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 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:

{
    "data": <ResponseData>
}

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

{
    "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:

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

Visit the 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 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 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 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:

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

Visit the Errors page to learn more.

Versions

This documentation covers CSPR.cloud V2. Click here for CSPR.cloud V1 documentation, which will be deprecated soon.

Last updated