Bruno (.bru) File Generation Guide
Purpose: This guide provides complete specifications for generating Bruno API collection files (.bru) that Claude (or any AI) can use to automatically create API documentation from code.
Table of Contents
- Overview
- File Structure
- Component Specifications
- Complete Examples
- Generation Rules
- AI Generation Template
Overview
What is Bruno?
- Modern, open-source API client (alternative to Postman)
- Uses plain-text
.brufiles stored in filesystem - Git-friendly, version-controllable format
- Collections organized as folders
File Types:
- Request files (
*.bru) - HTTP requests with method, URL, body, auth - Folder files (
folder.bru) - Folder metadata and inheritance - Environment files (
environments/*.bru) - Variables and configurations
File Structure
Directory Structure
kulcare-apis/
├── environments/
│ ├── local.bru
│ └── staging.bru
├── Auth/
│ ├── folder.bru
│ ├── Sign up.bru
│ └── Sign in.bru
├── Users/
│ ├── folder.bru
│ ├── Profile.bru
│ └── Update.bru
└── Reference/
├── folder.bru
└── Drugs/
├── folder.bru
└── list drugs.bruNaming Conventions
- Request files: PascalCase (e.g.,
Sign up.bru,List drugs.bru) - Folder files: Must be named
folder.bru - Environment files:
{environment-name}.bru(e.g.,local.bru,staging.bru)
Component Specifications
1. Meta Section (REQUIRED)
Every .bru file must start with a meta section.
meta {
name: Human Readable Name
type: http
seq: 1
}Fields:
name: Display name (can have spaces, any case)type: Alwayshttpfor requestsseq: Sequence number (order in collection, integer)
2. HTTP Method Block (REQUIRED)
Format: {method} { ... } where method is lowercase
Supported Methods:
get- GET requestspost- POST requestsput- PUT requestspatch- PATCH requestsdelete- DELETE requests
GET Request (No Body)
get {
url: {{url}}/api/endpoint
body: none
auth: inherit
}POST Request (JSON Body)
post {
url: {{url}}/api/endpoint
body: json
auth: bearer
}PUT/PATCH Request
put {
url: {{url}}/api/endpoint/{{id}}
body: json
auth: bearer
}Fields:
url: Full URL with{{variable}}substitutionsbody:none|json|formdata|multipart|graphqlauth:inherit|bearer|basic|none
3. Authentication Block (OPTIONAL)
Bearer Token
auth:bearer {
token: eyJhbGciOiJIUzI1NiJ9...
}Basic Auth
auth:basic {
username: user@example.com
password: password123
}Inherit from Folder
auth {
mode: inherit
}Use inherit when authentication is managed at folder level.
4. Request Body (OPTIONAL)
JSON Body
body:json {
{
"user": {
"email": "user@example.com",
"first_name": "John",
"last_name": "Doe"
}
}
}Rules:
- Must be valid JSON
- Use double quotes for keys and string values
- Use
{{variables}}for dynamic values - Format with proper indentation (2 spaces)
Form Data
body:formdata {
user[email]: user@example.com
user[password]: secret123
}5. Query Parameters
Include directly in URL:
get {
url: {{url}}/api/drugs?page=1&per_page=20&search=aspirin
body: none
auth: none
}Or use variables:
get {
url: {{url}}/api/drugs?page={{page}}&per_page={{per_page}}
body: none
auth: none
}6. Headers
Headers are typically auto-generated, but can be specified:
headers {
Content-Type: application/json
Accept: application/json
X-Custom-Header: value
}7. Settings (OPTIONAL)
settings {
encodeUrl: true
timeout: 0
}Fields:
encodeUrl: URL encode the request URL (true/false)timeout: Request timeout in milliseconds (0 = no timeout)
8. Example Section (OPTIONAL)
For documentation and mock responses:
example {
name: Success response
request: {
url: {{url}}/api/endpoint
method: POST
mode: json
body:json: {
{
"param": "value"
}
}
}
response: {
status: {
code: 200
text: OK
}
headers: {
content-type: application/json
}
body: {
type: json
content: '''
{
"success": true,
"data": {
"id": "123",
"name": "Example"
}
}
'''
}
}
}Multi-line content uses triple single quotes: '''
9. Folder Metadata (folder.bru)
meta {
name: Folder Name
seq: 1
}
auth {
mode: inherit
}Purpose:
- Define folder display name
- Set default authentication for all requests in folder
- Organize collection hierarchy
10. Environment Variables
vars {
url: http://localhost:3000
access_token: {{access_token}}
api_version: v1
}Usage:
- Reference with
{{variable_name}}in request URLs - Manage different environments (local, staging, production)
- Store sensitive data separately from requests
Complete Examples
Example 1: Simple GET Request (No Auth)
File: Reference/Countries.bru
meta {
name: Countries
type: http
seq: 1
}
get {
url: {{url}}/reference/countries
body: none
auth: none
}
settings {
encodeUrl: true
timeout: 0
}Example 2: POST Request with JSON Body (No Auth)
File: Auth/Sign up.bru
meta {
name: Sign up
type: http
seq: 1
}
post {
url: {{url}}/identity/registrations
body: json
auth: inherit
}
body:json {
{
"user": {
"email": "user@example.com",
"phone_country_code": "91",
"phone_number": "9888873165",
"password": "SecurePass123",
"first_name": "John",
"last_name": "Doe",
"timezone": "Asia/Kolkata",
"preferred_language": "en",
"signed_up_as": "practitioner"
}
}
}
settings {
encodeUrl: true
timeout: 0
}
example {
name: Sign up success
request: {
url: {{url}}/identity/registrations
method: POST
mode: json
body:json: {
{
"user": {
"email": "user@example.com",
"password": "SecurePass123",
"first_name": "John",
"last_name": "Doe"
}
}
}
}
response: {
status: {
code: 200
text: OK
}
body: {
type: json
content: '''
{"success":true,"data":{"id":"123","createdAt":"2026-01-06T12:39:58Z","updatedAt":"2026-01-06T12:39:58Z","email":"user@example.com","firstName":"John","lastName":"Doe","fullName":"John Doe"}}
'''
}
}
}Example 3: GET Request with Bearer Auth
File: Users/Profile.bru
meta {
name: Profile
type: http
seq: 3
}
get {
url: {{url}}/identity/users/profile
body: none
auth: bearer
}
auth:bearer {
token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDE5Yjk3OWQtN2E4Ny03MGU1LTgzMjctMjUxOWRjNmQ5ZjU4IiwiZXhwIjoxNzY3ODY4MzIxfQ.fq6JApvHqulJLKMFT97NPBEhk38thAU4skpUd9YJSIc
}
settings {
encodeUrl: true
timeout: 0
}Example 4: PUT Request with Auth
File: Users/Update.bru
meta {
name: Update
type: http
seq: 4
}
put {
url: {{url}}/identity/users/{{user_id}}
body: json
auth: bearer
}
auth:bearer {
token: {{access_token}}
}
body:json {
{
"user": {
"first_name": "John",
"middle_name": "M",
"last_name": "Doe",
"timezone": "Asia/Kolkata",
"preferred_language": "en"
}
}
}
settings {
encodeUrl: true
timeout: 0
}Example 5: GET with Query Parameters
File: Reference/Drugs/list drugs.bru
meta {
name: List drugs
type: http
seq: 1
}
get {
url: {{url}}/reference/drugs?page={{page}}&per_page={{per_page}}&search={{search}}
body: none
auth: none
}
settings {
encodeUrl: true
timeout: 0
}Example 6: Folder Configuration
File: Auth/folder.bru
meta {
name: Auth
seq: 1
}
auth {
mode: inherit
}Example 7: Environment Configuration
File: environments/local.bru
vars {
url: http://localhost:3000
access_token: your_token_here
page: 1
per_page: 20
}File: environments/staging.bru
vars {
url: https://staging-api.kulcare.com
access_token: your_staging_token
page: 1
per_page: 50
}Generation Rules
Must-Follow Rules
-
File Names:
- Request files: PascalCase with spaces (e.g.,
Sign up.bru) - Folder files: Exactly
folder.bru - Environment files:
{name}.bru(lowercase)
- Request files: PascalCase with spaces (e.g.,
-
Meta Section:
- Must be first section in every file
namefield requiredtype: httpfor request files- Omit
typefor folder files
-
HTTP Methods:
- Use lowercase:
get,post,put,patch,delete - Method block must include
url,body,auth
- Use lowercase:
-
URL Format:
- Use
{{variable}}for dynamic parts - Include query parameters directly in URL
- Use full path after domain
- Use
-
Body Format:
- JSON must be valid (double quotes, proper commas)
- Use 2-space indentation
- No trailing commas
-
Auth:
inherit: Use folder-level authbearer: Token inauth:bearerblockbasic: Username/password inauth:basicblocknone: No authentication
-
Example Section:
- Optional but recommended for documentation
- Use triple single quotes for multi-line content
- Include both request and response
Formatting Standards
- Indentation: 2 spaces for nested structures
- Spacing: One blank line between sections
- Line Length: No strict limit, but prefer readable lengths
- Comments: Not supported in .bru format
Variable Naming
- Use snake_case for variables:
{{access_token}},{{api_version}} - Common variables:
{{url}}- Base URL{{access_token}}- Bearer token{{user_id}}- Resource ID{{page}},{{per_page}}- Pagination
AI Generation Template
Template for Generating .bru Files
When asked to generate .bru files, use this structure:
For each API endpoint:
1. Create directory structure matching resource hierarchy
2. Generate folder.bru for each directory
3. Generate {Action}.bru file for each endpoint
4. Generate environment files if needed
Output format:
- Show complete .bru file content
- Include file path as comment
- Follow all formatting rules strictlyGeneration Prompt Template
Copy this prompt when asking AI to generate .bru files:
Generate Bruno (.bru) collection files for the following API endpoints:
[INSERT API ENDPOINTS HERE - e.g., Rails routes, API documentation]
Requirements:
1. Follow the bru-file-generation-guide.md specifications exactly
2. Create proper directory structure
3. Include folder.bru files for each directory
4. Use proper HTTP methods (get/post/put/patch/delete)
5. Include auth: bearer for authenticated endpoints
6. Use {{url}} variable for base URL
7. Include example request/response for POST/PUT endpoints
8. Follow PascalCase naming for request files
Context:
- Base URL: {{url}}
- Auth: Bearer token for most endpoints
- Response format: JSON
- Follow existing kulcare-apis/ structureExample Generation Request
Generate Bruno (.bru) files for these Rails routes:
GET /identity/users/profile
GET /identity/users/:id
PUT /identity/users/:id
POST /identity/registrations
POST /identity/sessions
Follow the bru-file-generation-guide.md specifications.
Use {{url}} as base URL variable.
Auth: bearer token required except for registrations/sessions.
Create proper folder structure.Quick Reference Card
HTTP Method Blocks
| Method | Syntax |
|---|---|
| GET | get { url: ... body: none auth: ... } |
| POST | post { url: ... body: json auth: ... } |
| PUT | put { url: ... body: json auth: ... } |
| PATCH | patch { url: ... body: json auth: ... } |
| DELETE | delete { url: ... body: none auth: ... } |
Auth Types
| Type | Syntax |
|---|---|
| None | auth: none |
| Inherit | auth: inherit |
| Bearer | auth: bearer + auth:bearer { token: ... } |
| Basic | auth: basic + auth:basic { username: ... password: ... } |
Body Types
| Type | Syntax |
|---|---|
| None | body: none |
| JSON | body:json + body:json { {...} } |
| Form | body:formdata + body:formdata { key: value } |
Essential Variables
{{url}}- Base URL{{access_token}}- Bearer token{{id}}- Resource ID{{page}},{{per_page}}- Pagination
Validation Checklist
Before finalizing .bru files, verify:
- Meta section present with name, type, seq
- HTTP method block lowercase (get/post/put/patch/delete)
- URL uses {{variable}} for base URL
- Body type specified (json/none/formdata)
- Auth type specified (inherit/bearer/basic/none)
- JSON body is valid (double quotes, no trailing commas)
- File naming follows PascalCase for requests
- folder.bru files in each directory
- Environment variables defined in environments/*.bru
- Example section included for documentation endpoints
Additional Resources
- Bruno Documentation: https://docs.usebruno.com/
- Collection Format: https://docs.usebruno.com/bru-cli/bru-file-format.html
- Installation: https://docs.usebruno.com/installation/introduction.html
Last Updated: 2026-01-12 Version: 1.0 Maintainer: Kulcare Development Team