> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tposs/6.19/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/tposs/6.19/configuration/api.md).

# HTTP API server

> [!NOTE]
> TPOSS HTTP API is usually accessed through TPOSS API Gateway. For more information about TPOSS API Gateway configuration, see the [TPOSS API Gateway chart configuration](https://docs.cennso.com/components/tposs/6.19/installation/api-gw-configuration.md) document.

To serve and handle API requests, TPOSS has a built-in HTTP server. To configure TPOSS HTTP API server, adjust the following options:

```yaml
tposs_http_api:
  # TPOSS HTTP listener address
  host: 0.0.0.0
  # TPOSS HTTP listener port
  port: 8080
  # Number of listener processes that may accept connections
  acceptors: 100
  # List of secrets to access TPOSS HTTP API
  secret_keys: "client1-secret, client2-secret"
  # The time values that show how many HTTP, SBI, or CDMP requests were handled for that time or less.
  # The values are translated into Prometheus histogram buckets and are provided in milliseconds.
  rtt_buckets: [10, 30, 50, 75, 100, 1000, 2000]
  http2:
    # Maximum frame rate allowed per second.
    # The option is applicable only if **sbi.enabled** is set to `true`.
    received_frame_rate_limit: 10000
    # Timeout in milliseconds for idle connections before the TPOSS HTTP server closes them.
    # The option is applicable only if **sbi.enabled** is set to `true`.
    idle_timeout: 5000
```

The HTTP server listens for API requests on the host and port specified by the **tposs_http_api.host** and **tposs_http_api.port** configuration options. The **tposs_http_api.acceptors** configuration option represents the number of processes that accept new incoming HTTP client connections to serve API requests.

Each API request has to be authorized at TPOSS for which the **tposs_http_api.secret_keys** configuration options is used. For more information about this configuration option, read the [API overview](https://docs.cennso.com/components/tposs/6.19/api-reference/api.md) document.

The time TPOSS takes to handle each incoming request is measured and recorded by the **api_requests_rtt** metric. This metric is a [Prometheus histogram](https://prometheus.io/docs/practices/histograms/) for which you can configure buckets using the **tposs_http_api.rtt_buckets** configuration option. For more information about the API metrics, see the [API metrics](https://docs.cennso.com/components/tposs/6.19/observability/metrics.md#api-metrics) section.

> [!NOTE]
> The value of the **tposs_http_api.rtt_buckets** configuration option defines the histogram buckets used to record request durations not only for the TPOSS HTTP API, but also for [SBI](https://docs.cennso.com/components/tposs/6.19/configuration/sbi.md) and [CDMP](https://docs.cennso.com/components/tposs/6.19/configuration/nats-services/cdmp.md).

The **tposs_http_api.http2.** configuration options are applicable only if [SBI](https://docs.cennso.com/components/tposs/6.19/configuration/sbi.md) is enabled in TPOSS. Using the **tposs_http_api.http2.received_frame_rate_limit** option, you can configure the maximum number of HTTP2 frames that TPOSS can receive on one connection per second. The **tposs_http_api.http2.idle_timeout** option specifies how long TPOSS keeps a client connection open when no data is received before closing it.
