Every argument of uvicorn.run() is keyword-only, except app. uvicorn.Config accepts the same arguments, except app_dir. Most of them have a command-line flag with dashes instead of underscores (ssl_keyfile becomes --ssl-keyfile). Each parameter has an anchor, for example /parameters/#ssl_context_factory.
Application
app
str | ASGI AppYour ASGI application. Can be a string in "module:attribute" format or the application object directly.
factory
boolTreat app as an application factory (a callable that returns an ASGI app). Default: False
app_dir
strDirectory to add to sys.path when looking for the application module. Default: current working directory
reset_contextvars
boolRun each ASGI request in a fresh contextvars.Context. Works around a context leak in asyncio (uvloop is not affected). Hides context set during lifespan from request handlers. Default: False
Socket Binding
host
strBind socket to this host. Use "0.0.0.0" to make the server available externally. Default: "127.0.0.1"
port
intBind socket to this port. Use 0 to bind to an available port. Default: 8000
uds
strBind to a UNIX domain socket instead of TCP. Useful for reverse proxy setups.
fd
intBind to socket from this file descriptor. Useful for socket activation.
Development
reload
boolEnable auto-reload for development. Watches for file changes and restarts the server. Default: False
reload_dirs
list[str]Directories to watch for file changes when reload is enabled.
reload_delay
floatDelay in seconds between detecting a change and reloading. Default: 0.25
reload_includes
list[str]Glob patterns for files to include in reload watching. Requires watchfiles.
reload_excludes
list[str]Glob patterns for files to exclude from reload watching. Requires watchfiles.
Production
workers
intNumber of worker processes. Reads from $WEB_CONCURRENCY env var if set. Cannot be used with reload. Send SIGHUP to restart workers one at a time without dropping requests. Default: 1
env_file
strPath to environment configuration file to load.
timeout_worker_healthcheck
intTimeout in seconds for worker health check. Default: 5
Logging
log_level
strLogging level: "critical", "error", "warning", "info", "debug", "trace" (case-insensitive). Default: "info"
log_config
str | PathLike | dictLogging configuration file path (.json, .yaml or .ini) or a dictionary config. YAML requires PyYAML.
access_log
boolEnable or disable access logging. Default: True
use_colors
boolEnable or disable colorized log formatting. Default: auto-detected
Protocol Implementation
loop
strEvent loop implementation: "auto", "asyncio", "uvloop", "zuvloop" (CPython 3.14+, installed separately), "none". Default: "auto"
http
strHTTP protocol implementation: "auto", "h11", "httptools", "zttp" (experimental, requires the zttp package). Default: "auto"
http2
boolEnable experimental HTTP/2. Requires http="zttp". h2c upgrade and WebSockets over HTTP/2 are not supported. Default: False
ws
strWebSocket protocol implementation: "auto", "none", "websockets-sansio", "wsproto", "websockets" (legacy, deprecated). "auto" picks websockets-sansio when websockets is installed. Default: "auto"
lifespan
strLifespan protocol implementation: "auto", "on", "off". Default: "auto"
interface
strApplication interface type: "auto", "asgi3", "asgi2", "wsgi". Default: "auto"
h11_max_incomplete_event_size
intMaximum size of incomplete HTTP events buffer (h11 only). Default: 16384
WebSocket Settings
ws_max_size
intMaximum WebSocket message size in bytes. Default: 16777216 (16MB)
ws_max_queue
intMaximum WebSocket receive queue length (legacy websockets implementation only). Default: 32
ws_ping_interval
floatWebSocket ping interval in seconds. Default: 20.0
ws_ping_timeout
floatWebSocket ping timeout in seconds. Default: 20.0
ws_per_message_deflate
boolEnable WebSocket per-message compression (legacy websockets implementation only). Default: True
HTTP Settings
root_path
strSet the ASGI root_path for applications mounted at a subpath. Default: ""
proxy_headers
boolEnable X-Forwarded-Proto, X-Forwarded-For headers. Default: True
forwarded_allow_ips
str | listComma-separated list of trusted proxy IPs, networks or UNIX socket paths. Default: $FORWARDED_ALLOW_IPS, or "127.0.0.1" and "::1"
server_header
boolInclude "Server" header in responses. Default: True
date_header
boolInclude "Date" header in responses. Default: True
headers
list[tuple]Custom HTTP headers to add to all responses.
HTTPS / SSL
ssl_keyfile
strPath to SSL key file for HTTPS support.
ssl_certfile
strPath to SSL certificate file for HTTPS support.
ssl_keyfile_password
strPassword to decrypt the SSL key file if encrypted.
ssl_version
intSSL protocol version to use. Default: ssl.PROTOCOL_TLS_SERVER
ssl_cert_reqs
intWhether client certificates are required. Default: ssl.CERT_NONE
ssl_ca_certs
strPath to CA certificates file for client certificate verification.
ssl_ciphers
strSSL ciphers to use. Default: None (OpenSSL's safe defaults)
ssl_context_factory
CallableFunction receiving (config, default_ssl_context_factory) and returning an ssl.SSLContext. Use it for mTLS, a minimum TLS version or in-memory certificates. Must be picklable with reload or workers.
Resource Limits
limit_concurrency
intMaximum number of concurrent connections to allow before rejecting new connections.
limit_max_requests
intMaximum number of requests per worker before terminating and respawning.
limit_max_requests_jitter
intJitter to add to limit_max_requests to stagger worker restarts and avoid all workers restarting simultaneously. Default: 0
backlog
intMaximum number of pending connections in the connection backlog. Default: 2048
Timeouts
timeout_keep_alive
intTimeout in seconds for keep-alive connections. Default: 5
timeout_graceful_shutdown
intTimeout in seconds for graceful shutdown. After this time, connections are forcefully closed.