# Insomnia Collection
source: https://developer.mastercard.com/benefit-allocation-service-mtls/documentation/dev-tools/insomnia/index.md

## Insomnia Collection {#insomnia-collection}

Use Insomnia to test Mastercard APIs with a ready-made workflow for importing requests, configuring environments, and validating calls in Sandbox, MTF, or Production.

For the full step-by-step guide, open the [Insomnia Collection guide](https://developer.mastercard.com/platform/documentation/developer-tools/insomnia-collection/).

## Overview {#overview}

The Insomnia guide covers how to set up Mastercard API requests in Insomnia, including plugin installation, workspace import options, environment configuration, and request execution.

## Prerequisites {#prerequisites}

* Access to a Mastercard Developers project with Benefit Allocation Service added
* Insomnia installed on your machine
* Your mTLS client certificate and private key
* The encryption certificate used to encrypt request payloads
* The Sandbox, MTF, or Production base URL from [API Basics](https://developer.mastercard.com/benefit-allocation-service-mtls/documentation/api-basics/index.md#environments)

## Configure Insomnia {#configure-insomnia}

1. Create an Insomnia environment for Benefit Allocation Service.
2. Add variables for `baseUrl`, `clientCertificatePath`, `clientKeyPath`, and `encryptionCertificatePath`.
3. Set `baseUrl` to the Sandbox endpoint for initial validation, then switch to MTF for full pre-production testing.
4. Configure the request certificate settings with your mTLS certificate and private key.
5. Encrypt the request body before sending it to an encrypted endpoint.

Use `POST /card-segments` as the first validation request. The plaintext payload and expected response are available in the [Quick Start Guide](https://developer.mastercard.com/benefit-allocation-service-mtls/documentation/quick-start-guide/index.md#step-3-confirm-sandbox-configuration-and-make-your-first-request).

## Validate Requests {#validate-requests}

For each request, confirm that:

* The response status matches the expected status in the [API Reference](https://developer.mastercard.com/benefit-allocation-service-mtls/documentation/api-reference/index.md)
* The response includes a correlation ID that you can log for troubleshooting
* Any error response can be matched to [Code and Formats](https://developer.mastercard.com/benefit-allocation-service-mtls/documentation/code-and-formats/index.md)

No local Insomnia collection file is included in this repository. Use the Mastercard Insomnia guide linked above to import or configure a workspace manually.
