# Exclude a particular header in MeasurementApi or InventoryApi which creating or updating

**URL:** <https://community.cumulocity.com/t/exclude-a-particular-header-in-measurementapi-or-inventoryapi-which-creating-or-updating/2304>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [April 17, 2024, 6:39am UTC](https://community.cumulocity.com/t/exclude-a-particular-header-in-measurementapi-or-inventoryapi-which-creating-or-updating/2304 "2024-04-17T06:39:51Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Philipp\_Emmel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/philipp_emmel/32/19455_2.png) [@Philipp\_Emmel](https://community.cumulocity.com/u/Philipp_Emmel)\
**Post date:** [April 17, 2024, 7:21am UTC](https://community.cumulocity.com/t/exclude-a-particular-header-in-measurementapi-or-inventoryapi-which-creating-or-updating/2304/2 "2024-04-17T07:21:12Z")

</div>

Most relevant headers including the `X-Cumulocity-Application-Key` header are controlled through the context. So in order to change or remove a header you’ll have to create a new context and run your request within it.

The context is managed through `com.cumulocity.microservice.context.ContextService<C>` I don’t have a concrete example that I can share but here is a basic approach that you can take:

1. Inject `ContextService<MicroserviceCredentials>` into your bean
2. Get the current context from it using the `contextService.getContext()` method
3. Clone this context without the application key
4. Enter this modified cloned context using `contextService.runWithinContext()`
5. Execute your desired requests using `MeasurementApi` or `InventoryApi` within the supplied `Runnable`

---

_[View the full topic](https://community.cumulocity.com/t/exclude-a-particular-header-in-measurementapi-or-inventoryapi-which-creating-or-updating/2304)._
