# Get spot prices

## Goal

Request a spot price from executable streaming prices (ESP).

## Prerequisites

- Your REST API app.
- Integral API login with trading permission.
- Your organization provisioned with at least one provider who streams ESP spot prices.


## Steps

```mermaid
flowchart TD
  LOGIN(Step 1: Login) --> GETRATE(Step 2: Get spot prices) --> HANDLE(Step 3: Handle prices)
  click LOGIN "#step-1-login"
  click GETRATE "#step-2-get-spot-prices"
  click HANDLE "#step-3-handle-prices"
```

### Step 1: Login

Use the [Login and get token](/openapi/integral-api-reference/rest/authentication-api/login) endpoint.

See the related [Login](/developer-portal/tutorials/tutorialauth/) tutorial.

Your access token is in `SSO_TOKEN` of the response header. Your token is valid for limited time.

Pass the `SSO_TOKEN` cookie value with all of your subsequent API requests.

```json Payload application/json
{
  "user": "apiUserId",
  "pass": "This is a long password!",
  "org": "apiOrganizationId"
}
```

### Step 2: Get spot prices

Use the [Get spot rate by symbol](/openapi/integral-api-reference/rest/market-data/getspotrate) endpoint.

Use the `rateId` attribute of the JSON response in the next step.

```javascript JavaScript
const query = new URLSearchParams({symbol: 'EUR/USD'}).toString();

const hostname = 'your-instance.fxinside.net';
const resp = await fetch(
  `https://${hostname}/v2/rates/spot?${query}`,
  {method: 'GET'}
);

const data = await resp.text();
console.log(data);
```

### Step 3: Handle prices

Use the `rateId` attribute of the response when you place your order.

```json Payload application/json
{
  "coId": "pq11233",
  "rateId": "4HProduct|2022-11-14|0800-1200|EURUSD|SPOT",
  "currency": "EUR",
  "size": 9000000,
  "type": "PQ",
  "price": 1.1652,
  "side": "Buy",
  "symbol": "EUR/USD",
  "timeInForce": "FOK"
}
```