Skip to main content
Version: v2.x

GraphQL Engine server config reference


Every GraphQL engine command is structured as:

$ graphql-engine <server-flags> serve <command-flags>

The flags can be passed as environment variables as well.

graphql-engine command flags / environment variables

For the graphql-engine command these are the available flags and environment variables:

FlagENV variableDescription

--database-url <DB_URL>


Postgres database URL: postgres://<user>:<password>@<host>:<port>/<db-name>

Example: postgres://admin:[email protected]:5432/mydb

--metadata-database-url <METADATA-DATABASE-URL>


Postgres database URL that will be used to store the Hasura metadata. By default the database configured using HASURA_GRAPHQL_DATABASE_URL will be used to store the metadata.


Example: postgres://admin:[email protected]:5432/metadata_db

(Available for versions > v2.0.0)

Or you can specify the following options (only via flags):

    --host                      Postgres server host
-p, --port Postgres server port
-u, --user Database user name
-p, --password Password of the user
-d, --dbname Database name to connect to
-o, --pg-connection-options PostgreSQL connection options

The default configuration of PostgreSQL 11 and older may result in loss of precision when retrieving IEEE 754 style data, such as float4, real or double precision values, from the database. To avoid this, set the extra_float_digits PostgreSQL connection parameter to 3. This can be done by passing '--pg-connection-options=-c extra_float_digits=3' to graphql-engine, or by passing this option as part of the database url:

postgres://admin:[email protected]:5432/mydb?options=-c%20extra_float_digits%3D3

serve sub-command flags / environment variables

For the serve sub-command these are the available flags and environment variables:

FlagENV variableDescription

--server-port <PORT>


Port on which graphql-engine should be served (default: 8080)

--server-host <HOST>


Host on which graphql-engine will listen (default: *)

--enable-console <true|false>


Enable the Hasura Console (served by the server on / and /console) (default: false)

--admin-secret <ADMIN_SECRET_KEY>


Admin secret key, required to access this instance. This is mandatory when you use webhook or JWT.

--auth-hook <WEBHOOK_URL>


URL of the authorization webhook required to authorize requests. See auth webhooks docs for more details.

--auth-hook-mode <GET|POST>


HTTP method to use for the authorization webhook (default: GET)

--jwt-secret <JSON_CONFIG>


A JSON string containing type and the JWK used for verifying (and other optional details). Example: {"type": "HS256", "key": "3bd561c37d214b4496d09049fadc542c"}. See the JWT docs for more details.

--unauthorized-role <ROLE>


Unauthorized role, used when access-key is not sent in access-key only mode or the Authorization header is absent in JWT mode. Example: anonymous. Now whenever the "authorization" header is absent, the request's role will default to anonymous.

--cors-domain <DOMAINS>


CSV of list of domains, incuding scheme (http/https) and port, to allow for CORS. Wildcard domains are allowed. (See Configure CORS)



Disable CORS. Do not send any CORS headers on any request.

--ws-read-cookie <true|false>


Read cookie on WebSocket initial handshake even when CORS is disabled. This can be a potential security flaw! Please make sure you know what you're doing. This configuration is only applicable when CORS is disabled. (default: false)

--enable-telemetry <true|false>


Enable anonymous telemetry (default: true)


Maximum number of concurrent http workers delivering events at any time (default: 100)


Interval in milliseconds to sleep before trying to fetch events again after a fetch returned no events from postgres



Maximum number of events to be fetched from the DB in a single batch (default: 100)

(Available for versions > v2.0.0)



Interval in milliseconds to sleep before trying to fetch async actions again after a fetch returned no async actions from metadata storage. Value 0 implies completely disable fetching async actions from the storage.

(Available for versions > v2.0.0)

-s, --stripes <NO_OF_STRIPES>


Number of stripes (distinct sub-pools) to maintain with Postgres (default: 1). New connections will be taken from a particular stripe pseudo-randomly.

-c, --connections <NO_OF_CONNS>


Maximum number of Postgres connections that can be opened per stripe (default: 50). When the maximum is reached we will block until a new connection becomes available, even if there is capacity in other stripes.

