> This page is for Trading.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.immix.xyz/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.immix.xyz/_mcp/server.

# List risk records

GET /risk/records

Lists each account's latest risk record, one row per account the platform has valued. It moves on a business event, a data-quality change, a leverage or NLV step, or a heartbeat — never per price tick. Ordered by `accountId`; a `view` other than `latest` is 400; a member without the surface is 503 `RISK_UNAVAILABLE`. Needs `risk:read` or any `risk` capability.

Reference: https://docs.immix.xyz/trading/api-reference/rest-api/risk/list-records

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `accountId` (integer, optional) — Only rows whose `accountId` is one of these; repeat the parameter or comma-separate, at most 100 values. A value the row cannot carry (not a positive 32-bit integer) refuses 400 `MALFORMED_REQUEST`; a value naming no row yields an empty collection.
- `sort` (string, optional, default: accountId) — Comma-separated `accountId` or `pricedAtNs`; prefix `-` for descending. Default `accountId`.
- `limit` (integer, optional) — Page size, 1-100; larger values are clamped. Without it the whole collection is served as one page.
- `cursor` (string, optional) — `nextCursor` or `prevCursor` from a previous page, sent with the same filters and the same `sort`. One that does not decode, or that came from another query, is refused 400 `INVALID_CURSOR`: drop it and fetch the first page.
- `include` (enum, optional) — `total` adds the exact number of rows matching the filters. This collection has no terminal state, so `include` takes `total` alone: `deleted` is a value off its grammar (400).
  - Allowed values: `total`
- `minGlobalSequence` (string, optional) — A position you hold — an `X-Immix-Global-Sequence` you read, or a 202's `commandGlobalSequence`: this member answers only once it has folded the platform's stream through it, waiting up to its deadline, then 503 `PROJECTION_BEHIND` with `Retry-After`. Within that stream a read is never older than what you have seen; drop your positions after an announced stream cut. A retry stating its 202's position attaches to or replays that operation while the journal holds its key, never publishing twice. Stated once: one to nineteen digits, at most 9223372036854775807; else 400 `MALFORMED_REQUEST`.

### Headers

- `X-Request-Id` (string, optional) — Your own id for the request: 8 to 128 of `[A-Za-z0-9._-]`. It becomes the request's id and is echoed on the response. A value off that grammar is replaced with a fresh id, never refused.

## Response

### 200

A page of the risk records inside the principal's org, account ascending or in the order `sort` asks — all of them unless `limit` is sent; the position it was read at rides the body and the headers.

- `asOfSeqTsNs` (string, required, nullable) — The sequencer timestamp (epoch-ns) the data is complete through; also sent as X-Immix-As-Of-Seq-Ts. Null when unknown.
- `globalSequence` (string, required) — The position as a decimal string — the last change this member had applied, orders, balance readings and algo instances included.
- `items` (list of RiskRecordRow, required)
- `nextCursor` (string, required, nullable) — Pass as `cursor` for the next page. Null on the last page.
- `prevCursor` (string, required, nullable) — Pass as `cursor` for the previous page. Null on the first page.
- `total` (integer, required, nullable) — Exact count matching the filter. Null unless `include=total`.

## Errors

### 400 List Records Risk Request Bad Request Error

The request's shape is wrong: a non-positive id, an unknown `view` or filter value, a query string that does not decode, a query parameter the operation does not take, or a cursor that does not decode or came from another query (`INVALID_CURSOR`). No position rides a refusal that consulted no state.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 401 List Records Risk Request Unauthorized Error

No bearer token, or one that does not verify.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 403 List Records Risk Request Forbidden Error

`CAPABILITY_DENIED`: a read your capabilities do not cover, or a staging route without its propose bit (`accounts:propose`). `NOT_REGISTERED`: no row or open invitation at your verified address, an unknown organisation, or an unclaimed row (an administrator admits it). `EMAIL_UNVERIFIED`: verify, then sign in again. `INVITATION_EXPIRED`: an administrator re-invites. `FORBIDDEN_PRINCIPAL`: no `org_id`, a non-ASCII ref, a disabled user, a binding with no user. `ORG_NOT_ACTIVE`: disabled, pending or deleted. Owners' 403s carry the position header and `Idempotent-Replay`.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 503 List Records Risk Request Service Unavailable Error

