---
title: "Quotes API client"
url: "https://platformdocs.coinme.com/#/docs/caas-quotes-api-client"
markdown: "https://platformdocs.coinme.com/docs/caas-quotes-api-client.md"
summary: "The `@coinme/quotes-api-client` package provides a client for interacting with the Coinme Quotes APIs."
surface: "caas"
platform: "server"
package: "@coinme/quotes-api-client"
updated: "2026-11-04"
---

# Quotes API client

The `@coinme/quotes-api-client` package provides a client for interacting with the Coinme Quotes APIs.

> **Server only.**
>
> `AuthService` takes your partner client secret and mints a partner access token. Use it, and these clients, only on your backend (Node.js). Never bundle them into a browser, WebView or mobile (React Native) app, where anyone can extract the secret and the token: `AuthService` throws if it runs there. For anything that runs on a customer's device, mint a [Transient Auth Token](https://platformdocs.coinme.com/docs/transient-auth-token.md) on your backend instead.

> **This is version 2.0.0, and 1.x is deprecated.**
>
> This page documents version 2.0.0 of the CaaS API clients, which is not published yet; until it is, the registry serves 1.x, which is configured differently. Install with `@^2.0.0`. [CaaS API clients](https://platformdocs.coinme.com/docs/caas-api-clients.md) covers installing, authenticating, environments and [upgrading from 1.x](https://platformdocs.coinme.com/docs/caas-api-clients.md#upgrading-from-1-x).

## Install

```bash
npm install @coinme/quotes-api-client@^2.0.0 @coinme/core-api-client@^2.0.0
```

The packages come from Coinme's private registry; [Install in the overview](https://platformdocs.coinme.com/docs/caas-api-clients.md#install) shows the `.npmrc` entries. Every client needs a token from `AuthService` in `@coinme/core-api-client`.

## Create the client

The API client for interacting with the Coinme Quotes APIs.

```typescript
import { APIClient } from '@coinme/quotes-api-client';

const quotesClient = new APIClient({
  baseUrl: 'https://caas-staging.coinme.com/services',
  partnerId: process.env.COINME_PARTNER_ID!,
  token: await authService.getToken(),
});
```

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `baseUrl` | `string` | Yes | Base URL of the CaaS API for the environment to call, including the `/services` path, for example `https://caas-staging.coinme.com/services` for staging. Use the URLs Coinme provides for each environment. |
| `partnerId` | `string` | Yes | The unique identifier Coinme assigns to each partner. |
| `token` | `string` | Yes | The bearer token from `AuthService.getToken()`. |

A client keeps the token it was given; pass a new one to `updateToken` when it expires, or create the client per request. [Environments in the overview](https://platformdocs.coinme.com/docs/caas-api-clients.md#environments) lists the base URLs.

## Methods

### createBuyInformationalQuote

Fetch an informational crypto quote for a buy transaction.

```typescript
createBuyInformationalQuote(body: CreateInformationalQuoteRequest): Promise<CreateInformationalQuoteResponse>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `body` | `CreateInformationalQuoteRequest` | The request body containing details for the crypto quote. |

A promise that resolves to the `CreateInformationalQuoteResponse` with the quote details. See [CreateInformationalQuoteResponse](#createinformationalquoteresponse), [CreateInformationalQuoteRequest](#createinformationalquoterequest).

```typescript
const response = await quotesClient.createBuyInformationalQuote({
  amountCurrencyCode: 'USD',
  amountValue: '100',
  creditCurrencyCode: 'BTC',
  debitCurrencyCode: 'USD',
});
```

### createBuyTransactionalQuote

Create quote for a buy transaction.

```typescript
createBuyTransactionalQuote(body: CreateTransactionalQuoteRequest): Promise<CreateTransactionalQuoteResponse>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `body` | `CreateTransactionalQuoteRequest` | The parameters required to create a transactional quote. |

A promise that resolves to a `CreateTransactionalQuoteResponse`. See [CreateTransactionalQuoteResponse](#createtransactionalquoteresponse), [CreateTransactionalQuoteRequest](#createtransactionalquoterequest).

```typescript
const response = await quotesClient.createBuyTransactionalQuote({
  amountCurrencyCode: 'USD',
  amountValue: '100',
  creditCurrencyCode: 'BTC',
  customerId: 'customer-id',
  debitCurrencyCode: 'USD',
});
```

### createSellInformationalQuote

Fetch an informational crypto quote for a sell transaction.

```typescript
createSellInformationalQuote(body: CreateInformationalQuoteRequest): Promise<CreateInformationalQuoteResponse>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `body` | `CreateInformationalQuoteRequest` | The request body containing details for the crypto quote. |

A promise that resolves to the `CreateInformationalQuoteResponse` with the quote details. See [CreateInformationalQuoteResponse](#createinformationalquoteresponse), [CreateInformationalQuoteRequest](#createinformationalquoterequest).

```typescript
const response = await quotesClient.createSellInformationalQuote({
  amountCurrencyCode: 'BTC',
  amountValue: '100',
  creditCurrencyCode: 'USD',
  debitCurrencyCode: 'BTC',
});
```

### createSellTransactionalQuote

Create quote for a sell transaction.

```typescript
createSellTransactionalQuote(body: CreateTransactionalQuoteRequest): Promise<CreateTransactionalQuoteResponse>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `body` | `CreateTransactionalQuoteRequest` | The parameters required to create a transactional quote. |

A promise that resolves to a `CreateTransactionalQuoteResponse`. See [CreateTransactionalQuoteResponse](#createtransactionalquoteresponse), [CreateTransactionalQuoteRequest](#createtransactionalquoterequest).

```typescript
const response = await quotesClient.createSellTransactionalQuote({
  amountCurrencyCode: 'BTC',
  amountValue: '100',
  creditCurrencyCode: 'USD',
  customerId: 'customer-id',
  debitCurrencyCode: 'BTC',
});
```

### getLimits

Return the remaining limit based on varying transaction limits that are dynamically imposed on the customer, based on risk analysis and documents/data collected.

```typescript
getLimits(queryParams: GetLimitsQuery): Promise<GetLimitsResponse>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `queryParams` | `GetLimitsQuery` | The parameters required for fetching the customer's transaction limits. |

A promise that resolves to `GetLimitsResponse`. See [GetLimitsResponse](#getlimitsresponse), [GetLimitsQuery](#getlimitsquery).

```typescript
const response = await quotesClient.getLimits({
  customerId: 'customer-id',
  fiatCurrencyCode: 'USD',
});
```

### getTransactionalQuote

Get details on a transactional quote based on the `quoteId`.

```typescript
getTransactionalQuote(quoteId: string): Promise<GetTransactionalQuoteResponse>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `quoteId` | `string` | The unique identifier for the transactional quote. |

A promise that resolves to a `TransactionalQuoteResponse`. See [GetTransactionalQuoteResponse](#gettransactionalquoteresponse).

```typescript
const response = await quotesClient.getTransactionalQuote('quote-id');
```

### updateToken

Allows updating the token dynamically (e.g., after refresh), without creating a new instance of the client.

```typescript
updateToken(newToken: string): void
```

| Parameter | Type | Description |
| --- | --- | --- |
| `newToken` | `string` | The new token to use. |

Returns `void`.

```typescript
quotesClient.updateToken('new-token');
```

## Types

The request, query and response types of the methods above, as the package exports them. Ids are strings and amounts are decimal strings, as the API sends and expects them; response fields are optional and may be null, because the API leaves out or nulls values it has no data for.

### CreateInformationalQuoteRequest

Request for `POST /services/cryptoquote/informative`: Initiate Informative Quote.

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `amountCurrencyCode` | `string` | Yes | Currency code of amount (i.e. USD) |
| `amountValue` | `string` | Yes | Amount to buy or sell |
| `chain` | `string` | No | Possible values are "XLM" or "ETH". use only if Coinme supports trading this currency on multiple chains. otherwise unnecessary |
| `creditCurrencyCode` | `string` | Yes | Credit currency code (i.e. DOGE) |
| `cryptoSettlementType` | `'INTERNAL' \| 'EXTERNAL'` | No | Possible values are "INTERNAL" or "EXTERNAL". defaults to "INTERNAL". Use "EXTERNAL" to also calculate blockchain fees |
| `debitCurrencyCode` | `string` | Yes | Debit currency code (i.e. USD) |
| `latitude` | `number` | No | Latitude  of the selected location. Either lat & long , or the locationReference must be provided |
| `locationReference` | `string` | No | Encoded reference of the location. Either lat & long , or the locationReference must be provided |
| `longitude` | `number` | No | Longitude of the selected location. Either lat & long , or the locationReference must be provided |
| `promoCode` | `'noFees' \| 'noSpread' \| 'noFeesOrSpread'` | No | Applies promotional fees for this transaction. Please contact your Coinme Account Manager to set up a custom promotional code |
| `providerId` | `string` | No |  |
| `rampId` | `string` | No |  |

### CreateInformationalQuoteResponse

Response for `POST /services/cryptoquote/informative`: Initiate Informative Quote.

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `chain` | `string \| null` | No |  |
| `creditCurrencyAmount` | `string \| null` | No |  |
| `creditCurrencyCode` | `string \| null` | No |  |
| `creditCurrencyUnitPrice` | `string \| null` | No |  |
| `creditCurrencyUnitPriceCode` | `string \| null` | No |  |
| `debitCurrencyAmount` | `string \| null` | No |  |
| `debitCurrencyCode` | `string \| null` | No |  |
| `debitCurrencyUnitPrice` | `string \| null` | No |  |
| `debitCurrencyUnitPriceCode` | `string \| null` | No |  |
| `feeCurrency` | `string \| null` | No |  |
| `feesMap` | `Record<string, string> \| null` | No |  |
| `promoCode` | `'noFees' \| 'noSpread' \| 'noFeesOrSpread' \| null` | No |  |
| `spread` | `string \| null` | No |  |
| `spreadCurrencyCode` | `string \| null` | No |  |
| `totalFees` | `string \| null` | No |  |

### CreateTransactionalQuoteRequest

Request for `POST /services/cryptoquote`: Initiate Transactional Quote.

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `amountCurrencyCode` | `string` | Yes | Currency code of amount (i.e. USD). It must match either creditCurrency or debitCurrency |
| `amountValue` | `string` | Yes | Amount to buy or sell. This is used as the input value to calculate the quote |
| `chain` | `string` | No | Possible values are "XLM", "ETH", or "LINEA". Use only if Coinme supports trading this currency on multiple chains. otherwise unnecessary |
| `creditCurrencyCode` | `string` | Yes | Credit currency code (i.e. DOGE) |
| `cryptoSettlementType` | `'INTERNAL' \| 'EXTERNAL'` | No | Possible values are "INTERNAL" or "EXTERNAL". defaults to "INTERNAL". Use "EXTERNAL" to also calculate blockchain fees |
| `customerId` | `string` | Yes | Unique customer identifier |
| `debitCurrencyCode` | `string` | Yes | Debit currency code (i.e. USD) |
| `isLedgerSend` | `boolean` | No |  |
| `latitude` | `number` | No |  |
| `locationReference` | `string` | No | should be specified only if fiat settlement is done through Coinme and requires a physical location (i.e. selling crypto for cash) |
| `longitude` | `number` | No |  |
| `promoCode` | `'noFees' \| 'noSpread' \| 'noFeesOrSpread'` | No | Applies promotional fees for this transaction. Please contact your Coinme Account Manager to set up a custom promotional code |
| `providerId` | `string` | No | ID of payment provider (provided by Coinme) |
| `rampId` | `string` | No |  |
| `userQuoteLocation` | `object` | No |  |
| `userQuoteLocation.address1` | `string` | No |  |
| `userQuoteLocation.address2` | `string` | No |  |
| `userQuoteLocation.city` | `string` | No |  |
| `userQuoteLocation.coordinates` | `object` | No |  |
| `userQuoteLocation.coordinates.latitude` | `number` | Yes |  |
| `userQuoteLocation.coordinates.longitude` | `number` | Yes |  |
| `userQuoteLocation.country` | `string` | No |  |
| `userQuoteLocation.description` | `string` | No |  |
| `userQuoteLocation.locationReference` | `string` | No |  |
| `userQuoteLocation.state` | `string` | No |  |
| `userQuoteLocation.zipcode` | `string` | No |  |

### CreateTransactionalQuoteResponse

Response for `POST /services/cryptoquote`: Initiate Transactional Quote.

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `chain` | `string \| null` | No |  |
| `creditCurrencyAmount` | `string \| null` | No |  |
| `creditCurrencyCode` | `string \| null` | No |  |
| `creditCurrencyUnitPrice` | `string \| null` | No |  |
| `creditCurrencyUnitPriceCode` | `string \| null` | No |  |
| `debitCurrencyAmount` | `string \| null` | No |  |
| `debitCurrencyCode` | `string \| null` | No |  |
| `debitCurrencyUnitPrice` | `string \| null` | No |  |
| `debitCurrencyUnitPriceCode` | `string \| null` | No |  |
| `expirationTime` | `string \| null` | No | Format: date-time. |
| `expiresIn` | `number \| null` | No |  |
| `feeCurrency` | `string \| null` | No |  |
| `feesMap` | `Record<string, string> \| null` | No |  |
| `promoCode` | `'noFees' \| 'noSpread' \| 'noFeesOrSpread' \| null` | No |  |
| `quoteId` | `string \| null` | No |  |
| `spread` | `string \| null` | No |  |
| `spreadCurrencyCode` | `string \| null` | No |  |
| `totalFees` | `string \| null` | No |  |

### GetLimitsQuery

Query for `GET /services/transactionlimits`: Get Transaction Limits.

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `customerId` | `string` | Yes | Unique customer identifier |
| `fiatCurrencyCode` | `string` | Yes | Currency code of the fiat (i.e. USD) |

### GetLimitsResponse

Response for `GET /services/transactionlimits`: Get Transaction Limits.

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `buyLimitAmount` | `number \| null` | No |  |
| `sellLimitAmount` | `number \| null` | No |  |

### GetTransactionalQuotePathParams

PathParams for `GET /services/cryptoquote/{quoteId}`: Get Transactional Quote.

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `quoteId` | `string` | Yes | Quote Identifier referring to the specific crypto quote |

### GetTransactionalQuoteResponse

Response for `GET /services/cryptoquote/{quoteId}`: Get Transactional Quote.

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `chain` | `string \| null` | No |  |
| `creditCurrencyAmount` | `string \| null` | No |  |
| `creditCurrencyCode` | `string \| null` | No |  |
| `creditCurrencyUnitPrice` | `string \| null` | No |  |
| `creditCurrencyUnitPriceCode` | `string \| null` | No |  |
| `debitCurrencyAmount` | `string \| null` | No |  |
| `debitCurrencyCode` | `string \| null` | No |  |
| `debitCurrencyUnitPrice` | `string \| null` | No |  |
| `debitCurrencyUnitPriceCode` | `string \| null` | No |  |
| `expirationTime` | `string \| null` | No | Format: date-time. |
| `expiresIn` | `number \| null` | No |  |
| `feeCurrency` | `string \| null` | No |  |
| `feesMap` | `Record<string, string> \| null` | No |  |
| `promoCode` | `'noFees' \| 'noSpread' \| 'noFeesOrSpread' \| null` | No |  |
| `quoteId` | `string \| null` | No |  |
| `spread` | `string \| null` | No |  |
| `spreadCurrencyCode` | `string \| null` | No |  |
| `totalFees` | `string \| null` | No |  |

### BaseQuoteBodyParams

The quote fields shared by transactional and informational quotes: a transactional quote request without the customer.

```typescript
type BaseQuoteBodyParams = Omit<CreateTransactionalQuoteRequest, 'customerId'>;
```

### FeesMap

Fees for the quote, by fee name.

```typescript
type FeesMap = NonNullable<Quote['feesMap']>;
```

### GPSCoordinates

GPS coordinates of a cash location.

```typescript
type GPSCoordinates = NonNullable<NonNullable<CreateTransactionalQuoteRequest['userQuoteLocation']>['coordinates']>;
```

### Nullable

A type that represents a nullable version of the given type.

```typescript
type Nullable<T> = { [P in keyof T]: T[P] | null };
```

### Quote

Quote details without a quote id or expiry, as an informational quote returns them.

```typescript
type Quote = CreateInformationalQuoteResponse;
```

### Other names

Names the package also exports for the types above. The 1.x names remain as aliases of the generated ones.

| Name | Same as |
| --- | --- |
| `CreateInformationalQuoteBodyParams` | `CreateInformationalQuoteRequest` |
| `CreateTransactionalQuoteBodyParams` | `CreateTransactionalQuoteRequest` |
| `GetLimitsQueryParams` | `GetLimitsQuery` |
| `InformationalQuoteResponse` | `CreateInformationalQuoteResponse` |
| `TransactionalQuoteResponse` | `GetTransactionalQuoteResponse` |

## Errors

Every method rejects with an `APIError` when a call fails. Check for it with `isAPIError`, which works across packages, rather than `instanceof`. [Errors in the overview](https://platformdocs.coinme.com/docs/caas-api-clients.md#errors) explains the error shape.

| Export | What it is |
| --- | --- |
| `APIError` | Custom error class for handling API responses. Extends the native Error class to include structured error response details. |
| `isAPIError` | Tells whether an error was thrown by a CaaS API client. Prefer this to `instanceof APIError` when an application uses more than one client package: each package carries its own copy of the class. |
| `CAASErrorData` | Represents detailed information about an individual error in a CAAS error response. |
| `CAASErrorResponse` | Represents the structure of a CAAS error response, including HTTP status, timestamp, path, and an array of individual error data. |
| `GenericErrorResponse` | Represents the structure of a generic error response, used when handling non-CAAS errors like client or server errors (4xx or 5xx). |

### CAASErrorResponse

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `caasError` | `boolean` | Yes | True when the response body carried the CaaS error envelope (`errorResponse.errorData`), whatever the HTTP status; `errorData` then holds the server's own error codes. False for network failures and other error bodies, which are reported as one `GENERIC_ERROR`. |
| `errorData` | `CAASErrorData<U, V>[]` | Yes | Array of detailed error information objects, each representing an individual error. For non-CAAS errors, this array may contain generic error data. |
| `httpStatus` | `string` | Yes | HTTP status code as a string, indicating the type of error response. |
| `path` | `string` | Yes | API path where the error occurred, useful for tracing the origin of the error. |
| `timestamp` | `string` | Yes | Timestamp when the error occurred, in ISO 8601 format. |

### CAASErrorData

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `errorCode` | `U` | Yes | Unique code identifying the specific error that occurred. |
| `message` | `string` | Yes | Descriptive message explaining the nature of the error. |
| `metadata` | `V` | No | Optional metadata providing additional context for the error. |

```typescript
import { isAPIError } from '@coinme/quotes-api-client';

try {
  // a call on the client
} catch (error) {
  if (isAPIError(error)) {
    console.error(error.errorResponse.httpStatus, error.errorResponse.errorData);
  }
  throw error;
}
```
