# Save a value from mock server call

**URL:** <https://community.postman.com/t/save-a-value-from-mock-server-call/31466>\
**Category:** Help Hub\
**Tags:** variables, json\
**Created:** [January 11, 2022, 9:25pm UTC](https://community.postman.com/t/save-a-value-from-mock-server-call/31466 "2022-01-11T21:25:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![muhayyo](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@muhayyo](https://community.postman.com/u/muhayyo)\
**Post date:** [January 11, 2022, 9:25pm UTC](https://community.postman.com/t/save-a-value-from-mock-server-call/31466/1 "2022-01-11T21:25:08Z")

</div>

> **Archived topic — some details may be out of date.**  
> Mock servers built from saved collection examples are still supported. Postman now also has **code-based mocks** : JavaScript request handlers plus a `config.yaml`, stored as files in your Git repository, which you can run locally or deploy. Create one in the app, or use the Postman CLI to generate one from an OpenAPI spec, collection or dataset (`postman mock generate`) and run it (`postman mock run`). See [About mocks](https://learning.postman.com/docs/design-apis/mock-apis/mocks/overview) and [Create a mock](https://learning.postman.com/docs/design-apis/mock-apis/mocks/create-a-mock).  
> Working with an AI coding agent? The [Postman plugin](https://github.com/postmanlabs/postman-plugin) can build and run mocks for you.  
> For current help, see the [Postman docs](https://learning.postman.com/docs/), try the free [Postman tools](https://www.postman.com/tools) (no account needed), or join us on [Discord](https://discord.gg/58aNNsRBGR).

I have a mock server that is receiving messages I send from my system. I can see a JSON structure I send in Mock Server Call Log, inside the Request Body.  
**How can I save a value from this Request Body somewhere e.g. as environment or collection variable?**  
I need to save a specific value from the Request Body and use it to inside a Response Body.  
Currently, Response body is sending hardcoded values I set up myself. I need to be able to save value from Request body and use it in the Response body.

_Details (like screenshots)_:

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 8, 2025, 9:38am UTC](https://community.postman.com/t/save-a-value-from-mock-server-call/31466/2 "2025-04-08T09:38:31Z")

</div>

Closed on April 8, 2025, 9:38am UTC

Thanks for your post, and sorry we didn’t get to this sooner. This isn’t the experience we want for our users.

Since the post is a bit older, we’re closing it to make room for newer discussions. If you’re still experiencing this or have new details to share, we’d love for you to start a new discussion.
