openapi: 3.2.0 info: version: '9.0' title: NGINX Plus REST HTTP Upstreams API description: NGINX Plus REST API provides access to NGINX Plus status information, on-the-fly configuration of upstream servers and key-value pairs management for http and stream. servers: - url: /api/9 tags: - name: HTTP Upstreams paths: /http/upstreams/: get: tags: - HTTP Upstreams summary: Return status of all HTTP upstream server groups description: Returns status of each HTTP upstream server group and its servers. operationId: getHttpUpstreams parameters: - name: fields in: query description: Limits which fields of upstream server groups will be output. If the “fields” value is empty, only names of upstreams will be output. schema: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/NginxHTTPUpstreamMap' '404': description: Unknown version (*UnknownVersion*) content: application/json: schema: $ref: '#/components/schemas/NginxError' /http/upstreams/{httpUpstreamName}/: parameters: - name: httpUpstreamName in: path description: The name of an HTTP upstream server group. required: true schema: type: string get: tags: - HTTP Upstreams summary: Return status of an HTTP upstream server group description: Returns status of a particular HTTP upstream server group and its servers. operationId: getHttpUpstreamName parameters: - name: fields in: query description: Limits which fields of the upstream server group will be output. schema: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/NginxHTTPUpstream' '400': description: Upstream is static (*UpstreamStatic*) content: application/json: schema: $ref: '#/components/schemas/NginxError' '404': description: 'Unknown version (*UnknownVersion*), upstream not found (*UpstreamNotFound*) ' content: application/json: schema: $ref: '#/components/schemas/NginxError' delete: tags: - HTTP Upstreams summary: Reset statistics of an HTTP upstream server group description: Resets the statistics for each upstream server in an upstream server group and queue statistics. operationId: deleteHttpUpstreamStat responses: '204': description: Success '400': description: Upstream is static (*UpstreamStatic*) content: application/json: schema: $ref: '#/components/schemas/NginxError' '404': description: 'Unknown version (*UnknownVersion*), upstream not found (*UpstreamNotFound*) ' content: application/json: schema: $ref: '#/components/schemas/NginxError' '405': description: Method disabled (*MethodDisabled*) content: application/json: schema: $ref: '#/components/schemas/NginxError' /http/upstreams/{httpUpstreamName}/servers/: parameters: - name: httpUpstreamName in: path description: The name of an upstream server group. required: true schema: type: string get: tags: - HTTP Upstreams summary: Return configuration of all servers in an HTTP upstream server group description: Returns configuration of each server in a particular HTTP upstream server group. operationId: getHttpUpstreamServers responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/NginxHTTPUpstreamConfServerMap' '400': description: Upstream is static (*UpstreamStatic*) content: application/json: schema: $ref: '#/components/schemas/NginxError' '404': description: 'Unknown version (*UnknownVersion*), upstream not found (*UpstreamNotFound*) ' content: application/json: schema: $ref: '#/components/schemas/NginxError' post: tags: - HTTP Upstreams summary: Add a server to an HTTP upstream server group description: Adds a new server to an HTTP upstream server group. Server parameters are specified in the JSON format. operationId: postHttpUpstreamServer responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/NginxHTTPUpstreamConfServer' '400': description: 'Upstream is static (*UpstreamStatic*), invalid “**parameter**” value (*UpstreamConfFormatError*), missing “*server*” argument (*UpstreamConfFormatError*), unknown parameter “**name**” (*UpstreamConfFormatError*), nested object or list (*UpstreamConfFormatError*), “*error*” while parsing (*UpstreamBadAddress*), service upstream “*host*” may not have port (*UpstreamBadAddress*), service upstream “*host*” requires domain name (*UpstreamBadAddress*), invalid “*weight*” (*UpstreamBadWeight*), invalid “*max_conns*” (*UpstreamBadMaxConns*), invalid “*max_fails*” (*UpstreamBadMaxFails*), invalid “*fail_timeout*” (*UpstreamBadFailTimeout*), invalid “*slow_start*” (*UpstreamBadSlowStart*), reading request body failed *BodyReadError*), route is too long (*UpstreamBadRoute*), “*service*” is empty (*UpstreamBadService*), no resolver defined to resolve (*UpstreamConfNoResolver*), upstream “**name**” has no backup (*UpstreamNoBackup*), upstream “**name**” memory exhausted (*UpstreamOutOfMemory*) ' content: application/json: schema: $ref: '#/components/schemas/NginxError' '404': description: 'Unknown version (*UnknownVersion*), upstream not found (*UpstreamNotFound*) ' content: application/json: schema: $ref: '#/components/schemas/NginxError' '405': description: Method disabled (*MethodDisabled*) content: application/json: schema: $ref: '#/components/schemas/NginxError' '409': description: Entry exists (*EntryExists*) content: application/json: schema: $ref: '#/components/schemas/NginxError' '415': description: JSON error (*JsonError*) content: application/json: schema: $ref: '#/components/schemas/NginxError' requestBody: content: application/json: schema: $ref: '#/components/schemas/NginxHTTPUpstreamConfServer' description: Address of a new server and other optional parameters in the JSON format. The “*ID*”, “*backup*”, and “*service*” parameters cannot be changed. required: true /http/upstreams/{httpUpstreamName}/servers/{httpUpstreamServerId}: parameters: - name: httpUpstreamName in: path description: The name of the upstream server group. required: true schema: type: string - name: httpUpstreamServerId in: path description: The ID of the server. required: true schema: type: string get: tags: - HTTP Upstreams summary: Return configuration of a server in an HTTP upstream server group description: Returns configuration of a particular server in the HTTP upstream server group. operationId: getHttpUpstreamPeer responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/NginxHTTPUpstreamConfServer' '400': description: 'Upstream is static (*UpstreamStatic*), invalid server ID (*UpstreamBadServerId*) ' content: application/json: schema: $ref: '#/components/schemas/NginxError' '404': description: 'Server with ID “**id**” does not exist (*UpstreamServerNotFound*), unknown version (*UnknownVersion*), upstream not found (*UpstreamNotFound*) ' content: application/json: schema: $ref: '#/components/schemas/NginxError' patch: tags: - HTTP Upstreams summary: Modify a server in an HTTP upstream server group description: Modifies settings of a particular server in an HTTP upstream server group. Server parameters are specified in the JSON format. operationId: patchHttpUpstreamPeer responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/NginxHTTPUpstreamConfServer' '400': description: 'Upstream is static (*UpstreamStatic*), invalid “**parameter**” value (*UpstreamConfFormatError*), unknown parameter “**name**” (*UpstreamConfFormatError*), nested object or list (*UpstreamConfFormatError*), “*error*” while parsing (*UpstreamBadAddress*), invalid “*server*” argument (*UpstreamBadAddress*), invalid server ID (*UpstreamBadServerId*), invalid “*weight*” (*UpstreamBadWeight*), invalid “*max_conns*” (*UpstreamBadMaxConns*), invalid “*max_fails*” (*UpstreamBadMaxFails*), invalid “*fail_timeout*” (*UpstreamBadFailTimeout*), invalid “*slow_start*” (*UpstreamBadSlowStart*), reading request body failed *BodyReadError*), route is too long (*UpstreamBadRoute*), “*service*” is empty (*UpstreamBadService*), server “**ID**” address is immutable (*UpstreamServerImmutable*), server “*ID*” weight is immutable (*UpstreamServerWeightImmutable*), upstream “*name*” memory exhausted (*UpstreamOutOfMemory*) ' content: application/json: schema: $ref: '#/components/schemas/NginxError' '404': description: 'Server with ID “**id**” does not exist (*UpstreamServerNotFound*), unknown version (*UnknownVersion*), upstream not found (*UpstreamNotFound*) ' content: application/json: schema: $ref: '#/components/schemas/NginxError' '405': description: Method disabled (*MethodDisabled*) content: application/json: schema: $ref: '#/components/schemas/NginxError' '415': description: JSON error (*JsonError*) content: application/json: schema: $ref: '#/components/schemas/NginxError' requestBody: content: application/json: schema: $ref: '#/components/schemas/NginxHTTPUpstreamConfServer' description: Server parameters, specified in the JSON format. The “*ID*”, “*backup*”, and “*service*” parameters cannot be changed. required: true delete: tags: - HTTP Upstreams summary: Remove a server from an HTTP upstream server group description: Removes a server from an HTTP upstream server group. operationId: deleteHttpUpstreamServer responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/NginxHTTPUpstreamConfServerMap' '400': description: 'Upstream is static (*UpstreamStatic*), invalid server ID (*UpstreamBadServerId*), server “**id**” not removable (*UpstreamServerImmutable*) ' content: application/json: schema: $ref: '#/components/schemas/NginxError' '404': description: 'Server with ID “**id**” does not exist (*UpstreamServerNotFound*), unknown version (*UnknownVersion*), upstream not found (*UpstreamNotFound*) ' content: application/json: schema: $ref: '#/components/schemas/NginxError' '405': description: Method disabled (*MethodDisabled*) content: application/json: schema: $ref: '#/components/schemas/NginxError' components: schemas: NginxHTTPUpstreamConfServer: title: HTTP Upstream Server description: 'Dynamically configurable parameters of an HTTP upstream server: ' type: object properties: id: type: integer description: The ID of the HTTP upstream server. The ID is assigned automatically and cannot be changed. readOnly: true server: type: string description: Same as the address parameter of the HTTP upstream server. When adding a server, it is possible to specify it as a domain name. In this case, changes of the IP addresses that correspond to a domain name will be monitored and automatically applied to the upstream configuration without the need of restarting nginx. This requires the resolver directive in the “http” block. See also the resolve parameter of the HTTP upstream server. service: type: string description: Same as the service parameter of the HTTP upstream server. This parameter cannot be changed. readOnly: true weight: type: integer description: Same as the weight parameter of the HTTP upstream server. max_conns: type: integer description: Same as the max_conns parameter of the HTTP upstream server. max_fails: type: integer description: Same as the max_fails parameter of the HTTP upstream server. fail_timeout: type: string description: Same as the fail_timeout parameter of the HTTP upstream server. slow_start: type: string description: Same as the slow_start parameter of the HTTP upstream server. route: type: string description: Same as the route parameter of the HTTP upstream server. backup: type: boolean description: When true, adds a backup server. This parameter cannot be changed. readOnly: true down: type: boolean description: Same as the down parameter of the HTTP upstream server. drain: type: boolean description: Same as the drain parameter of the HTTP upstream server. parent: type: string description: Parent server ID of the resolved server. The ID is assigned automatically and cannot be changed. readOnly: true host: type: string description: Hostname of the resolved server. The hostname is assigned automatically and cannot be changed. readOnly: true example: id: 1 server: 10.0.0.1:8089 weight: 4 max_conns: 0 max_fails: 0 fail_timeout: 10s slow_start: 10s route: '' backup: true down: true NginxHTTPUpstreamConfServerMap: title: HTTP Upstream Servers description: An array of HTTP upstream servers for dynamic configuration. type: array items: $ref: '#/components/schemas/NginxHTTPUpstreamConfServer' example: - id: 0 server: 10.0.0.1:8088 weight: 1 max_conns: 0 max_fails: 0 fail_timeout: 10s slow_start: 10s route: '' backup: false down: false - id: 1 server: 10.0.0.1:8089 weight: 4 max_conns: 0 max_fails: 0 fail_timeout: 10s slow_start: 10s route: '' backup: true down: true NginxHTTPUpstream: title: HTTP Upstream type: object properties: peers: $ref: '#/components/schemas/NginxHTTPUpstreamPeerMap' keepalive: type: integer description: The current number of idle keepalive connections. zombies: type: integer description: The current number of servers removed from the group but still processing active client requests. zone: type: string description: The name of the shared memory zone that keeps the group’s configuration and run-time state. queue: type: object description: 'For the requests queue, the following data are provided: ' properties: size: type: integer description: The current number of requests in the queue. max_size: type: integer description: The maximum number of requests that can be in the queue at the same time. overflows: type: integer description: The total number of requests rejected due to the queue overflow. example: upstream_backend: peers: - id: 0 server: 10.0.0.1:8088 name: 10.0.0.1:8088 backup: false weight: 5 state: up active: 0 ssl: handshakes: 620311 handshakes_failed: 3432 session_reuses: 36442 no_common_protocol: 4 handshake_timeout: 0 peer_rejected_cert: 0 verify_failures: expired_cert: 2 revoked_cert: 1 hostname_mismatch: 2 other: 1 max_conns: 20 requests: 667231 header_time: 20 response_time: 36 response_time_hist: count: 9817 sum: 57625 buckets: 5: 4428 10: 4755 25: 350 50: 235 75: 54 100: 47 250: 1 500: 0 750: 0 1000: 0 2500: 0 5000: 0 7500: 0 10000: 0 inf: 0 responses: 1xx: 0 2xx: 666310 3xx: 0 4xx: 915 5xx: 6 codes: 200: 666310 404: 915 503: 6 total: 667231 sent: 251946292 received: 19222475454 fails: 0 unavail: 0 health_checks: checks: 26214 fails: 0 unhealthy: 0 last_passed: true downtime: 0 downstart: 2022-06-28 11:09:21.602000+00:00 selected: 2022-06-28 15:01:25+00:00 - id: 1 server: 10.0.0.1:8089 name: 10.0.0.1:8089 backup: true weight: 1 state: unhealthy active: 0 max_conns: 20 requests: 0 responses: 1xx: 0 2xx: 0 3xx: 0 4xx: 0 5xx: 0 codes: {} total: 0 sent: 0 received: 0 fails: 0 unavail: 0 health_checks: checks: 26284 fails: 26284 unhealthy: 1 last_passed: false downtime: 262925617 downstart: 2022-06-28 11:09:21.602000+00:00 selected: 2022-06-28 15:01:25+00:00 keepalive: 0 zombies: 0 zone: upstream_backend NginxError: title: Error description: 'nginx error object. ' type: object properties: error: type: object properties: status: type: integer description: HTTP error code. text: type: string description: Error description. code: type: string description: Internal nginx error code. request_id: type: string description: The ID of the request, equals the value of the $request_id variable. href: type: string description: Link to reference documentation. NginxHTTPUpstreamMap: title: HTTP Upstreams description: 'Status information of all HTTP dynamically configurable groups. ' type: object additionalProperties: $ref: '#/components/schemas/NginxHTTPUpstream' example: trac-backend: peers: - id: 0 server: 10.0.0.1:8088 name: 10.0.0.1:8088 backup: false weight: 5 state: up active: 0 ssl: handshakes: 620311 handshakes_failed: 3432 session_reuses: 36442 no_common_protocol: 4 handshake_timeout: 0 peer_rejected_cert: 0 verify_failures: expired_cert: 2 revoked_cert: 1 hostname_mismatch: 2 other: 1 requests: 667231 header_time: 20 response_time: 36 response_time_hist: count: 9817 sum: 57625 buckets: 5: 4428 10: 4755 25: 350 50: 235 75: 54 100: 47 250: 1 500: 0 750: 0 1000: 0 2500: 0 5000: 0 7500: 0 10000: 0 inf: 0 responses: 1xx: 0 2xx: 666310 3xx: 0 4xx: 915 5xx: 6 codes: 200: 666310 404: 915 503: 6 total: 667231 sent: 251946292 received: 19222475454 fails: 0 unavail: 0 health_checks: checks: 26214 fails: 0 unhealthy: 0 last_passed: true downtime: 0 downstart: 2022-06-28 11:09:21.602000+00:00 selected: 2022-06-28 15:01:25+00:00 - id: 1 server: 10.0.0.1:8089 name: 10.0.0.1:8089 backup: true weight: 1 state: unhealthy active: 0 requests: 0 responses: 1xx: 0 2xx: 0 3xx: 0 4xx: 0 5xx: 0 codes: {} total: 0 sent: 0 received: 0 fails: 0 unavail: 0 health_checks: checks: 26284 fails: 26284 unhealthy: 1 last_passed: false downtime: 262925617 downstart: 2022-06-28 11:09:21.602000+00:00 selected: 2022-06-28 15:01:25+00:00 keepalive: 0 zombies: 0 zone: trac-backend hg-backend: peers: - id: 0 server: 10.0.0.1:8088 name: 10.0.0.1:8088 backup: false weight: 5 state: up active: 0 ssl: handshakes: 620311 handshakes_failed: 3432 session_reuses: 36442 no_common_protocol: 4 handshake_timeout: 0 peer_rejected_cert: 0 verify_failures: expired_cert: 2 revoked_cert: 1 hostname_mismatch: 2 other: 1 requests: 667231 header_time: 20 response_time: 36 response_time_hist: count: 9817 sum: 57625 buckets: 5: 4428 10: 4755 25: 350 50: 235 75: 54 100: 47 250: 1 500: 0 750: 0 1000: 0 2500: 0 5000: 0 7500: 0 10000: 0 inf: 0 responses: 1xx: 0 2xx: 666310 3xx: 0 4xx: 915 5xx: 6 codes: 200: 666310 404: 915 503: 6 total: 667231 sent: 251946292 received: 19222475454 fails: 0 unavail: 0 health_checks: checks: 26214 fails: 0 unhealthy: 0 last_passed: true downtime: 0 downstart: 2022-06-28 11:09:21.602000+00:00 selected: 2022-06-28 15:01:25+00:00 - id: 1 server: 10.0.0.1:8089 name: 10.0.0.1:8089 backup: true weight: 1 state: unhealthy active: 0 requests: 0 responses: 1xx: 0 2xx: 0 3xx: 0 4xx: 0 5xx: 0 codes: {} total: 0 sent: 0 received: 0 fails: 0 unavail: 0 health_checks: checks: 26284 fails: 26284 unhealthy: 1 last_passed: false downtime: 262925617 downstart: 2022-06-28 11:09:21.602000+00:00 selected: 2022-06-28 15:01:25+00:00 keepalive: 0 zombies: 0 zone: hg-backend NginxHTTPUpstreamPeerMap: title: HTTP Upstream Servers description: 'An array of HTTP upstream servers. ' type: array items: $ref: '#/components/schemas/NginxHTTPUpstreamPeer' NginxHTTPUpstreamPeer: title: HTTP Upstream Server type: object properties: id: type: integer description: The ID of the server. readOnly: true server: type: string description: An address of the server. service: type: string description: The service parameter value of the server directive. name: type: string description: The name of the server specified in the server directive. readOnly: true backup: type: boolean description: A boolean value indicating whether the server is a backup server. weight: type: integer description: Weight of the server. state: type: string enum: - up - draining - down - unavail - checking - unhealthy description: Current state, which may be one of “up”, “draining”, “down”, “unavail”, “checking”, and “unhealthy”. active: type: integer description: The current number of active connections. readOnly: true ssl: type: object readOnly: true properties: handshakes: type: integer description: The total number of successful SSL handshakes. readOnly: true handshakes_failed: type: integer description: The total number of failed SSL handshakes. readOnly: true session_reuses: type: integer description: The total number of session reuses during SSL handshake. readOnly: true no_common_protocol: type: integer description: The number of SSL handshakes failed because of no common protocol. handshake_timeout: type: integer description: The number of SSL handshakes failed because of a timeout. peer_rejected_cert: type: integer description: The number of failed SSL handshakes when nginx presented the certificate to the upstream server but it was rejected with a corresponding alert message. verify_failures: type: object description: SSL certificate verification errors properties: expired_cert: type: integer description: An expired or not yet valid certificate was presented by an upstream server. revoked_cert: type: integer description: A revoked certificate was presented by an upstream server. hostname_mismatch: type: integer description: Server's certificate doesn't match the hostname. other: type: integer description: Other SSL certificate verification errors. max_conns: type: integer description: The max_conns limit for the server. requests: type: integer description: The total number of client requests forwarded to this server. readOnly: true responses: type: object readOnly: true properties: 1xx: type: integer description: The number of responses with “1xx” status codes. readOnly: true 2xx: type: integer description: The number of responses with “2xx” status codes. readOnly: true 3xx: type: integer description: The number of responses with “3xx” status codes. readOnly: true 4xx: type: integer description: The number of responses with “4xx” status codes. readOnly: true 5xx: type: integer description: The number of responses with “5xx” status codes. readOnly: true codes: type: object description: The number of responses per each status code. readOnly: true properties: codeNumber: type: integer description: The number of responses with this particular status code. readOnly: true total: type: integer description: The total number of responses obtained from this server. readOnly: true sent: type: integer description: The total number of bytes sent to this server. readOnly: true received: type: integer description: The total number of bytes received from this server. readOnly: true fails: type: integer description: The total number of unsuccessful attempts to communicate with the server. readOnly: true unavail: type: integer description: How many times the server became unavailable for client requests (state “unavail”) due to the number of unsuccessful attempts reaching the max_fails threshold. readOnly: true health_checks: type: object readOnly: true properties: checks: type: integer description: The total number of health check requests made. fails: type: integer description: The number of failed health checks. unhealthy: type: integer description: How many times the server became unhealthy (state “unhealthy”). last_passed: type: boolean description: Boolean indicating if the last health check request was successful and passed tests. downtime: type: integer readOnly: true description: Total time the server was in the “unavail”, “checking”, and “unhealthy” states. downstart: type: string format: date-time readOnly: true description: The time when the server became “unavail”, “checking”, or “unhealthy”, in the ISO 8601 format with millisecond resolution. selected: type: string format: date-time readOnly: true description: The time when the server was last selected to process a request, in the ISO 8601 format with millisecond resolution. header_time: type: integer readOnly: true description: The average time to get the response header from the server. response_time: type: integer readOnly: true description: The average time to get the full response from the server. response_time_hist: type: object description: Histogram of upstream response times collected per upstream server. readOnly: true properties: count: type: integer description: Total number of recorded responses. readOnly: true sum: type: integer description: Sum of all recorded upstream response times, in milliseconds. readOnly: true buckets: title: Histogram bucket counters description: 'Histogram bucket counters for upstream response times, in milliseconds. Each bucket name ("5","10","25","50", etc.) is a time limit in milliseconds. Each bucket value is the number of responses within that time bucket. The "inf" bucket counts responses greater than 10000 ms. ' type: object readOnly: true properties: '5': type: integer description: The total number of responses with response time less than or equal to 5 ms. '10': type: integer description: The total number of responses with response time greater than 5 ms and less than or equal to 10 ms. '25': type: integer description: The total number of responses with response time greater than 10 ms and less than or equal to 25 ms. '50': type: integer description: The total number of responses with response time greater than 25 ms and less than or equal to 50 ms. '75': type: integer description: The total number of responses with response time greater than 50 ms and less than or equal to 75 ms. '100': type: integer description: The total number of responses with response time greater than 75 ms and less than or equal to 100 ms. '250': type: integer description: The total number of responses with response time greater than 100 ms and less than or equal to 250 ms. '500': type: integer description: The total number of responses with response time greater than 250 ms and less than or equal to 500 ms. '750': type: integer description: The total number of responses with response time greater than 500 ms and less than or equal to 750 ms. '1000': type: integer description: The total number of responses with response time greater than 750 ms and less than or equal to 1000 ms. '2500': type: integer description: The total number of responses with response time greater than 1000 ms and less than or equal to 2500 ms. '5000': type: integer description: The total number of responses with response time greater than 2500 ms and less than or equal to 5000 ms. '7500': type: integer description: The total number of responses with response time greater than 5000 ms and less than or equal to 7500 ms. '10000': type: integer description: The total number of responses with response time greater than 7500 ms and less than or equal to 10000 ms. inf: type: integer description: The total number of observations with response time greater than 10000 ms.