Labels
Labels in API7 Enterprise (API7 Gateway) are key-value metadata attached to various entities to simplify organization, filtering, and management. As your infrastructure grows, labels become essential for identifying and categorizing resources by team, environment, or application.
Applied entities
You can apply labels to the following entities:
- Services: Group by business unit (e.g.,
department: sales) or application type (e.g.,app_type: internal). - Routes: Mark specific routes by API version (e.g.,
version: v1) or stability (e.g.,status: stable). - Consumers: Categorize API consumers by client type (e.g.,
client: mobile-app) or subscription tier (e.g.,tier: gold). - Gateway Groups: Identify groups by region (e.g.,
region: us-east) or provider (e.g.,cloud: aws). - SSL Certificates: Track certificates by issuer (e.g.,
issuer: letsencrypt) or expiration year.
Schema structure
Labels follow a simple key: value pattern. In the control plane API, labels are often returned as an AllLabels object—a map where each key contains an array of its assigned values across the system.
- Label Key: Must be unique and descriptive (e.g.,
env,project). - Label Value: The specific value for that key (e.g.,
prod,auth-service).
Use cases
Dashboard filtering
The API7 Gateway Dashboard uses labels to filter and search for resources. Instead of scrolling through hundreds of services, you can filter by a specific label to see only the relevant items.
Resource organization
Group resources into logical namespaces to manage permissions and visibility. For example, you can label all resources belonging to a "Payment" team with team: payment, making it easy for administrators to audit their configuration.
Policy-based routing
In advanced configurations, you can use consumer labels to apply conditional policies. For example, a plugin could check if a consumer has the label tier: gold and grant them higher rate limits compared to tier: silver consumers.