This member cannot serve the risk reads now: `NOT_PRIMED` — still catching up; retry shortly — `PROJECTION_BEHIND` — behind your `minGlobalSequence`; retry after `Retry-After` — or `RISK_UNAVAILABLE` — deployed without the reads the route serves (the limits, the postures or the adjustments), so a retry here changes nothing; every other route is unaffected. A limit or adjustment write can also meet the door's 503s every write can: `NOT_SERVING`, `OWNER_ABSENT`, or a command lost in transit — nothing was journaled; retry against a serving member.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

## Types

### RiskRecordRow

One account's latest risk record, as the platform last published it — keyed by `accountId`, the upsert key. The figures are the platform's valuation as of `pricedAtNs`, never re-valued on read. Every USD amount at eight decimal places; the eight leverage figures are ratios to the margin equity. A figure the platform could not evaluate is null, never 0. No version, so no `ETag` and no entity route.

- `accountId` (integer, required) — The account the record values (`GET /accounts`).
- `pricedAtNs` (string, required) — Platform time of the valuation the record states — epoch nanoseconds as a decimal string; never decreases for an account.
- `cause` (enum, required) — What moved the record: a business event (`FILL`, `BUST`, `CORRECTION`, `ATTRIBUTION`, `MANUAL_ADJUSTMENT`, `BALANCE`, `FUNDING`); a valuation, an order event or a heartbeat that crossed a publish step or moved the posture (`VALUATION`, `ORDER_EVENT`); or a change to the risk limits in force that moved the posture (`LIMIT`, `causeRef` the limit row). The value set is append-only: read an unknown value as `UNKNOWN`.
  - Allowed values: `UNKNOWN`, `FILL`, `BUST`, `CORRECTION`, `ATTRIBUTION`, `MANUAL_ADJUSTMENT`, `ORDER_EVENT`, `VALUATION`, `BALANCE`, `FUNDING`, `LIMIT`, `SNAPSHOT`, `POSITION_TRANSFER`, `FORCE_FLATTEN`, `BOOK_DELETED`
