Skip to content

Querying Your Universe

The Freeverse API is accessed via GraphQL. We recommend using a playground such as GraphQL Playground to create test queries and view the entire API documentation.

GraphQL Playground exposes all documentation for our API

Note

When you sign up for Freeverse, we will provide you with a url endpoint and universe ID with which you can access the API via GraphQL.

Your universe can be queried at any time to retrieve information about your assets. In the following examples, we will use native GraphQL to explain the queries. Please see the Quickstart guide for how to create GraphQL queries with either CURL or Javascript.

Example Queries

Get all assets

query getAllAssets($universe: Int!) {
    allAssets(condition: { universeId: $universe } ) {
        nodes {
            id
            nonce
            props
            metadata
            ownerId
        }
    }
}

Get asset by owner ID

query getAssetByOwner($owner: String!, $universe: Int!) {
    allAssets(condition: { ownerId: $owner, universeId: $universe } ) {
        nodes {
            id
            nonce
            props
            metadata
            ownerId
        }
    }
}

Get asset by asset ID

query getAssetById($id: String!, $universe: Int!) {
    allAssets(condition: { id: $id, universeId: $universe }) {
        nodes {
            id
            props
            metadata
            nonce
            ownerId      
        }
    }
}

Get all assets and associated auctions

query getAllAssets($universe: Int!) {
allAssets(condition: { universeId: $universe } ) {
    totalCount
    nodes {
        id
        props
        ownerId
        universeId
        universeByUniverseId {
            name
        }
        auctionsByAssetId(
            filter: {
                or: [
                    { state: { equalTo: STARTED } }
                    { state: { equalTo: ASSET_FROZEN } }
                    { state: { equalTo: PAYING } }
                ]
            }
            orderBy: VALID_UNTIL_DESC) {
                nodes {
                    id
                    assetId
                    sellerId
                    currencyId
                    price
                    rnd
                    validUntil
                    offerValidUntil
                    timeToPay
                    state
                    stateExtra
                    paymentUrl
                    bidsByAuctionId(orderBy: EXTRA_PRICE_DESC) {
                        nodes {
                            auctionId
                            extraPrice
                            rnd
                            buyerId
                            state
                            stateExtra
                            paymentId
                            paymentUrl
                            paymentDeadline
                        }
                    }
                }
            }
        }
    }
}