Skip to main content

Version: latest

Consumers and Credentials

A Consumer represents the identity of an API caller, such as a developer, a partner application, or an internal service. By defining Consumers, you can apply security policies, rate limits, and access control at the identity level rather than just at the route or service level.

Consumer

A Consumer is a global entity in API7 Gateway that can be used across different Gateway Groups.

Key fields

FieldTypeRequiredDescription
usernamestringYesUnique identifier for the consumer. Pattern: ^[a-zA-Z0-9_-]+$. Max 512 characters.
descstringNoDescription of the consumer.
labelsobjectNoKey-value pairs for grouping and filtering consumers.
pluginsobjectNoPlugins applied specifically to this consumer (e.g., rate-limiting, acl).

Consumer Credential

A Consumer Credential is an authentication token or set of credentials attached to a Consumer. A single Consumer can have multiple credentials of different types, allowing for flexible authentication methods.

Key fields

FieldTypeRequiredDescription
namestringYesUnique name for the credential.
pluginsobjectYesThe authentication plugin configuration. Exactly one plugin is allowed per credential.

Supported credential types

API7 Gateway supports the following authentication methods for Consumer Credentials:

TypeDescription
key-authThe simplest method, using an API key passed in a header or query parameter.
basic-authStandard HTTP Basic Authentication using a username and password.
hmac-authEnhanced security using signed requests with a key and secret.
jwt-authToken-based authentication using JSON Web Tokens.

Authentication flow

The following diagram illustrates how the gateway processes credentials to identify a Consumer:

  1. The client sends a request with credentials (e.g., an apikey header).
  2. The gateway executes the corresponding authentication plugin configured on the Route or Service.
  3. The plugin validates the credential and maps it to a specific Consumer.
  4. Once identified, the gateway applies any plugins configured at the Consumer level.
  5. The request is proxied to the upstream service.

Next steps

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