TYK OAS API Object
x-tyk-gateway
-
infoType: Info
Info contains the main metadata about the API definition.
-
upstreamType: Upstream
Upstream contains the configurations related to the upstream.
-
serverType: Server
Server contains the configurations related to the server.
-
middlewareType: Middleware
Middleware contains the configurations related to the proxy middleware.
Info
-
idType:
stringID is the unique ID of the API.
Old API Definition:
api_id -
dbIdType:
objectDBID is the unique database ID of the API.
Old API Definition:
id -
orgIdType:
stringOrgID is the ID of the organisation which the API belongs to.
Old API Definition:
org_id -
nameType:
stringName is the name of the API.
Old API Definition:
name -
expirationType:
string -
stateType: State
-
versioningType: Versioning
State
-
activeType:
booleanActive enables the API.
Old API Definition:
active -
internalType:
booleanInternal makes the API accessible only internally.
Old API Definition:
internal
Versioning
-
enabledType:
boolean -
nameType:
string -
defaultType:
string -
locationType:
string -
keyType:
string -
versionsType:
[]VersionToID -
stripVersioningDataType:
boolean
VersionToID
-
nameType:
string -
idType:
string
Upstream
-
urlType:
stringURL defines the target URL that the request should be proxied to.
Old API Definition:
proxy.target_url -
serviceDiscoveryType: ServiceDiscovery
ServiceDiscovery contains the configuration related to Service Discovery.
Old API Definition:
proxy.service_discovery -
testType: Test
Test contains the configuration related to uptime tests.
-
mutualTLSType: MutualTLS
MutualTLS contains the configuration related to upstream mutual TLS.
-
certificatePinningType: CertificatePinning
CertificatePinning contains the configuration related to certificate pinning.
ServiceDiscovery
-
enabledType:
booleanEnabled enables Service Discovery.
Old API Definition:
service_discovery.use_discovery_service -
queryEndpointType:
stringQueryEndpoint is the endpoint to call, this would usually be Consul, etcd or Eureka K/V store.
Old API Definition:
service_discovery.query_endpoint -
dataPathType:
stringDataPath is the namespace of the data path - where exactly in your service response the namespace can be found.
For example, if your service responds with:
{ "action": "get", "node": { "key": "/services/single", "value": "http://httpbin.org:6000", "modifiedIndex": 6, "createdIndex": 6 } }then your namespace would be
node.value.Old API Definition:
service_discovery.data_path -
useNestedQueryType:
booleanUseNestedQuery enables using a combination of
dataPathandparentDataPath.It is necessary when the data lives within this string-encoded JSON object.
{ "action": "get", "node": { "key": "/services/single", "value": "{"hostname": "http://httpbin.org", "port": "80"}", "modifiedIndex": 6, "createdIndex": 6 } }Old API Definition:
service_discovery.use_nested_query -
parentDataPathType:
stringParentDataPath is the namespace of the where to find the nested value, if
useNestedQueryistrue.In the above example, it would be
node.value. You would then change thedataPathsetting to behostname,since this is where the host name data resides in the JSON string.
Tyk automatically assumes that
dataPathin this case is in a string-encoded JSON object and will try to deserialize it.Old API Definition:
service_discovery.parent_data_path -
portDataPathType:
stringPortDataPath is the port of the data path. In the above nested example, we can see that there is a separate
portvaluefor the service in the nested JSON. In this case, you can set the
portDataPathvalue and Tyk will treatdataPathas the hostname and zip them together (this assumes that the hostname element does not end in a slash or resource identifier
such as
/widgets/). In the above example, theportDataPathwould beport.Old API Definition:
service_discovery.port_data_path -
useTargetListType:
booleanUseTargetList should be set to
true, if you are using load balancing. Tyk will treat the data path as a list andinject it into the target list of your API Definition.
Old API Definition:
service_discovery.use_target_list -
cacheTimeoutType:
intCacheTimeout is the timeout of a cache value when a new data is loaded from a discovery service.
Setting it too low will cause Tyk to call the SD service too often, setting it too high could mean that
failures are not recovered from quickly enough.
Old API Definition:
service_discovery.cache_timeout -
targetPathType:
stringTargetPath is to set a target path to append to the discovered endpoint, since many SD services
only provide host and port data. It is important to be able to target a specific resource on that host.
Setting this value will enable that.
Old API Definition:
service_discovery.target_path -
endpointReturnsListType:
booleanEndpointReturnsList is set
truewhen the response type is a list instead of an object.Old API Definition:
service_discovery.endpoint_returns_list
Test
-
serviceDiscoveryType: ServiceDiscovery
ServiceDiscovery contains the configuration related to test Service Discovery.
Old API Definition:
proxy.service_discovery
MutualTLS
-
enabledType:
booleanEnabled enables/disables upstream mutual TLS auth for the API.
Old API Definition:
upstream_certificates_disabled -
domainToCertificateMappingType:
[]DomainToCertificateDomainToCertificate maintains the mapping of domain to certificate.
Old API Definition:
upstream_certificates
DomainToCertificate
-
domainType:
string -
certificateType:
string
CertificatePinning
-
enabledType:
booleanEnabled enables/disables certificate pinning for the API.
Old API Definition:
certificate_pinning_disabled -
domainToPublicKeysMappingType:
[]PinnedPublicKeyDomainToPublicKeysMapping maintains the mapping of domain to pinned public keys.
Old API Definition:
pinned_public_keys
PinnedPublicKey
-
domainType:
string -
publicKeysType:
[]string
Server
-
listenPathType: ListenPath
ListenPath represents the path to listen on. Any requests coming into the host, on the port that Tyk is configured to run on,
that match this path will have the rules defined in the API Definition applied.
-
slugType:
stringSlug is the Tyk Cloud equivalent of listen path.
Old API Definition:
slug -
authenticationType: Authentication
Authentication contains the configurations related to authentication to the API.
-
clientCertificatesType: ClientCertificates
ClientCertificates contains the configurations related to static mTLS.
-
gatewayTagsType: GatewayTags
GatewayTags contains segment tags to configure which GWs your APIs connect to
-
customDomainType: Domain
CustomDomain is the domain to bind this API to.
Old API Definition:
domain
ListenPath
-
valueType:
stringValue is the value of the listen path e.g.
/api/or/or/httpbin/.Old API Definition:
proxy.listen_path -
stripType:
booleanStrip removes the inbound listen path in the outgoing request. e.g.
http://acme.com/httpbin/getwherehttpbinis the listen path. The
httpbinlisten path which is used to identify the API loaded in Tyk is removed,and the outbound request would be
http://httpbin.org/get.Old API Definition:
proxy.strip_listen_path
Authentication
-
enabledType:
booleanEnabled makes the API protected when one of the authentication modes is enabled.
Old API Definition:
!use_keyless -
stripAuthorizationDataType:
booleanStripAuthorizationData ensures that any security tokens used for accessing APIs are stripped and not leaked to the upstream.
Old API Definition:
strip_auth_data -
baseIdentityProviderType:
objectBaseIdentityProvider enables multi authentication mechanism and provides the session object that determines rate limits, ACL rules and quotas.
It should be set to one of the following:
-
auth_token -
hmac_key -
basic_auth_user -
jwt_claim -
oidc_user -
oauth_key
Old API Definition:
base_identity_provided_by -
-
hmacType: HMAC
HMAC contains the configurations related to HMAC authentication mode.
Old API Definition:
auth_configs["hmac"] -
oidcType: OIDC
OIDC contains the configurations related to OIDC authentication mode.
Old API Definition:
auth_configs["oidc"] -
goPluginType: GoPlugin
GoPlugin contains the configurations related to GoPlugin authentication mode.
-
customPluginType: CustomPlugin
CustomPlugin contains the configurations related to CustomPlugin authentication mode.
Old API Definition:
auth_configs["coprocess"] -
securitySchemesType:
map[string]any
HMAC
-
enabledType:
booleanEnabled enables the HMAC authentication mode.
Old API Definition:
enable_signature_checking -
headerType: AuthSource
Header contains configurations of the header auth source, it is enabled by default.
Old API Definition:
-
cookieType: AuthSource
Cookie contains configurations of the cookie auth source.
Old API Definition:
api_id -
queryType: AuthSource
Param contains configurations of the param auth source.
Old API Definition:
api_id -
allowedAlgorithmsType:
[]stringAllowedAlgorithms is the array of HMAC algorithms which are allowed. Tyk supports the following HMAC algorithms:
-
hmac-sha1 -
hmac-sha256 -
hmac-sha384 -
hmac-sha512
and reads the value from algorithm header.
Old API Definition:
hmac_allowed_algorithms -
-
allowedClockSkewType:
doubleAllowedClockSkew is the amount of milliseconds that will be tolerated for clock skew. It is used against replay attacks.
The default value is
0, which deactivates clock skew checks.Old API Definition:
hmac_allowed_clock_skew
AuthSources
-
headerType: AuthSource
Header contains configurations of the header auth source, it is enabled by default.
Old API Definition:
-
cookieType: AuthSource
Cookie contains configurations of the cookie auth source.
Old API Definition:
api_id -
queryType: AuthSource
Param contains configurations of the param auth source.
Old API Definition:
api_id
AuthSource
-
enabledType:
booleanEnabled enables the auth source.
Old API Definition:
auth_configs[X].use_param/use_cookie -
nameType:
stringName is the name of the auth source.
Old API Definition:
auth_configs[X].param_name/cookie_name
OIDC
-
enabledType:
booleanEnabled enables the OIDC authentication mode.
Old API Definition:
use_openid -
headerType: AuthSource
Header contains configurations of the header auth source, it is enabled by default.
Old API Definition:
-
cookieType: AuthSource
Cookie contains configurations of the cookie auth source.
Old API Definition:
api_id -
queryType: AuthSource
Param contains configurations of the param auth source.
Old API Definition:
api_id -
segregateByClientIdType:
boolean -
providersType:
[]Provider -
scopesType: Scopes
Provider
-
issuerType:
string -
clientToPolicyMappingType:
[]ClientToPolicy
ClientToPolicy
-
clientIdType:
string -
policyIdType:
string
Scopes
-
claimNameType:
string -
scopeToPolicyMappingType:
[]ScopeToPolicy
ScopeToPolicy
-
scopeType:
string -
policyIdType:
string
GoPlugin
-
enabledType:
booleanEnabled enables the GoPlugin authentication mode.
Old API Definition:
use_go_plugin_auth
CustomPlugin
-
enabledType:
booleanEnabled enables the CustomPlugin authentication mode.
Old API Definition:
enable_coprocess_auth -
headerType: AuthSource
Header contains configurations of the header auth source, it is enabled by default.
Old API Definition:
-
cookieType: AuthSource
Cookie contains configurations of the cookie auth source.
Old API Definition:
api_id -
queryType: AuthSource
Param contains configurations of the param auth source.
Old API Definition:
api_id
ClientCertificates
-
enabledType:
booleanEnabled enables static mTLS for the API.
-
allowlistType:
[]stringAllowList is the list of client certificates which are allowed.
GatewayTags
-
enabledType:
booleanEnabled enables use of segment tags.
-
tagsType:
[]stringTags is a list of segment tags
Domain
-
enabledType:
booleanEnabled allow/disallow the usage of the domain.
-
nameType:
stringName is the name of the domain.
Middleware
-
globalType: Global
Global contains the configurations related to the global middleware.
-
operationsType:
map[string]Operation
Global
-
corsType: CORS
-
cacheType: Cache
Cache contains the configurations related to caching.
Old API Definition:
cache_options
CORS
-
enabledType:
boolean -
maxAgeType:
int -
allowCredentialsType:
boolean -
exposedHeadersType:
[]string -
allowedHeadersType:
[]string -
optionsPassthroughType:
boolean -
debugType:
boolean -
allowedOriginsType:
[]string -
allowedMethodsType:
[]string
Cache
-
enabledType:
booleanEnabled turns global cache middleware on or off. It is still possible to enable caching on a per-path basis
by explicitly setting the endpoint cache middleware.
Old API Definition:
cache_options.enable_cache -
timeoutType:
intTimeout is the TTL for a cached object in seconds.
Old API Definition:
cache_options.cache_timeout -
cacheAllSafeRequestsType:
booleanCacheAllSafeRequests caches responses to (
GET,HEAD,OPTIONS) requests overrides per-path cache settings in versions,applies across versions.
Old API Definition:
cache_options.cache_all_safe_requests -
cacheResponseCodesType:
[]intCacheResponseCodes is an array of response codes which are safe to cache e.g.
404.Old API Definition:
cache_options.cache_response_codes -
cacheByHeadersType:
[]stringCacheByHeaders allows header values to be used as part of the cache key.
Old API Definition:
cache_options.cache_by_headers -
enableUpstreamCacheControlType:
booleanEnableUpstreamCacheControl instructs Tyk Cache to respect upstream cache control headers.
Old API Definition:
cache_options.enable_upstream_cache_control -
controlTTLHeaderNameType:
stringControlTTLHeaderName is the response header which tells Tyk how long it is safe to cache the response for.
Old API Definition:
cache_options.cache_control_ttl_header
Operation
-
allowType: Allowance
-
blockType: Allowance
-
ignoreAuthenticationType: Allowance
-
transformRequestMethodType: TransformRequestMethod
TransformRequestMethod allows you to transform the method of a request.
-
transformRequestBodyType: TransformRequestBody
TransformRequestBody allows you to transform request body.
When both
pathandbodyare provided, body would take precedence. -
cacheType: CachePlugin
-
enforceTimeoutType: EnforceTimeout
-
validateRequestType: ValidateRequest
Allowance
-
enabledType:
boolean -
ignoreCaseType:
boolean
TransformRequestMethod
-
enabledType:
booleanEnabled enables Method Transform for the given path and method.
-
toMethodType:
stringToMethod is the http method value to which the method of an incoming request will be transformed.
TransformRequestBody
-
enabledType:
booleanEnabled enables transform request body middleware.
-
formatType:
objectFormat of the request body, xml or json.
-
pathType:
stringPath file path for the template.
-
bodyType:
stringBody base64 encoded representation of the template.
CachePlugin
-
enabledType:
boolean -
cacheByRegexType:
string -
cacheResponseCodesType:
[]int
EnforceTimeout
-
enabledType:
boolean -
valueType:
int
ValidateRequest
-
enabledType:
boolean -
errorResponseCodeType:
int