Upsert a service

Create or Update service using ID or name.

put

Path Parameters

service_idstringrequired

ID or name of the service to lookup

Example:7fca84d6-7d37-4a74-a7b0-93e576089a41

runtimeGroupIdstringrequired

The ID of your runtime group. This variable is available in the Konnect manager

Example:9524ec7d-36d9-465d-a8c5-83a3c9390458

Body

application/json
namestring

The service name.

Example:my-service

retriesinteger

The number of retries to execute upon failure to proxy. Default:5.

Default:5

Example:5

protocolstringrequired

The protocol used to communicate with the upstream. Accepted values are: grpc, grpcs, http, https, tcp, tls, tls_passthrough, udp, ws
, wss
. Default: http.

Allowed values:grpcgrpcshttphttpstcptls tls_passthroughudpwswss

Default:http

Example:http

hoststringrequired

The host of the upstream server. Note that the host value is case sensitive.

Example:example.com

portintegerrequired

The upstream server port. Default: 80.

Default:80

Example:80

pathstring

The path to be used in requests to the upstream server.

Example:/some_api

connect_timeoutinteger

The timeout in milliseconds for establishing a connection to the upstream server. Default: 60000.

Default:6000

Example:6000

write_timeoutinteger

The timeout in milliseconds between two successive write operations for transmitting a request to the upstream server. Default: 60000.

Default:6000

Example:6000

read_timeoutinteger

The timeout in milliseconds between two successive read operations for transmitting a request to the upstream server. Default: 60000.

Default:6000

Example:6000

tagsarray[string]

An optional set of strings associated with the service for grouping and filtering.

Example:user-level

client_certificateobject

Certificate to be used as client certificate while TLS handshaking to the upstream server. With form-encoded, the notation is client_certificate.id=<client_certificate id>. With JSON, use client_certificate:{id:<client_certificate id>}.

Show Child Parameters
tls_verifyboolean

Whether to enable verification of upstream server TLS certificate. If set to null, then the Nginx default is respected.

Default:true

tls_verify_depthstring | null

Maximum depth of chain while verifying Upstream server’s TLS certificate. If set to null, then the Nginx default is respected. Default: null.

Default:null

Example:respected

ca_certificatesarray[string]

Array of CA Certificate object UUIDs that are used to build the trust store while verifying upstream server’s TLS certificate. If set to null when Nginx default is respected. With form-encoded, the notation is ca_certificates[]=4e3ad2e4-0bc4-4638-8e34-c84a417ba39b&ca_certificates[]=51e77dc2-8f3e-4afa-9d0e-0e3bbbcfd515. With JSON, use an Array.

Example:4e3ad2e4-0bc4-4638-8e34-c84a417ba39b

enabledbooleanrequired

Whether the service is active. If set to false, the proxy behavior will be as if any routes attached to it do not exist (404). Default: true.

Default:true

Response

application/json

The service response object is returned when creating a new service or retreiving an existing service.

connect_timeoutinteger
created_atinteger

Unix epoch when the resource was last created.

enabledboolean

Service enabled boolean

hoststring
idstring
namestring
pathstring
portinteger
protocolstring
read_timeoutinteger
retriesinteger
updated_atinteger
write_timeoutinteger
put/runtime-groups/{runtimeGroupId}/core-entities/services/{service_id}

Body

{ "name": "my-service", "retries": 5, "protocol": "http", "host": "example.com", "port": 80, "path": "/some_api", "connect_timeout": 6000, "write_timeout": 6000, "read_timeout": 6000, "tags": [ "user-level" ], "client_certificate": { "id": "4e3ad2e4-0bc4-4638-8e34-c84a417ba39b" }, "tls_verify": true, "tls_verify_depth": null, "ca_certificates": [ "4e3ad2e4-0bc4-4638-8e34-c84a417ba39b" ], "enabled": true }
 
application/json

Routes

Gateway routes

List all routes

List all routes

route entities define rules to match client requests. Each route is associated with a service, and a service may have multiple routes associated to it. Every request matching a given route will be proxied to its associated service.