- `causeRef` (string, required) — The execution, adjustment or order behind the cause — for `LIMIT`, the limit row — int64 as a decimal string; `0` when none.
- `nlvUsd` (string, required, nullable) — money (an exact decimal string at the scale the row holds it, trailing zeros included): Net liquidation value in USD: every valued asset the account holds at its rate, plus the unrealized PnL of its derivative positions. Null when a rate the account needs is missing.
- `marginEquityUsd` (string, required, nullable) — money (an exact decimal string at the scale the row holds it, trailing zeros included): Margin equity in USD: the net liquidation value of the account's margin wallets alone — at OKX the trading account, at Bybit the unified account, at Binance the spot and USD-M wallets together (the venue margins USD-M on its own wallet, so a Binance figure also counts the spot wallet). The leverage figures divide by it and the floor guards it. Null as `nlvUsd`.
- `unrealizedPnlUsd` (string, required) — money (an exact decimal string at the scale the row holds it, trailing zeros included): Unrealized PnL in USD at the current marks and rates: derivative positions, and every non-cash holding against its cost basis.
- `realizedPnlUsd` (string, required) — money (an exact decimal string at the scale the row holds it, trailing zeros included): Cumulative realized PnL in USD, each amount converted at its own event's rate and never re-converted; gross of fees. A departure booked as a sale before the platform matched it to a transfer it records between two of the organisation's accounts is taken back out when it is matched.
- `feesUsd` (string, required) — money (an exact decimal string at the scale the row holds it, trailing zeros included): Cumulative fees in USD: each fill's fee and each approved adjustment's fee change at its own rate, and what a venue took, in the asset moved, on a transfer the platform records between two of the organisation's accounts and matches to its balance movement, at the rate of the balance that showed it.
- `fundingUsd` (string, required) — money (an exact decimal string at the scale the row holds it, trailing zeros included): Cumulative funding in USD, each payment and each funding adjustment at its own rate: positive when the payments and adjustments booked net to a credit, negative when they net to a charge. Includes payments on instruments the account holds no position in. A payment in an asset with no rate yet is left out until its first rate converts it, and the record is partial (`isPartial`) meanwhile.
- `transfersUsd` (string, required) — money (an exact decimal string at the scale the row holds it, trailing zeros included): Cumulative USD value of coins and cash that arrived or left with no fill, each at its own movement's rate — except the two ends of a transfer the platform records (`/transfers`) between two of the organisation's accounts, once it matches them to it: the coins leave the one and enter the other at what they cost, and what travels realizes nothing. An end a balance showed before the match is booked at the rate first and restated; one the platform cannot match stays at the rate.
- `grossActualNoSpot` (string, required, nullable) — A ratio to `marginEquityUsd`, as a decimal string at eight places — `0.42000000` is 0.42× the margin equity: gross leverage over derivative positions — the sum of each non-cash asset's absolute USD exposure, filled only. Null when the margin equity is zero or below, or a rate a position or resting order needs is missing — never 0. Saturates at `92233720368.54775807` when the margin equity is barely above zero — read it as at least that.
- `grossActualWithSpot` (string, required, nullable) — A ratio to `marginEquityUsd`, as a decimal string at eight places — `0.42000000` is 0.42× the margin equity: as `grossActualNoSpot`, with the non-cash holdings in the margin wallets counted too — cash, and coins in other wallets (OKX `funding`), are left out. Null when the margin equity is zero or below, or a rate a position or resting order needs is missing — never 0. Saturates at `92233720368.54775807` when the margin equity is barely above zero — read it as at least that.
- `netActualNoSpot` (string, required, nullable) — A ratio to `marginEquityUsd`, as a decimal string at eight places — `0.42000000` is 0.42× the margin equity: net leverage over derivative positions — the absolute sum of each non-cash asset's USD exposure, filled only. Null when the margin equity is zero or below, or a rate a position or resting order needs is missing — never 0. Saturates at `92233720368.54775807` when the margin equity is barely above zero — read it as at least that.
- `netActualWithSpot` (string, required, nullable) — A ratio to `marginEquityUsd`, as a decimal string at eight places — `0.42000000` is 0.42× the margin equity: as `netActualNoSpot`, with the non-cash holdings in the margin wallets counted too — cash, and coins in other wallets (OKX `funding`), are left out. Null when the margin equity is zero or below, or a rate a position or resting order needs is missing — never 0. Saturates at `92233720368.54775807` when the margin equity is barely above zero — read it as at least that.
- `grossTotalNoSpot` (string, required, nullable) — A ratio to `marginEquityUsd`, as a decimal string at eight places — `0.42000000` is 0.42× the margin equity: as `grossActualNoSpot`, with each asset's resting orders counted on the side that would grow its exposure most. Null when the margin equity is zero or below, or a rate a position or resting order needs is missing — never 0. Saturates at `92233720368.54775807` when the margin equity is barely above zero — read it as at least that.
- `grossTotalWithSpot` (string, required, nullable) — A ratio to `marginEquityUsd`, as a decimal string at eight places — `0.42000000` is 0.42× the margin equity: as `grossTotalNoSpot`, with the non-cash holdings in the margin wallets and spot orders counted too — cash, and coins in other wallets (OKX `funding`), are left out. Null when the margin equity is zero or below, or a rate a position or resting order needs is missing — never 0. Saturates at `92233720368.54775807` when the margin equity is barely above zero — read it as at least that.
- `netTotalNoSpot` (string, required, nullable) — A ratio to `marginEquityUsd`, as a decimal string at eight places — `0.42000000` is 0.42× the margin equity: as `netActualNoSpot`, with each asset's resting orders counted on the side that would grow its exposure most. Null when the margin equity is zero or below, or a rate a position or resting order needs is missing — never 0. Saturates at `92233720368.54775807` when the margin equity is barely above zero — read it as at least that.
- `netTotalWithSpot` (string, required, nullable) — A ratio to `marginEquityUsd`, as a decimal string at eight places — `0.42000000` is 0.42× the margin equity: as `netTotalNoSpot`, with the non-cash holdings in the margin wallets and spot orders counted too — cash, and coins in other wallets (OKX `funding`), are left out. Null when the margin equity is zero or below, or a rate a position or resting order needs is missing — never 0. Saturates at `92233720368.54775807` when the margin equity is barely above zero — read it as at least that.
- `isPartial` (boolean, required) — True when some input was valued on a fallback price, left unvalued or refused — the figures stand, flagged.
- `worstSource` (enum, required) — The worst price tier any figure was valued at: `PRIMARY` (current), `LKG_FRESH` and `LKG_STALE` (a last-known rate, up to 60 s and 10 min old), `MISSING`. The value set is append-only: read an unknown value as `UNKNOWN`.
  - Allowed values: `UNKNOWN`, `PRIMARY`, `LKG_FRESH`, `LKG_STALE`, `MISSING`
