> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bango.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mock response headers

> Use X-Magic-Number in Sandbox to simulate Content Provider responses when testing the Reseller-to-DVM Entitlement API.

Mock response headers let a Reseller test Entitlement API behavior in DVM Sandbox without sending the request to a Content Provider or downstream mock service.

Add the `X-Magic-Number` header to a Reseller-to-DVM Entitlement API request to make DVM simulate a known Content Provider response.

<Warning>
  Mock response headers apply to the **Reseller-to-DVM Entitlement API only at this time**. They are not a general DVM testing mechanism and are not supported by the Offer Catalog, Consumer Offers, Eligibility, Billing and Charging, Partner Management, or reporting APIs unless separately documented.
</Warning>

## When to use mock response headers

Use mock response headers when you need to test how your Entitlement API integration handles a predictable downstream result, including happy paths, asynchronous responses, and errors.

They are useful because:

* You send the same Entitlement API request body used in a normal integration.
* You do not need a live Content Provider or a configured downstream mock.
* The requested response is deterministic.
* DVM creates the entitlement state needed for subsequent Entitlement API testing where the scenario supports it.

## What they do not test

Mock response headers stop the Entitlement API flow before DVM calls the Content Provider.

They therefore do **not** validate:

* The Content Provider endpoint.
* Outbound authentication from DVM to the Content Provider.
* Content Provider-specific API behavior.
* A complete three-party integration.

Use [Bango Music](/testing/bango-music) when you need a Bango-operated test Content Provider and a fuller end-to-end entitlement flow.

## Add the header

Add `X-Magic-Number` to the Entitlement API request with the scenario you want DVM to simulate.

```http theme={null}
X-Magic-Number: CREATE_REQUEST_RETURNS_ACTIVATED
```

For example, when creating an entitlement:

```bash theme={null}
curl --request POST \
  --url https://<sandbox-entitlement-api-base-url>/v1/entitlement \
  --header "Authorization: Basic <credentials>" \
  --header "Content-Type: application/json" \
  --header "X-Magic-Number: CREATE_REQUEST_RETURNS_ACTIVATED" \
  --data '{
    "customerIdentifier": "<customer-identifier>",
    "merchantAccountKey": "<content-provider-account-key>",
    "productKey": "<product-key>"
  }'
```

Use the Sandbox Entitlement API base URL, credentials, and identifiers supplied for your integration.

## Supported scenarios

### Create entitlement

<table>
  <colgroup>
    <col width="344" />

    <col width="325" />
  </colgroup>

  <thead>
    <tr>
      <th>Header value</th>
      <th>Simulated behavior</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>`CREATE_REQUEST_RETURNS_ACTIVATED`</td>
      <td>Simulates a synchronous Content Provider response that activates the entitlement.</td>
    </tr>

    <tr>
      <td>`CREATE_REQUEST_RETURNS_CREATED`</td>
      <td>Simulates creation without activation. The entitlement remains pending activation.</td>
    </tr>

    <tr>
      <td>`CREATE_REQUEST_RETURNS_ACTIVATION_REQUIRED`</td>
      <td>Simulates an asynchronous activation flow and returns mock activation information.</td>
    </tr>
  </tbody>
</table>

### Activation information

| Header value | Simulated behavior |
| - | - |
| `ACTIVATION_INFO_RETURNS_ACTIVATION_URL` | Returns mock activation URL information. The URL is not a real Content Provider activation URL. |
| `ACTIVATION_INFO_RETURNS_ACTIVATION_CODE` | Returns a mock activation code. The code is not redeemable. |

### Suspend

| Header value | Simulated behavior |
| - | - |
| `SUSPEND_RETURNS_SUSPENDED` | Simulates a synchronous suspend response and moves the entitlement to suspended state. |
| `SUSPEND_RETURNS_SUSPEND_ACCEPTED` | Simulates an accepted asynchronous suspend request. |

### Terminate, cancel, or revoke

| Header value | Simulated behavior |
| - | - |
| `TERMINATE_RETURNS_TERMINATED` | Simulates a synchronous termination response. |
| `TERMINATE_RETURNS_ACCEPTED_FUTURE_DATE` | Simulates an accepted termination with a future end date. |
| `TERMINATE_RETURNS_ACCEPTED_NO_DATE` | Simulates an accepted asynchronous termination without an end date. |

### Update

| Header value | Simulated behavior |
| - | - |
| `UPDATE_RETURNS_UPDATED` | Simulates a synchronous successful update. |
| `UPDATE_RETURNS_ACCEPTED` | Simulates an accepted asynchronous update. |

### Error responses

<table>
  <colgroup>
    <col width="335" />

    <col width="218" />
  </colgroup>

  <thead>
    <tr>
      <th>Header value</th>
      <th>Simulated response</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>`ANY_REQUEST_RETURNS_BAD_REQUEST`</td>
      <td>`400 Bad Request`</td>
    </tr>

    <tr>
      <td>`ANY_REQUEST_RETURNS_UNAUTHORIZED`</td>
      <td>`401 Unauthorized`</td>
    </tr>

    <tr>
      <td>`ANY_REQUEST_RETURNS_CONFLICT`</td>
      <td>`409 Conflict`</td>
    </tr>

    <tr>
      <td>`ANY_REQUEST_RETURNS_INTERNAL_SERVER_ERROR`</td>
      <td>`500 Internal Server Error`</td>
    </tr>

    <tr>
      <td>`ANY_REQUEST_RETURNS_SERVICE_UNAVAILABLE`</td>
      <td>`503 Service Unavailable`</td>
    </tr>
  </tbody>
</table>

## Mock response headers or Bango Music?

| Testing need | Mock response headers | Bango Music |
| - | - | - |
| Force a known Entitlement API response | Yes | Depends on Bango Music configuration |
| Test Entitlement API error handling | Yes | Depends on Bango Music configuration |
| Test the Content Provider endpoint and authentication | No | Yes |
| Exercise activation through a test Content Provider | No | Yes |
| Test other DVM APIs | No | Use the relevant Sandbox flow |

For certification, follow the test plan provided by Bango. It will identify when to use mock response headers, Bango Music, or the intended Content Provider.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.