Skip to main content

Version: latest

ADC Configuration Reference

ADC uses configuration files to define services, routes, consumers, global rules, and SSL certificates in API7 Gateway. The configuration file can be in YAML or JSON format and serves as the single source of truth for declarative management.

This document describes the configuration file schema and variable syntax. See the ADC Command Reference for CLI usage and the ADC Workflow Guide for end-to-end workflows.

Configuration File Structure

An ADC configuration file has four top-level keys:

services:     # Service definitions with routes and upstreams
consumers: # Consumer definitions with credentials
global_rules: # Global plugin configurations
ssls: # SSL certificate configurations

All keys are optional. You can define a partial configuration that only includes the resources you want to manage.

Example Configuration

adc.yaml
services:
- name: httpbin-service
labels:
deployment: production
upstream:
name: Default Upstream
scheme: http
type: roundrobin
hash_on: vars
nodes:
- host: httpbin.org
port: 80
weight: 100
priority: 0
timeout:
connect: 60
send: 60
read: 60
retry_timeout: 0
keepalive_pool:
size: 320
idle_timeout: 60
requests: 1000
pass_host: pass
strip_path_prefix: true
routes:
- uris:
- /ip
name: get-ip
labels:
app: catalog
methods:
- GET
enable_websocket: false
priority: 0
- uris:
- /anything/*
name: anything
methods:
- GET
- POST
plugins:
proxy-rewrite:
uri: /get

consumers:
- username: jane
labels:
organisation: ACME
credentials:
- name: primary-key
labels:
type: internal
type: key-auth
config:
key: c1_yN0nCWousUfiR4EzfH

- username: john
labels:
organisation: API7.ai
credentials:
- name: primary-key
type: key-auth
config:
key: EIul6mAuYkLJ27on1aJD4

global_rules:
prometheus:
_meta:
disable: false
prefer_name: false

Variables

ADC supports three variable syntaxes, each resolving values from different sources.

Data Plane Environment Variables ($env://)

Use the $env:// syntax to reference environment variables on the data plane (gateway) instance at runtime. This is useful for values that differ across gateway instances or environments:

services:
- name: my-service
upstream:
nodes:
- host: $env://UPSTREAM_HOST
port: 80

The variable is resolved by the gateway when the configuration is loaded, not by ADC. See Custom Environment Variables for details.

ADC Environment Variables (${ENV})

Use the ${ENV} syntax for variables resolved by ADC itself when processing the configuration file. This is useful for externalizing secrets or environment-specific values:

consumers:
- username: api-user
credentials:
- name: api-key
type: key-auth
config:
key: ${API_KEY}

Set the environment variable before running ADC:

export API_KEY="my-secret-key"
adc sync -f adc.yaml

Built-in Variables (\${})

Use the \${} syntax (escaped dollar sign) to reference built-in variables that are evaluated per-request by the gateway:

plugins:
limit-count:
count: "\\${http_x_user_info.low_rate_limit}"
key: "\\${http_x_user_info.rate_limit_key}"
time_window: 60
key_type: var

Schema Reference

Service

FieldTypeRequiredDescription
namestringYesUnique service name
labelsobjectNoKey-value labels
upstreamobjectYesUpstream configuration
routesarrayNoRoute definitions
pluginsobjectNoService-level plugins
strip_path_prefixbooleanNoStrip the matched route prefix before forwarding

Route (nested under service)

FieldTypeRequiredDescription
namestringYesRoute name (unique within service)
urisarrayYesURI paths to match
methodsarrayNoHTTP methods to match
hostsarrayNoHost headers to match
labelsobjectNoKey-value labels
pluginsobjectNoRoute-level plugins
priorityintegerNoRoute matching priority (higher wins)
enable_websocketbooleanNoEnable WebSocket proxying

Upstream (nested under service)

FieldTypeRequiredDescription
namestringNoUpstream name
schemestringNoProtocol: http, https, grpc, grpcs
typestringNoLoad balancing: roundrobin, chash, ewma, least_conn
hash_onstringNoHash key source (for chash): vars, header, cookie, consumer
nodesarrayYesBackend nodes
timeoutobjectNoTimeout settings (connect, send, read) in seconds
pass_hoststringNoHost header behavior: pass, node, rewrite
keepalive_poolobjectNoConnection pool settings
retry_timeoutnumberNoRetry timeout in seconds (0 = no limit)

Consumer

FieldTypeRequiredDescription
usernamestringYesUnique consumer name
labelsobjectNoKey-value labels
credentialsarrayNoAuthentication credentials
pluginsobjectNoConsumer-level plugins

Credential (nested under consumer)

FieldTypeRequiredDescription
namestringYesCredential name
typestringYesAuthentication type: key-auth, basic-auth, jwt-auth, hmac-auth
configobjectYesType-specific configuration
labelsobjectNoKey-value labels

Global Rules

Global rules are defined as a map of plugin name to plugin configuration:

global_rules:
plugin-name:
_meta:
disable: false
# plugin-specific configuration

Additional Resources

API7.ai Logo

The digital world is connected by APIs,
API7.ai exists to make APIs more efficient, reliable, and secure.

Sign up for API7 newsletter

Product

API7 Gateway

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN PTE. LTD 2019 – 2026. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the Apache Software Foundation