Note: Path handling algorithms v1 was deprecated in Kong 3.0. From Kong 3.0, when router_flavor is set to expressions, route.path_handling will be unconfigurable and the path handling behavior will be v0; when router_flavor is set to traditional_compatible, the path handling behavior will be v0 regardless of the value of route.path_handling. Only router_flavor = traditional will support path_handling v1’ behavior.

get

Query Parameters

sizeinteger

Number of resources to be returned.

Default:100

>= 1<= 1000

offsetstring

Offset from which to return the next set of resources. Use the value of the ‘offset’ field from the response of a list operation as input here to paginate through all the resources

tagsstring

A list of tags to filter the list of resources on. Multiple tags can be concatenated using ‘,’ to mean AND or using ‘/’ to mean OR.

Example:tag1,tag2

Path Parameters

runtimeGroupIdstringrequired

The ID of your runtime group. This variable is available in the Konnect manager

Example:9524ec7d-36d9-465d-a8c5-83a3c9390458

Response

200 application/json

A successful response listing routes

dataarray[object]

Route entities define rules to match client requests. Every request matching a given route will be proxied to its associated service.

Example:{"hosts":["foo.example.com","foo.example.us"],"id":"56c4566c-14cc-4132-9011-4139fcbbe50a","name":"example-route","paths":["/v1","/v2"],"service":{"id":"bd380f99-659d-415e-b0e7-72ea05df3218"}}

Show Child Parameters
offsetstring

Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page

get/runtime-groups/{runtimeGroupId}/core-entities/routes
 
200 application/json

Create a new route

Create a new route

post

Path Parameters

runtimeGroupIdstringrequired

The ID of your runtime group. This variable is available in the Konnect manager

Example:9524ec7d-36d9-465d-a8c5-83a3c9390458

Body

application/json

Route request body

namestring

The name of the route. Route names must be unique, and they are case sensitive. For example, there can be two different routes named “test” and “Test”.

protocolsarray[string]required

An array of the protocols this route should allow

Default:https

Example:tcp

methodsarray[string]

A list of HTTP methods that match this route.

Example:GET

hostsarray[string]

A list of domain names that match this route. Note that the hosts value is case sensitive. With form-encoded, the notation is hosts[]=example.com&hosts[]=foo.test. With JSON, use an Array.

pathsarray[string]

A list of paths that match this route. With form-encoded, the notation is paths[]=/foo&paths[]=/bar. With JSON, use an array. The path can be a regular expression, or a plain text pattern.

headersobject

One or more lists of values indexed by header name that will cause this route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. When headers contains only one value and that value starts with the special prefix ~*, the value is interpreted as a regular expression.

Show Child Parameters
https_redirect_status_codeintegerrequired

The status code Kong responds with when all properties of a route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS
Location header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the route is configured to only accept the https protocol. Accepted values are: 426, 301, 302, 307, 308. Default: 426.

Allowed values:426301302307308

Default:426

Example:426

regex_priorityinteger

A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. When two routes match the path and have the same regex_priority, the older one (lowest created_at) is used. Note that the priority for non-regex routes is different (longer non-regex routes are matched before shorter ones). Default: 0.

Default:0

Example:0

strip_pathboolean

When matching a route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.

Default:true

path_handlingstring

Controls how the service path, route path and requested path are combined when sending a request to the upstream. Accepted values are: v0, v1. Default: v0.

Allowed values:v1v0

Example:v0

preserve_hostbooleanrequired

When matching a route via one of the hosts domain names, use the request host header in the upstream request headers. If set to false, the upstream Host header will be that of the service’s host.

Default:true

request_bufferingbooleanrequired

Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.

Default:true

response_bufferingbooleanrequired

Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.

Default:true

snisarray[string]

A list of SNIs that match this route when using stream routing.

sourcesarray[object]

A list of IP sources of incoming connections that match this route when using stream routing. Each entry is an object with fields “ip” (optionally in CIDR range notation) and/or “port”.

Show Child Parameters
destinationsarray[object]

