Servers & Variables

Server Configuration

The servers array defines base URLs for your API. Use variables to make URLs dynamic for different environments, versions, or regions.

Key Concepts
  • url - Base URL for the API
  • description - Human-readable name
  • variables - Dynamic parts with defaults and allowed values

Basic Server Definition

Define one or more static server URLs. The first is the default.

Multiple Environments
servers:
- url: https://api.example.com/v1
description: Production server
- url: https://staging-api.example.com/v1
description: Staging server
- url: http://localhost:3000/v1
description: Development server

In Tigrister

All defined servers appear in the server dropdown. Switch between them instantly when testing endpoints in Area Mode or Preview.

Server Variables

Dynamic

Use {variable} syntax to create dynamic URL parts. Variables can have defaults and constrained values.

Environment Variable
servers:
- url: https://{environment}.api.example.com
description: Server with environment selection
variables:
environment:
default: production
description: Server environment
enum:
- production
- staging
- sandbox
production
https://production.api.example.com
staging
https://staging.api.example.com
sandbox
https://sandbox.api.example.com

Multiple Variables

Combine multiple variables for complex URL patterns.

Region + Version
servers:
- url: https://{region}.api.example.com/{version}
description: Regional API server
variables:
region:
default: us
description: API region
enum:
- us
- eu
- apac
version:
default: v2
description: API version
enum:
- v1
- v2
Resulting URLs
https://us.api.example.com/v2
https://eu.api.example.com/v2
https://apac.api.example.com/v1
https://us.api.example.com/v1

Port Variable

Useful for local development with different port configurations.

servers:
- url: http://localhost:{port}
description: Local development server
variables:
port:
default: '8080'
description: Server port
enum:
- '8080'
- '3000'
- '5000'

Note

Port values must be strings in YAML (quoted or unquoted, depending on context). Unquoted 8080 works, but '8080' is safer.

Free-Form Variables

Variables without enum allow any value. Useful for tenant IDs or user-defined subdomains.

Tenant-Based URL
servers:
- url: https://{tenant}.saas-platform.com/api
description: Tenant-specific API
variables:
tenant:
default: demo
description: Tenant subdomain
# No enum - any value allowed

Operation-Level Servers

Override

Override global servers for specific paths or operations. Useful when some endpoints are hosted elsewhere.

# Global servers
servers:
- url: https://api.example.com
paths:
/users:
get:
summary: List users
# Uses global server
/files:
# Path-level override
servers:
- url: https://files.example.com
description: File storage server
get:
summary: List files
/metrics:
get:
summary: Get metrics
# Operation-level override
servers:
- url: https://metrics.example.com

Environment Integration

Tigrister

Tigrister's environment system works alongside OpenAPI servers. Use environments for runtime values, servers for spec-defined bases.

OpenAPI Servers
  • • Defined in the spec
  • • Available in dropdown
  • • Variables with enum constraints
  • • Shared across export
Tigrister Environments
  • • Runtime variable storage
  • • Secrets (tokens, keys)
  • • Per-request overrides
  • • Not exported to spec

Best Practice

Define your known server URLs in the spec. Use Tigrister environments for sensitive values (API keys, tokens) that shouldn't be in the spec.

Tigrister Server Features

Auto

Tigrister provides automatic conversions and intelligent handling for server configurations.

Variable Syntax Conversion

OpenAPI uses {var} syntax. Tigrister automatically converts this to {{var}} for environment variable substitution.

OpenAPI
https://{env}.api.com
Tigrister
https://{{env}}.api.com
Secret Auto-Detection

Variables with "secret" in their description are automatically marked as secret in Tigrister environments, hiding values in the UI.

api_key:
default: ''
description: API secret key # Auto-marked as secret
Environment ID Persistence

Tigrister uses x-tigrister-env-id andx-tigrister-env-name extensions to preserve environment identities across import/export cycles.

Visual Designer

The Servers section in Visual Designer provides:

  • • Add/remove servers with one click
  • • Edit URL and description inline
  • • View variable values (e.g., environment=api)
  • • Empty state with quick-add button

Common Patterns

Production + Staging + Local
servers:
- url: https://api.example.com
- url: https://staging.api.example.com
- url: http://localhost:3000
Versioned API
servers:
- url: https://api.example.com/v{version}
variables:
version:
default: '2'
enum: ['1', '2', '3']
Multi-Region
servers:
- url: https://us.api.example.com
- url: https://eu.api.example.com
- url: https://asia.api.example.com