---
title: "Create a DBaaS PostgreSQL service"
method: POST
path: "/dbaas-postgres/{name}"
tags: ["dbaas"]
---

# Create a DBaaS PostgreSQL service

`POST /dbaas-postgres/{name}`

## Request

- Base URL: `https://api-ch-gva-2.exoscale.com/v2`
- URL: `https://api-ch-gva-2.exoscale.com/v2/dbaas-postgres/{name}`
- Auth: none declared
- TypeScript: <https://skmtc.dev/exoscale/apis/exoscale-api/docs/dbaas-postgres/:name/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `name` string, required

## Request body

- object
  - `pgbouncer-settings` JsonSchemaPgbouncer: System-wide settings for pgbouncer.
    - `min_pool_size` integer
    - `ignore_startup_parameters` string[]
    - `server_lifetime` integer
    - `autodb_pool_mode` 'transaction' | 'session' | 'statement'
    - `server_idle_timeout` integer
    - `autodb_max_db_connections` integer
    - `max_prepared_statements` integer
    - `server_reset_query_always` boolean
    - `autodb_pool_size` integer
    - `autodb_idle_timeout` integer
  - `backup-schedule` object
    - `backup-hour` integer, nullable: The hour of day (in UTC) when backup for the service is started. New backup is only started if previous backup has already completed.
    - `backup-minute` integer, nullable: The minute of an hour when backup for the service is started. New backup is only started if previous backup has already completed.
  - `variant` 'timescale' | 'aiven'
  - `integrations` object[]: Service integrations to be enabled when creating the service.
    - `type` 'read_replica', required: Integration type
    - `source-service` string
    - `dest-service` string
    - `settings` object: Integration settings
  - `timescaledb-settings` JsonSchemaTimescaledb: System-wide settings for the timescaledb extension
    - `max_background_workers` integer: The number of background workers for timescaledb operations. You should configure this setting to the sum of your number of databases and the total number of concurrent background workers you want running at any given point in time. Changing this parameter causes a service restart.
  - `ip-filter` string[]: Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16'
  - `termination-protection` boolean: Service is protected against termination and powering off
  - `pgaudit-settings` JsonSchemaPgaudit: System-wide settings for the pgaudit extension.
    - `role` string: Specifies the master role to use for object audit logging.
    - `log_parameter` boolean: Specifies that audit logging should include the parameters that were passed with the statement.
    - `log_rows` boolean
    - `log_level` 'debug1' | 'debug2' | 'debug3' | 'debug4' | 'debug5' | 'info' | 'notice' | 'warning' | 'log': Specifies the log level that will be used for log entries.
    - `log_relation` boolean: Specifies whether session audit logging should create a separate log entry for each relation (TABLE, VIEW, etc.) referenced in a SELECT or DML statement.
    - `log_statement_once` boolean: Specifies whether logging will include the statement text and parameters with the first log entry for a statement/substatement combination or with every entry.
    - `log_max_string_length` integer: Crop parameters representation and whole statements if they exceed this threshold. A (default) value of -1 disable the truncation.
    - `log_catalog` boolean: Specifies that session logging should be enabled in the case where all relations in a statement are in pg_catalog.
    - `log_nested_statements` boolean: This GUC allows to turn off logging nested statements, that is, statements that are executed as part of another ExecutorRun.
    - `log_statement` boolean: Specifies whether logging will include the statement text and parameters (if enabled).
    - `log_client` boolean: Specifies whether log messages will be visible to a client process such as psql.
    - `feature_enabled` boolean: Enable pgaudit extension. When enabled, pgaudit extension will be automatically installed.Otherwise, extension will be uninstalled but auditing configurations will be preserved.
    - `log` string[]: Specifies which classes of statements will be logged by session audit logging.
    - `log_parameter_max_size` integer: Specifies that parameter values longer than this setting (in bytes) should not be logged, but replaced with <long param suppressed>.
  - `fork-from-service` string
  - `synchronous-replication` 'quorum' | 'off'
  - `recovery-backup-time` string: ISO time of a backup to recover from for services that support arbitrary times
  - `pglookout-settings` JsonSchemaPglookout: System-wide settings for pglookout.
    - `max_failover_replication_time_lag` integer: Number of seconds of master unavailability before triggering database failover to standby
  - `maintenance` object: Automatic maintenance settings
    - `dow` 'saturday' | 'tuesday' | 'never' | 'wednesday' | 'sunday' | 'friday' | 'monday' | 'thursday', required: Day of week for installing updates
    - `time` string, required: Time for installing updates, UTC
  - `admin-username` string: Custom username for admin user. This must be set only when a new service is being created.
  - `version` '14' | '17' | '15' | '18' | '13' | '16'
  - `plan` string, required: Subscription plan
  - `work-mem` integer: Sets the maximum amount of memory to be used by a query operation (such as a sort or hash table) before writing to temporary disk files, in MB. Default is 1MB + 0.075% of total RAM (up to 32MB).
  - `shared-buffers-percentage` integer: Percentage of total RAM that the database server uses for shared memory buffers. Valid range is 20-60 (float), which corresponds to 20% - 60%. This setting adjusts the shared_buffers configuration value.
  - `pg-settings` JsonSchemaPg
    - `track_activity_query_size` integer: Specifies the number of bytes reserved to track the currently executing command for each active session. Changing this parameter causes a service restart.
    - `timezone` string: PostgreSQL service timezone
    - `track_io_timing` 'off' | 'on': Enables timing of database I/O calls. The default is `off`. When on, it will repeatedly query the operating system for the current time, which may cause significant overhead on some platforms.
    - `pg_stat_monitor.pgsm_enable_query_plan` boolean: Enables or disables query plan monitoring. Changing this parameter causes a service restart. Only available for PostgreSQL 13+.
    - `max_files_per_process` integer: PostgreSQL maximum number of files that can be open per process. The default is `1000` (upstream default). Changing this parameter causes a service restart.
    - `pg_stat_monitor.pgsm_max_buckets` integer: Sets the maximum number of buckets. Changing this parameter causes a service restart. Only available for PostgreSQL 13+.
    - `io_max_concurrency` integer: EXPERIMENTAL: Controls the maximum number of I/O operations that one process can execute simultaneously. Version 18 and up only. Changing this parameter causes a service restart.
    - `wal` object
      - `max_slot_wal_keep_size` integer: PostgreSQL maximum WAL size (MB) reserved for replication slots. If `-1` is specified, replication slots may retain an unlimited amount of WAL files. The default is `-1` (upstream default). wal_keep_size minimum WAL size setting takes precedence over this.
      - `max_wal_senders` integer: PostgreSQL maximum WAL senders. The default is `20`. Changing this parameter causes a service restart.
      - `wal_sender_timeout` integer: Terminate replication connections that are inactive for longer than this amount of time, in milliseconds.
      - `wal_writer_delay` integer: WAL flush interval in milliseconds. The default is `200`. Setting this parameter to a lower value may negatively impact performance.
    - `default_toast_compression` 'lz4' | 'pglz': Specifies the default TOAST compression method for values of compressible columns. The default is `lz4`. Only available for PostgreSQL 14+.
    - `deadlock_timeout` integer: This is the amount of time, in milliseconds, to wait on a lock before checking to see if there is a deadlock condition. The default is `1000` (upstream default).
    - `idle_in_transaction_session_timeout` integer: Time out sessions with open transactions after this number of milliseconds
    - `max_pred_locks_per_transaction` integer: PostgreSQL maximum predicate locks per transaction. The default is `64` (upstream default). Changing this parameter causes a service restart.
    - `max_replication_slots` integer: PostgreSQL maximum replication slots. The default is `20`. Changing this parameter causes a service restart.
    - `max_sync_workers_per_subscription` integer: Maximum number of synchronization workers per subscription. The default is `2`.
    - `autovacuum` object
      - `log_autovacuum_min_duration` integer: Causes each action executed by autovacuum to be logged if it ran for at least the specified number of milliseconds. Setting this to zero logs all autovacuum actions. Minus-one disables logging autovacuum actions. The default is `1000`.
      - `autovacuum_vacuum_cost_limit` integer: Specifies the cost limit value that will be used in automatic VACUUM operations. If `-1` is specified, the regular vacuum_cost_limit value will be used. The default is `-1` (upstream default).
      - `autovacuum_max_workers` integer: Specifies the maximum number of autovacuum processes (other than the autovacuum launcher) that may be running at any one time. The default is `3`. Changing this parameter causes a service restart.
      - `autovacuum_vacuum_threshold` integer: Specifies the minimum number of updated or deleted tuples needed to trigger a VACUUM in any one table. The default is `50`.
      - `autovacuum_naptime` integer: Specifies the minimum delay between autovacuum runs on any given database. The delay is measured in seconds. The default is `60`.
      - `autovacuum_vacuum_scale_factor` number: Specifies a fraction of the table size to add to autovacuum_vacuum_threshold when deciding whether to trigger a VACUUM (e.g. `0.2` for 20% of the table size). The default is `0.2`.
      - `autovacuum_vacuum_cost_delay` integer: Specifies the cost delay value that will be used in automatic VACUUM operations. If `-1` is specified, the regular vacuum_cost_delay value will be used. The default is `2` (upstream default).
      - `autovacuum_analyze_scale_factor` number: Specifies a fraction of the table size to add to autovacuum_analyze_threshold when deciding whether to trigger an ANALYZE (e.g. `0.2` for 20% of the table size). The default is `0.2`.
      - `autovacuum_analyze_threshold` integer: Specifies the minimum number of inserted, updated or deleted tuples needed to trigger an ANALYZE in any one table. The default is `50`.
      - `autovacuum_freeze_max_age` integer: Specifies the maximum age (in transactions) that a table's pg_class.relfrozenxid field can attain before a VACUUM operation is forced to prevent transaction ID wraparound within the table. The system launches autovacuum processes to prevent wraparound even when autovacuum is otherwise disabled. Changing this parameter causes a service restart.
    - `max_parallel_workers_per_gather` integer: Sets the maximum number of workers that can be started by a single Gather or Gather Merge node. The default is `2` (upstream default).
    - `io_combine_limit` integer: EXPERIMENTAL: Controls the largest I/O size in operations that combine I/O in 8kB units. Version 17 and up only.
    - `password_encryption` 'md5' | 'scram-sha-256', nullable: Chooses the algorithm for encrypting passwords.
    - `io_workers` integer: EXPERIMENTAL: Number of IO worker processes, for io_method=worker. Version 18 and up only. Changing this parameter causes a service restart.
    - `pg_partman_bgw.interval` integer: Sets the time interval in seconds to run pg_partman's scheduled tasks. The default is `3600`.
    - `log_line_prefix` ''pid=%p,user=%u,db=%d,app=%a,client=%h '' | ''pid=%p,user=%u,db=%d,app=%a,client=%h,txid=%x,qid=%Q '' | ''%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h '' | ''%m [%p] %q[user=%u,db=%d,app=%a] '': Choose from one of the available log formats.
    - `log_temp_files` integer: Log statements for each temporary file created larger than this number of kilobytes, -1 disables
    - `max_locks_per_transaction` integer: PostgreSQL maximum locks per transaction. Changing this parameter causes a service restart.
    - `track_commit_timestamp` 'off' | 'on': Record commit time of transactions. Changing this parameter causes a service restart.
    - `track_functions` 'all' | 'pl' | 'none': Enables tracking of function call counts and time used.
    - `io_max_combine_limit` integer: EXPERIMENTAL: Controls the largest I/O size in operations that combine I/O in 8kB units, and silently limits the user-settable parameter io_combine_limit. Version 18 and up only. Changing this parameter causes a service restart.
    - `io_method` 'worker' | 'sync' | 'io_uring': EXPERIMENTAL: Controls the maximum number of I/O operations that one process can execute simultaneously. Version 18 and up only. Changing this parameter causes a service restart.
    - `max_stack_depth` integer: Maximum depth of the stack in bytes. The default is `2097152` (upstream default).
    - `max_parallel_workers` integer: Sets the maximum number of workers that the system can support for parallel queries. The default is `8` (upstream default).
    - `pg_partman_bgw.role` string: Controls which role to use for pg_partman's scheduled background tasks.
    - `max_logical_replication_workers` integer: PostgreSQL maximum logical replication workers (taken from the pool of max_parallel_workers). The default is `4` (upstream default). Changing this parameter causes a service restart.
    - `max_prepared_transactions` integer: PostgreSQL maximum prepared transactions. The default is `0`. Changing this parameter causes a service restart.
    - `max_worker_processes` integer: Sets the maximum number of background processes that the system can support. The default is `8`. Changing this parameter causes a service restart.
    - `pg_stat_statements.track` 'all' | 'top' | 'none': Controls which statements are counted. Specify top to track top-level statements (those issued directly by clients), all to also track nested statements (such as statements invoked within functions), or none to disable statement statistics collection. The default is `top`.
    - `temp_file_limit` integer: PostgreSQL temporary file limit in KiB, -1 for unlimited
    - `log_error_verbosity` 'TERSE' | 'DEFAULT' | 'VERBOSE': Controls the amount of detail written in the server log for each message that is logged.
    - `log_min_duration_statement` integer: Log statements that take more than this number of milliseconds to run, -1 disables
    - `max_standby_streaming_delay` integer: Max standby streaming delay in milliseconds. The default is `30000` (upstream default).
    - `jit` boolean: Controls system-wide use of Just-in-Time Compilation (JIT).
    - `max_standby_archive_delay` integer: Max standby archive delay in milliseconds. The default is `30000` (upstream default).
    - `bg-writer` object
      - `bgwriter_delay` integer: Specifies the delay between activity rounds for the background writer in milliseconds. The default is `200`.
      - `bgwriter_flush_after` integer: Whenever more than bgwriter_flush_after bytes have been written by the background writer, attempt to force the OS to issue these writes to the underlying storage. Specified in kilobytes. Setting of 0 disables forced writeback. The default is `512`.
      - `bgwriter_lru_maxpages` integer: In each round, no more than this many buffers will be written by the background writer. Setting this to zero disables background writing. The default is `100`.
      - `bgwriter_lru_multiplier` number: The average recent need for new buffers is multiplied by bgwriter_lru_multiplier to arrive at an estimate of the number that will be needed during the next round, (up to bgwriter_lru_maxpages). 1.0 represents a “just in time” policy of writing exactly the number of buffers predicted to be needed. Larger values provide some cushion against spikes in demand, while smaller values intentionally leave writes to be done by server processes. The default is `2.0`.
  - `admin-password` string: Custom password for admin user. Defaults to random string. This must be set only when a new service is being created.
  - `migration` object: Migrate data from existing server
    - `host` string, required: Hostname or IP address of the server where to migrate data from
    - `port` integer, required: Port number of the server where to migrate data from
    - `password` string: Password for authentication with the server where to migrate data from
    - `ssl` boolean: The server where to migrate data from is secured with SSL
    - `username` string: User name for authentication with the server where to migrate data from
    - `dbname` string: Database name for bootstrapping the initial connection
    - `ignore-dbs` string: Comma-separated list of databases, which should be ignored during migration (supported by MySQL only at the moment)
    - `method` 'dump' | 'replication'

## Response `200`

200

- Operation: Operation
  - `id` string, uuid: Operation ID
  - `reason` 'incorrect' | 'unknown' | 'unavailable' | 'forbidden' | 'busy' | 'fault' | 'partial' | 'not-found' | 'interrupted' | 'unsupported' | 'conflict': Operation failure reason
  - `reference` object: Related resource reference
    - `id` string, uuid: Reference ID
    - `link` string: Link to the referenced resource
    - `command` string: Command name
  - `message` string: Operation message
  - `state` 'failure' | 'pending' | 'success' | 'timeout': Operation status

---

[API](https://skmtc.dev/exoscale/apis/exoscale-api.md) - [All operations](https://skmtc.dev/exoscale/apis/exoscale-api/llms.txt) - [OpenAPI document](https://skmtc.dev/exoscale/apis/exoscale-api/revisions/63da6f74c845?raw)