- `unsupportedInstruments` (integer, required) — Executions the figures refuse to value, their effect on every figure refused: one on an instrument type the figures do not value (its position row is `UNSUPPORTED`, its raw quantity kept), or one stated with no price, or a correction restating none (no row moves).
- `unmarkedPositions` (integer, required) — Positions with no fresh mark or mid, valued at cost.
- `basisResets` (integer, required) — Times a cost basis could not be re-derived and stands as set: an unwind met on a position with quantity and no cost, reset to flat; a position re-anchored at the first fill after its instrument could be valued, or its unvalued spot contracts released; a holding's fill that a bust, correction or rewind withdrew after its history had folded it; an adjustment of a holding approved after the fills it reaches back past were let go; and an arrival of a recorded transfer between two of the organisation's accounts that had left the holding's history when its cost moved.
- `unmatchedCorrections` (integer, required) — Busts and corrections that arrived after their fill had left the correction window, adjustments applied late or past what the position row can hold, and funding payments the position row cannot hold (since 0.73.0) — each to check by hand.
- `adjustments` (integer, required) — Hand-made adjustments applied to the account's positions or holdings.
- `instrumentRedefinitions` (integer, required) — Fills refused because their instrument changed type or settle asset while a position was open on it.
- `inventoryRefusals` (integer, required) — Balances and fill legs refused because their quantity was too large to hold at the asset's scale; each moved nothing, and the record stays partial. Never resets.
- `positionDrift` (boolean, required) — True when a derived position disagrees with the venue's own for longer than one restatement; `false` until the venue's positions are compared.
- `balancesAsOfNs` (string, required, nullable) — The newest venue time of the balances the record folded — epoch nanoseconds as a decimal string; null before the first.

### ErrorBody

What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.

- `code` (string, required) — The code to branch on — stable and open (before 1.0.0 a minor may remove one, its changelog naming it): treat one you do not know by its HTTP status. The gateway's: - 400: `MALFORMED_REQUEST`, `MISSING_IDEMPOTENCY_KEY`, `INVALID_IDEMPOTENCY_KEY`, `INVALID_IF_MATCH`, `INVALID_CURSOR` - 401: `UNAUTHENTICATED` - 403: `FORBIDDEN_PRINCIPAL`, `NOT_REGISTERED`, `INVITATION_EXPIRED`, `EMAIL_UNVERIFIED`, `ORG_NOT_ACTIVE`, `CAPABILITY_DENIED` - 404: `NOT_FOUND`, `UNKNOWN_OPERATION`, `ROUTE_NOT_FOUND` (no route answers the path) - 405: `METHOD_NOT_ALLOWED` - 409: `IDEMPOTENCY_KEY_REUSED`, `INTAKE_KEY_REUSED`, `KEY_ALREADY_REGISTERED`, `CONNECTION_DOWN` (`POST /transfers`), `EXCEEDS_MARGIN_HEADROOM`, `HEADROOM_UNKNOWN` (a transfer's submit and its approval) - 413: `TOO_LARGE`, `PAYLOAD_TOO_LARGE`, `DOCUMENT_TOO_LARGE` - 422: a reference this member will not send: `INSTRUMENT_NOT_LIVE`, `ACCOUNT_NOT_ACTIVE` (`POST /orders`), `REFERENCE_UNKNOWN_INSTRUMENT`, `REFERENCE_INSTRUMENT_NOT_LIVE`, `REFERENCE_UNKNOWN_ACCOUNT` (an algo document); `VENUE_UNSUPPORTED`, `DEDICATED_KEY`, `DESTINATION_NOT_ALLOWED` - 428: `PRECONDITION_REQUIRED` - 429: `INBOX_FULL`, `IN_FLIGHT_FULL`, `RATE_LIMITED` - 500: `INTERRUPTED`, `INTERNAL_ERROR`, `PROJECTION_MISS` - 503: `NOT_PRIMED`, `NOT_SERVING`, `OWNER_ABSENT`, `INTAKE_UNAVAILABLE`, `BALANCES_UNAVAILABLE`, `POSITIONS_UNAVAILABLE`, `RISK_UNAVAILABLE`, `TRANSFERS_UNAVAILABLE`, `ALGOS_UNAVAILABLE`, `NOTIFICATIONS_UNAVAILABLE`, `TICKETS_UNAVAILABLE`, `REGISTRATION_PENDING`, `PROJECTION_BEHIND`, `LOST`, `REJECTED_NOT_REGISTERED`, `REJECTED_NOT_ACTIVE` The record owners' refusals ride verbatim — `OrgRegisterRejected.reason`, `OrderRejected.reason`, `AlgoRejected.reason`, `RiskLimitRejectReason`, `RiskAdjustmentRejectReason`, `ManualExecutionRejectReason`, `TransferRejectReason` and `NotificationEndpointRejected.reason` list them; the guide maps each to its status.
- `message` (string, required) — For display only; its wording may change at any time.
- `requestId` (string, required) — The request's id, also sent as X-Request-Id; quote it to support.
- `retryable` (boolean, required) — Whether sending the identical request again, its `Idempotency-Key` included, after `Retry-After` or a short pause, can succeed with nothing else changed. `false` where something must change first: the request, its key, its precondition, the caller's standing, or the platform's own records or deployment. A refusal the record owner judged is always `false`: it is the recorded answer to its key, which replays it.

