# Insomnia Collection
source: https://developer.mastercard.com/small-business-credit-analytics/documentation/developer-tools/insomnia-collection/index.md

Insomnia is a desktop application for designing and testing REST APIs. You can use Insomnia to test API calls multiple times without having to write code, and save separate environments to quickly test an API's calls in the sandbox and production environments.

See the following [Insomnia tutorial](https://developer.mastercard.com/platform/tutorial/use-insomnia-rest-client-for-mastercard-apis/) for the generic steps needed to get Mastercard authentication (OAuth 1.0a plugin) working in Insomnia.

## Import the collection {#import-the-collection}

Insomnia can generate a request collection directly from an OpenAPI specification. Import the following specification to create requests for both the Matches and Metrics endpoints:

* [swagger.yaml](https://static.developer.mastercard.com/content/small-business-credit-analytics/swagger/swagger.yaml) (35KB)

In Insomnia, use **Create \> Import From File** (or drag-and-drop) and select the downloaded file to generate the collection.

## Test SBCA in Insomnia {#test-sbca-in-insomnia}

Follow these steps to run the full match → metrics flow in Insomnia.

### 1. Set up authentication {#1-set-up-authentication}

1. Install the Mastercard OAuth 1.0a plugin for Insomnia, following the [Insomnia tutorial](https://developer.mastercard.com/platform/tutorial/use-insomnia-rest-client-for-mastercard-apis/).
2. Create a Sandbox environment and set your **consumer key** and **`.p12`** signing key as environment variables.
3. Set the base URL environment variable to `https://sandbox.api.mastercard.com/small-business/credit-analytics/locations`.

### 2. Call Matches {#2-call-matches}

Send the **Matches** request with these Sandbox parameters:

|        Parameter        |       Value        |
|-------------------------|--------------------|
| `country_code`          | `USA`              |
| `company_name`          | `Artisan Emporium` |
| `street_address`        | `2000 Purchase St` |
| `postal_code`           | `10577`            |
| `city`                  | `Purchase`         |
| `state_province_region` | `NY`               |

**Validate:**

* HTTP status is `200 OK`
* Response is a JSON array with `locationId: "a1b2c3d4-0000-1234-abcd-000000000001"`

### 3. Call Metrics {#3-call-metrics}

Copy the `locationId` from Step 2 into the **Metrics** request path, and set:

|      Parameter      |          Value           |
|---------------------|--------------------------|
| `has_consent`       | `true`                   |
| `metrics_type`      | `retail_sales_analytics` |
| `metrics_frequency` | `Monthly`                |

**Validate:**

* HTTP status is `200 OK`
* Response contains `locationId`, `metricsFrequency`, and a non-empty `metricsLists` array

For expected error responses and status codes, see [Code and Formats](https://developer.mastercard.com/small-business-credit-analytics/documentation/code-and-formats/index.md). For more scenarios, see [Testing](https://developer.mastercard.com/small-business-credit-analytics/documentation/testing/index.md).

## Next Steps {#next-steps}

* [Testing](https://developer.mastercard.com/small-business-credit-analytics/documentation/testing/index.md) --- full end-to-end test scenarios
* [Code and Formats](https://developer.mastercard.com/small-business-credit-analytics/documentation/code-and-formats/index.md) --- error handling reference
* [Reference App](https://developer.mastercard.com/small-business-credit-analytics/documentation/developer-tools/reference-app/index.md) --- a working code sample
* [Postman Collection](https://developer.mastercard.com/small-business-credit-analytics/documentation/developer-tools/postman-collection/index.md) --- explore the API without code
