March 25, 2025
SDKs
Young-jin Park

Templated base URLs

For APIs where the base URL includes dynamic segments like a region subdomain (https://{region}.acme.com), you can map client options to them with the server_variable property in your Stainless config.

This allows your SDK users to set region directly without constructing custom baseURLs.

// now
const client = new Acme({ region: 'us-east-2' })
// before
const client = new Acme({ baseURL: 'https://us-east-2.amazonaws.com' })
# Stainless config
client_settings:
	opts:
		region:
			type: string
			env: ACME_REGION
			nullable: false
			server_variable: region