Step 5: create a currency quote

You can create a currency quote either to get the latest foreign exchange rates, or so that you can create an order for an internal currency exchange or an outbound payment.

In this example, we want to find out what 80 GBP would be in USD for an external currency exchange, so we're adding a sourceCurrency.amount of 80 and leaving out the targetCurrency.amount. We're also specifying that type.to should be payment, because we'll be sending these funds to a recipient later.

SandboxProduction
Copy
Copied
curl -i -X POST \
  'https://api-sandbox.equalsmoney.com/v2/orders/quote?accountId={accountId}' \
  -H 'Authorization: ApiKey {apiKey}' \
  -H 'Content-Type: application/json' \
  -d '{
    "sourceCurrency": {
      "amount": 80,
      "currency": {
        "budgetId": "{budgetId}",
        "currencyCode": "GBP"
      }
    },
    "targetCurrency": {
      "currency": {
        "budgetId": "{budgetId}",
        "currencyCode": "USD"
      }
    },
    "settlementDate": "20241027",
    "type": {
      "from": "balance",
      "to": "payment"
    }
  }'
Copy
Copied
curl -i -X POST \
  'https://api-sandbox.equalsmoney.com/v2/orders/quote?accountId={accountId}' \
  -H 'Authorization: ApiKey {apiKey}' \
  -H 'Content-Type: application/json' \
  -d '{
    "sourceCurrency": {
      "amount": 100,
      "currency": {
        "budgetId": "{budgetId},
        "currencyCode": "GBP"
      }
    },
    "targetCurrency": {
      "currency": {
        "budgetId": "{budgetId}",
        "currencyCode": "USD"
      }
    },
    "settlementDate": "20241027",
    "type": {
      "from": "balance",
      "to": "payment"
    }
  }'

If your request is successful, you'll receive a 200 response containing an orderId and quoteRequestId.

Copy
Copied
{
  "quoteRequestId": "115f6752-ca44-4ef2-9629-f0c9d97fb17d-80-79.3651",
  "settlement": {
    "date": "20240508",
    "price": {
      "amount": 80,
      "currency": "GBP"
    },
    "charges": {
      "fee": 0
    }
  },
  "quote": {
    "rate": 0.9920634921,
    "inverseRate": 1.008,
    "fromGbpAmount": 79.37,
    "from": {
      "amount": 80,
      "currency": "GBP"
    },
    "to": {
      "amount": 79.37,
      "currency": "USD"
    },
    "direction": "1"
  },
  "orderId": "E2T0A7VKQEKB"
}

Next