## Examples

**Response**

```json
{
  "asOfSeqTsNs": "1791553927418203000",
  "globalSequence": "250113",
  "items": [
    {
      "accountId": 118301478,
      "pricedAtNs": "1791553890016000000",
      "cause": "BALANCE",
      "causeRef": "0",
      "nlvUsd": "4750000.00000000",
      "marginEquityUsd": "4750000.00000000",
      "unrealizedPnlUsd": "0.00000000",
      "realizedPnlUsd": "0.00000000",
      "feesUsd": "0.00000000",
      "fundingUsd": "0.00000000",
      "transfersUsd": "4750000.00000000",
      "grossActualNoSpot": "0.00000000",
      "grossActualWithSpot": "0.00000000",
      "netActualNoSpot": "0.00000000",
      "netActualWithSpot": "0.00000000",
      "grossTotalNoSpot": "0.00000000",
      "grossTotalWithSpot": "0.00000000",
      "netTotalNoSpot": "0.00000000",
      "netTotalWithSpot": "0.00000000",
      "isPartial": false,
      "worstSource": "PRIMARY",
      "unsupportedInstruments": 0,
      "unmarkedPositions": 0,
      "basisResets": 0,
      "unmatchedCorrections": 0,
      "adjustments": 0,
      "instrumentRedefinitions": 0,
      "inventoryRefusals": 0,
      "positionDrift": false,
      "balancesAsOfNs": "1791553890004000000"
    },
    {
      "accountId": 118310760,
      "pricedAtNs": "1791553925131000000",
      "cause": "BALANCE",
      "causeRef": "0",
      "nlvUsd": "2356983.18848400",
      "marginEquityUsd": "2356983.18848400",
      "unrealizedPnlUsd": "36887.25582400",
      "realizedPnlUsd": "6.00000000",
      "feesUsd": "5.74094500",
      "fundingUsd": "0.00000000",
      "transfersUsd": "2350000.00000000",
      "grossActualNoSpot": "0.00183455",
      "grossActualWithSpot": "0.48954216",
      "netActualNoSpot": "0.00024608",
      "netActualWithSpot": "0.48746153",
      "grossTotalNoSpot": "0.00183455",
      "grossTotalWithSpot": "0.49351334",
      "netTotalNoSpot": "0.00024608",
      "netTotalWithSpot": "0.49143271",
      "isPartial": false,
      "worstSource": "PRIMARY",
      "unsupportedInstruments": 0,
      "unmarkedPositions": 0,
      "basisResets": 0,
      "unmatchedCorrections": 0,
      "adjustments": 0,
      "instrumentRedefinitions": 0,
      "inventoryRefusals": 0,
      "positionDrift": false,
      "balancesAsOfNs": "1791553925120000000"
    }
  ],
  "total": 2
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/risk/records"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/risk/records';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/risk/records"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/risk/records")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.example.com/risk/records")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.example.com/risk/records', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/risk/records");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/risk/records")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```