POST
/
graphql
curl --request POST \
  --url https://api.copin.io/graphql \
  --header 'Content-Type: application/json' \
  --data '{
  "operationName": "<string>",
  "variables": {
    "index": "<string>",
    "body": {
      "filter": {
        "and": [
          {}
        ]
      },
      "sorts": [
        {}
      ],
      "paging": {
        "size": 123,
        "from": 123
      }
    }
  },
  "query": "<string>"
}'
{
  "data": [
    {
      "id": "<string>",
      "account": "<string>",
      "key": "<string>",
      "logId": 123,
      "openBlockNumber": 123,
      "openBlockTime": "<string>",
      "closeBlockNumber": 123,
      "closeBlockTime": "<string>",
      "indexToken": "<string>",
      "pair": "<string>",
      "size": 123,
      "fee": 123,
      "collateral": 123,
      "averagePrice": 123,
      "funding": 123,
      "pnl": 123,
      "realisedPnl": 123,
      "roi": 123,
      "realisedRoi": 123,
      "isLong": true,
      "isWin": true,
      "isLiquidate": true,
      "leverage": 123,
      "orderCount": 123,
      "orderIncreaseCount": 123,
      "orderDecreaseCount": 123,
      "durationInSecond": 123,
      "status": "<string>",
      "createdAt": "<string>",
      "protocol": "<string>"
    }
  ],
  "meta": {
    "limit": 123,
    "offset": 123,
    "total": 123,
    "totalPages": 123
  }
}

Authentication

This endpoint requires authentication using a JWT token or API-KEY in the header.

Authorization
string

JWT token in the format: Authorization {token}

x-api-key
string

Token in the format: x-api-key {api-key}

Request Query

Query name: searchTopOpeningPosition

Request Body

operationName
string
required

Name of the GraphQL operation (e.g., “Search”)

variables
object
required

Variables for the GraphQL query

query
string
required

GraphQL query string

Request Example

curl 'https://api.copin.io/graphql' \
-H 'accept: */*' \
-H 'accept-language: en-US,en;q=0.9,vi;q=0.8' \
-H 'x-api-key: u9jpUfrTAukk45QjWVg7DBtQYxdGgy' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
--data-raw $'{"operationName":"Search","variables":{"index":"copin.positions","body":{"filter":{"and":[{"field":"status","match":"OPEN"},{"field":"openBlockTime","gte":"2025-08-21T09:41:12.017Z","lte":"2025-08-28T09:41:12.017Z"}]},"sorts":[{"field":"realisedPnl","direction":"desc"}],"paging":{"size":100,"from":0}},"protocols":["JUPITER","GMX_V2"]},"query":"query Search($index: String\u0021, $protocols: [String\u0021]\u0021, $body: SearchPayload\u0021) {\\n  searchTopOpeningPosition(index: $index, protocols: $protocols, body: $body) {\\n    data {\\n      id\\n      synthetixPositionId\\n      account\\n      smartAccount\\n      protocol\\n      indexToken\\n      collateralToken\\n      key\\n      reverseIndex\\n      logId\\n      collateralInToken\\n      collateral\\n      lastCollateral\\n      size\\n      lastSizeNumber\\n      lastSize\\n      lastSizeInToken\\n      sizeInToken\\n      averagePrice\\n      fee\\n      feeInToken\\n      lastFunding\\n      funding\\n      fundingInToken\\n      pnl\\n      roi\\n      leverage\\n      orderCount\\n      orderIncreaseCount\\n      orderDecreaseCount\\n      openBlockNumber\\n      openBlockTime\\n      closeBlockNumber\\n      closeBlockTime\\n      durationInSecond\\n      isLong\\n      isWin\\n      isLiquidate\\n      status\\n      txHashes\\n      orderIds\\n      createdAt\\n      realisedPnlInToken\\n      realisedPnl\\n      realisedRoi\\n      pair\\n      __typename\\n    }\\n    meta {\\n      total\\n      limit\\n      offset\\n      totalPages\\n      __typename\\n    }\\n    __typename\\n  }\\n}"}'

Response

The response includes a data property containing the requested GraphQL data.

data
array

Array of trader positions

meta
object

Metadata about the response

Response Example

{
    "data": {
        "searchTopOpeningPosition": {
            "data": [
                {
                    "id": "68a8788260ef2b0915e0474a",
                    "synthetixPositionId": null,
                    "account": "5qeEx2qiVZPdLkE8gKBiyQFbHUopEpM62rDcViBBf2xJ",
                    "smartAccount": null,
                    "protocol": "JUPITER",
                    "indexToken": "So11111111111111111111111111111111111111112",
                    "collateralToken": null,
                    "key": "BSehcYyY5dZzjyfJZoNkiQwwpicjGsHwexkYpMwVYffL",
                    "reverseIndex": null,
                    "logId": 7,
                    "collateralInToken": null,
                    "collateral": 168796.724899,
                    "lastCollateral": 168796.724899,
                    "size": 4606107.06529,
                    "lastSizeNumber": null,
                    "lastSize": 4606107.06529,
                    "lastSizeInToken": null,
                    "sizeInToken": null,
                    "averagePrice": 184.44660103134768,
                    "fee": 14349.384182,
                    "feeInToken": null,
                    "lastFunding": null,
                    "funding": 0,
                    "fundingInToken": null,
                    "pnl": -14349.384182,
                    "roi": -8.500984951328881,
                    "leverage": 27.287893577592087,
                    "orderCount": 2,
                    "orderIncreaseCount": 2,
                    "orderDecreaseCount": 0,
                    "openBlockNumber": 361770027,
                    "openBlockTime": "2025-08-22T14:00:53.000Z",
                    "closeBlockNumber": null,
                    "closeBlockTime": null,
                    "durationInSecond": 122,
                    "isLong": true,
                    "isWin": false,
                    "isLiquidate": false,
                    "status": "OPEN",
                    "txHashes": [
                        "3Gcbk8Bv7BYtoSapYrxFee8BWGmFvBSPe3pHXdBpeK8Jjth9U5oj9N7EvB7wwvauz6fXaqL5jgrhG2fMUtzz1MyN",
                        "5BqUrxCtWpWpxM8DPDYD9AqzQH9znejVDJFwoUSKF3dbyfXdscGLGfymLDFTV15WEhLbwBGiMwUVFEGLFDCCCGtP"
                    ],
                    "orderIds": null,
                    "createdAt": "2025-08-22T14:02:41.363Z",
                    "realisedPnlInToken": null,
                    "realisedPnl": 717047.5851464574,
                    "realisedRoi": 424.79946549644546,
                    "pair": "SOL-USDT",
                    "__typename": "TopPosition"
                }
            ],
            "meta": {
                "total": 4460,
                "limit": 100,
                "offset": 0,
                "totalPages": 45,
                "__typename": "PagingOutput"
            },
            "__typename": "TopPositionSearchResponse"
        }
    }
}