Postman Variables Guide
Published on 12 Nov 2025 by CHATURVEDINIDHI26@GMAIL.COM
```plaintext
Postman Variables: Guide & Best Practices
Postman API testing me variables ka use karke dynamic requests banaye ja sakte hain aur same request ko different environments ya data ke saath test kiya ja sakta hai.
1️⃣ Types of Variables
1. Environment Variables
2. Collection Variables
- Description: Collection ke andar accessible, same request multiple runs ke liye
- Use-case: Static/common values
- Syntax:
{{VARIABLE_NAME}}
- Example: HOTEL_ID, DEFAULT_CURRENCY
3. Global Variables
- Description: Sabhi collections & environments me available
- Use-case: Truly universal values
- Syntax:
{{VARIABLE_NAME}}
- Example: COMPANY_CODE, COMMON_HEADER_TOKEN
4. Vault (Secure) Variables
- Description: Sensitive info ke liye encrypted storage
- Use-case: Passwords, API secrets, tokens
- Syntax:
{{VARIABLE_NAME}}
- Example: SECRET_ID, API_SECRET, PASSWORD
2️⃣ When to Use Which Variable
| Variable Type |
Use Case |
Examples |
| Environment |
Environment-specific data |
BASE_URL, CLIENT_ID, TOKEN |
| Collection |
Static/common values for collection |
HOTEL_ID, DEFAULT_CURRENCY |
| Global |
Universal values across all collections |
COMPANY_CODE, COMMON_HEADER_TOKEN |
| Vault |
Sensitive info (hidden & encrypted) |
SECRET_ID, PASSWORD, API_SECRET |
3️⃣ Best Practices
- Use variables instead of hardcoded values for dynamic requests.
- Store sensitive info in Vault, not environment/collection.
- Separate environments for Dev/Test/Prod.
- Minimize global variables; only for truly universal data.
- Use clear & descriptive variable names.
💡 Tip: Postman variable priority at runtime:
Vault > Environment > Collection > Global
```