A list of IP destinations of incoming connections that match this route when using stream routing. Each entry is an object with fields “ip” (optionally in CIDR range notation) and/or “port”.

Show Child Parameters
tagsarray[string]

An optional set of strings associated with the route for grouping and filtering.

serviceobject

The service this route is associated to. This is where the route proxies traffic to. With form-encoded, the notation is service.id= or service.name=. With JSON, use “service:{id:<service id>} or service:{name:<service name>}.

Show Child Parameters

Response

application/json

Successfully created route

Route

Route entities define rules to match client requests. Every request matching a given route will be proxied to its associated service.

created_atinteger

Unix epoch when the resource was created.

destinationsarray[object]

A list of IP destinations of incoming connections that match this route when using stream routing. Each entry is an object with fields ip (optionally in CIDR range notation) and/or port.

headersobject

One or more lists of values indexed by header name that will cause this route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. When headers contains only one value and that value starts with the special prefix ~*, the value is interpreted as a regular expression.

hostsarray[string]

A list of domain names that match this route. Note that the hosts value is case sensitive.

Example:foo.example.com

https_redirect_status_codeinteger

The status code Kong responds with when all properties of a route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the route is configured to only accept the https protocol.

Default:426

idstring

Example:56c4566c-14cc-4132-9011-4139fcbbe50a

methodsarray[string]

A list of HTTP methods that match this route.

namestring

The name of the route. Route names must be unique, and they are case sensitive. For example, there can be two different routes named test and Test.

path_handlingstring

Controls how the service path, route path and requested path are combined when sending a request to the upstream. See above for a detailed description of each behavior.

Default:v0

pathsarray[string]

A list of paths that match this route.

preserve_hostboolean

When matching a route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the service’s host.

Default:false

protocolsarray[string]

An array of the protocols this route should allow. See the route Object section for a list of accepted protocols. When set to only https, HTTP requests are answered with an upgrade error. When set to only http, HTTPS requests are answered with an error.

Default:http, https

regex_priorityinteger

A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. When two routes match the path and have the same regex_priority, the older one (lowest created_at) is used. Note that the priority for non-regex routes is different (longer non-regex routes are matched before shorter ones).

Default:0

request_bufferingboolean

Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding.

Default:true

response_bufferingboolean

Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding.

Default:true

serviceobject

The service this route is associated to. This is where the route proxies traffic to.

* Additional properties are NOT allowed.
Show Child Parameters
snisarray[string]

A list of SNIs that match this route when using stream routing.

sourcesarray[object]

A list of IP sources of incoming connections that match this route when using stream routing. Each entry is an object with fields ip (optionally in CIDR range notation) and/or port.

strip_pathboolean

When matching a route via one of the paths, strip the matching prefix from the upstream request URL.

Default:true

tagsarray[string]

An optional set of strings associated with the route for grouping and filtering.

updated_atinteger

Unix epoch when the resource was last updated.

post/runtime-groups/{runtimeGroupId}/core-entities/routes

Body

{ "name": "my-route", "protocols": [ "http", "https" ], "methods": [ "GET", "POST" ], "hosts": [ "example.com", "foo.test" ], "paths": [ "/foo", "/bar" ], "headers": { "x-my-header": [ "foo", "bar" ], "x-another-header": [ "bla" ] }, "https_redirect_status_code": 426, "regex_priority": 0, "strip_path": true, "path_handling": "v0", "preserve_host": false, "request_buffering": true, "response_buffering": true, "tags": [ "user-level", "low-priority" ], "service": { "id": "af8330d3-dbdc-48bd-b1be-55b98608834b" } }
 
application/json

Delete a route

Delete a route.

delete

Path Parameters

runtimeGroupIdstringrequired

The ID of your runtime group. This variable is available in the Konnect manager

Example:9524ec7d-36d9-465d-a8c5-83a3c9390458

route_idstringrequired

Response

204

Successfully deleted route or the resource didn’t exist

delete/runtime-groups/{runtimeGroupId}/core-entities/routes/{route_id}
 
204