<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-use-variable-types-in-bruno-v4-a-complete-guide-eonuss4pw" -->

---
title: How to Use Variable Types in Bruno v4: A Complete Guide
description: Bruno v4 introduces typed variables, letting you declare string, number, boolean, and object types for variables instead of everything being treated as a...
canonical: https://daily.dev/posts/how-to-use-variable-types-in-bruno-v4-a-complete-guide-eonuss4pw
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to Use Variable Types in Bruno v4: A Complete Guide | daily.dev
og:description: Bruno v4 introduces typed variables, letting you declare string, number, boolean, and object types for variables instead of everything being treated as a...
og:url: https://daily.dev/posts/how-to-use-variable-types-in-bruno-v4-a-complete-guide-eonuss4pw
og:image: https://api.daily.dev/og/posts/EonUsS4PW.png
og:image:alt: How to Use Variable Types in Bruno v4: A Complete Guide
og:image:width: 1200
og:image:height: 630
og:locale: en
---

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

# How to Use Variable Types in Bruno v4: A Complete Guide

**[Bruno Blog](https://daily.dev/sources/usebruno)** · [@devgancode](https://daily.dev/devgancode) · 7 min read · 0 upvotes · 0 comments

## Summary

Bruno v4 introduces typed variables, letting you declare string, number, boolean, and object types for variables instead of everything being treated as a string. Types can be set via @number/@boolean/@object annotations in .bru files, a type field in .yml files, a UI dropdown selector, or automatically inferred when set from pre/post-request scripts. The breaking change: any .bru file containing a @type annotation will fail to parse in Bruno versions older than v4.0.0, so teams must coordinate upgrades before adopting typed variables in shared collections. Plain string variables remain fully backward compatible.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.usebruno.com/variable-data-types>

## Questions this post answers

### What breaking change did Bruno v4 introduce for variable annotations?

Bruno v4.0.0 adds typed variables using @number, @boolean, and @object annotations in .bru files, but collections using these annotations will not parse in Bruno versions older than v4.0.0. Teams with members still on v3 need to coordinate the upgrade before using typed variables in shared collections. Plain string variables remain unaffected and fully backward compatible.

_Teams coordinating a Bruno v4 upgrade can track breaking changes like this one on daily.dev._

### How do I declare a number type variable in a Bruno .bru file?

Place the @number annotation on the line immediately above the variable, with no blank line between them, for example @number followed by timeout: 30. A blank line between the annotation and the variable name causes Bruno to treat the value as a plain string instead of a number.

_Developers configuring Bruno collections can find syntax details like this on daily.dev._

### How does Bruno infer variable types when set from a script?

Bruno infers the type automatically from the JavaScript value passed to methods like bru.setEnvVar or bru.setVar, writing the correct annotation without needing to specify it manually. Passing a number like 30 writes a @number annotation, true writes @boolean, and an object writes @object, so the type is preserved across runs and resolves correctly on the next request.

_Developers scripting Bruno requests can look up type inference behavior like this on daily.dev._

## Similar posts on daily.dev

- [Variables, Constants, and Data Types in Kotlin: A Beginner-Friendly Guide](https://daily.dev/posts/variables-constants-and-data-types-in-kotlin-a-beginner-friendly-guide-rkyab6sww) · Medium · 0 upvotes · 0 comments
- [How to Share Bruno Collections: Git, Export, and Import](https://daily.dev/posts/how-to-share-bruno-collections-git-export-and-import-qz4ne3qtg) · Bruno Blog · 0 upvotes · 0 comments
- [Seeing types where others don't](https://daily.dev/posts/seeing-types-where-others-don-t-7srbyqoa7) · Lobsters · 0 upvotes · 0 comments

---

Tags: [#testing](https://daily.dev/tags/testing)

[View this post on daily.dev](https://daily.dev/posts/how-to-use-variable-types-in-bruno-v4-a-complete-guide-eonuss4pw)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to Use Variable Types in Bruno v4: A Complete Guide","url":"https://daily.dev/posts/how-to-use-variable-types-in-bruno-v4-a-complete-guide-eonuss4pw","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-use-variable-types-in-bruno-v4-a-complete-guide-eonuss4pw"},"datePublished":"2026-08-25T19:22:44.522Z","dateModified":"2026-08-26T16:00:17.204Z","description":"Bruno v4 introduces typed variables, letting you declare string, number, boolean, and object types for variables instead of everything being treated as a...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4e687aaaa00e1a91088f0a35cb9cb4ca?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4e687aaaa00e1a91088f0a35cb9cb4ca?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Bruno Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Ganesh Patil","url":"https://daily.dev/devgancode","image":"https://media.daily.dev/image/upload/s--YZDsshgS--/f_auto/v1723695126/avatars/avatar_DKBm9qlNzn7jbRNc8qWlD","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":60}},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-use-variable-types-in-bruno-v4-a-complete-guide-eonuss4pw","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"testing","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Bruno Blog","item":"https://daily.dev/sources/usebruno"},{"@type":"ListItem","position":3,"name":"How to Use Variable Types in Bruno v4: A Complete Guide"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-to-use-variable-types-in-bruno-v4-a-complete-guide-eonuss4pw#faq","mainEntity":[{"@type":"Question","name":"What breaking change did Bruno v4 introduce for variable annotations?","acceptedAnswer":{"@type":"Answer","text":"Bruno v4.0.0 adds typed variables using @number, @boolean, and @object annotations in .bru files, but collections using these annotations will not parse in Bruno versions older than v4.0.0. Teams with members still on v3 need to coordinate the upgrade before using typed variables in shared collections. Plain string variables remain unaffected and fully backward compatible. Teams coordinating a Bruno v4 upgrade can track breaking changes like this one on daily.dev."}},{"@type":"Question","name":"How do I declare a number type variable in a Bruno .bru file?","acceptedAnswer":{"@type":"Answer","text":"Place the @number annotation on the line immediately above the variable, with no blank line between them, for example @number followed by timeout: 30. A blank line between the annotation and the variable name causes Bruno to treat the value as a plain string instead of a number. Developers configuring Bruno collections can find syntax details like this on daily.dev."}},{"@type":"Question","name":"How does Bruno infer variable types when set from a script?","acceptedAnswer":{"@type":"Answer","text":"Bruno infers the type automatically from the JavaScript value passed to methods like bru.setEnvVar or bru.setVar, writing the correct annotation without needing to specify it manually. Passing a number like 30 writes a @number annotation, true writes @boolean, and an object writes @object, so the type is preserved across runs and resolves correctly on the next request. Developers scripting Bruno requests can look up type inference behavior like this on daily.dev."}}]}
```