(Deprecated in versions > v2.0.0. See details)

--timeout <SECONDS>


Each connection's idle time before it is closed (default: 180 sec)

(Deprecated in versions > v2.0.0. See details)

--use-prepared-statements <true|false>


Use prepared statements for queries (default: true)

(Deprecated in versions > v2.0.0. See details)

-i, --tx-iso <TXISO>


Transaction isolation. read-committed / repeatable-read / serializable (default: read-committed)

(Deprecated in versions > v2.0.0. See details)

--retries <NO_OF_RETRIES>


Number of retries if Postgres connection error occurs (default: 1)

(Deprecated in versions > v2.0.0. See details)

--conn-lifetime <SECONDS>


Time from connection creation after which the connection should be destroyed and a new one created. A value of 0 indicates we should never destroy an active connection. If 0 is passed, memory from large query results may not be reclaimed. (default: 600 sec)

(Deprecated in versions > v2.0.0. See details)



Stringify certain Postgres numeric types, specifically bigint ,numeric ,decimal and double precision as they don't fit into the IEEE-754 spec for JSON encoding-decoding. (default: false)

--enabled-apis <APIS>


Comma separated list of APIs (options: metadata, graphql, pgdump, config) to be enabled. (default: metadata,graphql,pgdump,config)



Updated results (if any) will be sent at most once in this interval (in milliseconds) for live queries which can be multiplexed. Default: 1000 (1sec)



Multiplexed live queries are split into batches of the specified size. Default: 100



Updated results (if any) will be sent at most once in this interval (in milliseconds) for streaming queries which can be multiplexed. Default: 1000 (1sec)



Multiplexed streaming queries are split into batches of the specified size. Default: 100



Restrict queries allowed to be executed by the GraphQL engine to those that are part of the configured allow-list. Default: false



Set the value to /srv/console-assets for the console to load assets from the server itself instead of CDN



Set the enabled log types. This is a comma-separated list of log-types to enable. Default: startup, http-log, webhook-log, websocket-log. See log types for more details.



Set the logging level. Default: info. Options: debug, info, warn, error.



Set dev mode for GraphQL requests; include the internal key in the errors extensions of the response (if required).

(Available for versions > v1.2.0)



Include the internal key in the errors extensions of the response for GraphQL requests with the admin role (if required).

(Available for versions > v1.2.0)



Enable remote schema permissions (default: false)

(Available for versions > v2.0.0)



When the --infer-function-permissions flag is set to false, a function f, stable, immutable or volatile is only exposed for a role r if there is a permission defined on the function f for the role r, creating a function permission will only be allowed if there is a select permission on the table type. When the --infer-function-permissions flag is set to true or the flag is omitted (defaults to true), the permission of the function is inferred from the select permissions from the target table of the function, only for stable/immutable functions. Volatile functions are not exposed to any of the roles in this case.

(Available for versions > v2.0.0)



Interval to poll metadata storage for updates in milliseconds - Default 1000 (1s) - Set to 0 to disable.(Available for versions > v2.0.0)



List of experimental features to be enabled. A comma separated value is expected. Options: inherited_roles, optimize_permission_filters, streaming_subscriptions.

(Available for versions > v2.0.0)



Timeout (in seconds) to wait for the in-flight events (event triggers and scheduled triggers) and async actions to complete before the server shuts down completely (default: 60 seconds). If the in-flight events are not completed within the timeout, those events are marked as pending.(Available for versions > v2.0.0)



Disable updating of metadata on the server (default: false)

(Available for versions > v2.0.0)



Enable WebSocket permessage-deflate compression (default: false)(Available for versions > v2.0.0)

--websocket-keepalive <SECONDS>


Used to set the Keep Alive delay for client that use the subscription-transport-ws (Apollo) protocol. For graphql-ws clients the graphql-engine sends PING messages instead.

(default: 5)

(Available for versions > v2.0.0)

--websocket-connection-init-timeout <SECONDS>


Used to set the connection initialisation timeout for graphql-ws clients. This is ignored for subscription-transport-ws (Apollo) clients.

(default: 3)


When the equivalent flags for environment variables are used, the flags will take precedence.