openapi: 3.0.1 info: contact: email: support@aiven.io name: Aiven support team url: https://aiven.io/support-services title: Aiven API Documentation Account Service:_PostgreSQL API version: v1 x-logo: altText: Aiven logo backgroundColor: '#fafafa' href: https://api.aiven.io/doc url: https://aiven.io/assets/img/aiven-logo.png description: "# Introduction\n\n[Direct link to openapi.json](https://api.aiven.io/doc/openapi.json) for use with external tools\n\n[Aiven](https://aiven.io) is a modern fully-managed open source data platform for streaming, storing, and analyzing data on any public cloud. On Aiven Platform, you can operate your data infrastructure with a few devops tools: [Aiven Console](https://console.aiven.io/), [Aiven Terraform Provider](https://aiven.io/docs/tools/terraform), [Aiven CLI](https://github.com/aiven/aiven-client), and [Aiven Operator for Kubernetes](https://github.com/aiven/aiven-operator). All of them are built on an open secure powerful REST API for integration with custom tooling.\n\nThe Aiven [REST](http://en.wikipedia.org/wiki/Representational_State_Transfer) API\nprovides programmatic access to Aiven.io services. To call the Aiven API, you can use either CLI tools (for example, `cURL` or [Aiven CLI client](https://aiven.io/docs/tools/cli)) or GUI tools, such as the [Aiven public API Postman collection](https://www.postman.com/aiven-apis).\n\nThis Aiven API documentation will help you operate your Aiven organization, projects, or services programmatically by integrating your applications and processes with Aiven.\n\n# Description\n\nAiven's APIs ([Application Programming Interfaces](https://en.wikipedia.org/wiki/API)) power its platform for data management. Aiven has a number of REST APIs that can help you build strong and robust data infrastructure for your applications.\n\nThe Aiven API is organized around core resources. Each core resource has multiple endpoints, which can be interacted with using different HTTP methods.\n\n## Core resources\n\n### Platform APIs\n\n
This endpoint may be changed or removed at any time. Don't use it in production environments.
parameters: - $ref: '#/components/parameters/account_id' requestBody: content: application/json: schema: $ref: '#/components/schemas/PGAccountQueryOptimizeRequestBody' example: do_not_store: true flags: [] pg_version: '16' query: Select email from users; schema_metadata: '{ ''columns'': [...], ''indexes'': [...], ''views'': [...], ... }' responses: '200': description: Response content: application/json: schema: $ref: '#/components/schemas/PGAccountQueryOptimizeResponse' '400': description: Invalid request parameters content: application/json: schema: type: object properties: message: type: string title: Human readable error message errors: type: array title: List of error details. Typically there is only one element items: type: object properties: message: type: string title: Human readable error message error_code: type: string enum: - optimization_failed - unable_to_parse_query title: Machine processable error code. Clients must be prepared to handle new codes. description: 'optimization_failed: The service was unable to optimize the SQL query. unable_to_parse_query: The service could not parse the query due to syntax errors or unsupported expressions' '404': description: Resource not found content: application/json: schema: type: object properties: message: type: string title: Human readable error message errors: type: array title: List of error details. Typically there is only one element items: type: object properties: message: type: string title: Human readable error message error_code: type: string enum: - account_not_found title: Machine processable error code. Clients must be prepared to handle new codes. description: 'account_not_found: No such account exists' security: - tokenAuth: [] oauth2: - accounts:read /project/{project}/service/{service_name}/pg/available-extensions: get: summary: List PostgreSQL extensions that can be loaded with CREATE EXTENSION in this service tags: - Service:_PostgreSQL operationId: PGServiceAvailableExtensions parameters: - $ref: '#/components/parameters/project' - $ref: '#/components/parameters/service_name' responses: '200': description: Response content: application/json: schema: $ref: '#/components/schemas/PGServiceAvailableExtensionsResponse' security: - tokenAuth: [] oauth2: - services:read /pg/database-metadata-query: get: summary: Get the query used to retrieve schema metadata tags: - Service:_PostgreSQL operationId: PGServiceDatabaseMetadataQuery x-badges: - name: Experimental position: after color: '#787885' x-experimental: true description:
This endpoint may be changed or removed at any time. Don't use it in production environments.
responses: '200': description: Response content: application/json: schema: $ref: '#/components/schemas/PGServiceDatabaseMetadataQueryResponse' /pg/query/metadata-validate: post: summary: Validate schema metadata structure and statistics tags: - Service:_PostgreSQL operationId: PGServiceMetadataValidate x-badges: - name: Experimental position: after color: '#787885' x-experimental: true description:
This endpoint may be changed or removed at any time. Don't use it in production environments.
requestBody: content: application/json: schema: $ref: '#/components/schemas/PGServiceMetadataValidateRequestBody' example: db_version: '16' metadata: '{ ''columns'': [...], ''indexes'': [...], ''views'': [...], ... }' responses: '200': description: Response content: application/json: schema: $ref: '#/components/schemas/PGServiceMetadataValidateResponse' '400': description: Invalid request parameters content: application/json: schema: type: object properties: message: type: string title: Human readable error message errors: type: array title: List of error details. Typically there is only one element items: type: object properties: message: type: string title: Human readable error message error_code: type: string enum: - metadata_validation_failed title: Machine processable error code. Clients must be prepared to handle new codes. description: 'metadata_validation_failed: Metadata validation failed' /project/{project}/service/{service_name}/pg/query/stats: post: summary: Fetch PostgreSQL service query statistics tags: - Service:_PostgreSQL operationId: PGServiceQueryStatistics parameters: - $ref: '#/components/parameters/project' - $ref: '#/components/parameters/service_name' requestBody: content: application/json: schema: $ref: '#/components/schemas/PGServiceQueryStatisticsRequestBody' example: limit: 100 offset: 100 order_by: calls:desc,total_time:asc responses: '200': description: Response content: application/json: schema: $ref: '#/components/schemas/PGServiceQueryStatisticsResponse' security: - tokenAuth: [] oauth2: - services:read /project/{project}/service/{service_name}/query/stats: post: summary: 'Fetch PostgreSQL service query statistics (DEPRECATED: Use /project/$project/service/$service/pg/query/stats instead)' tags: - Service:_PostgreSQL operationId: PGServiceQueryStatisticsDeprecated deprecated: true description: '
DEPRECATED: Use /project/$project/service/$service/pg/query/stats instead
' parameters: - $ref: '#/components/parameters/project' - $ref: '#/components/parameters/service_name' responses: '200': description: Response content: application/json: schema: $ref: '#/components/schemas/PGServiceQueryStatisticsDeprecatedResponse' security: - tokenAuth: [] oauth2: - services:read /pg/query/validate: post: summary: Validate SQL query syntax tags: - Service:_PostgreSQL operationId: PGServiceQueryValidate x-badges: - name: Experimental position: after color: '#787885' x-experimental: true description:This endpoint may be changed or removed at any time. Don't use it in production environments.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PGServiceQueryValidateRequestBody'
example:
do_not_store: true
query: select email from users;
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/PGServiceQueryValidateResponse'
'400':
description: Invalid request parameters
content:
application/json:
schema:
type: object
properties:
message:
type: string
title: Human readable error message
errors:
type: array
title: List of error details. Typically there is only one element
items:
type: object
properties:
message:
type: string
title: Human readable error message
error_code:
type: string
enum:
- query_validation_failed
title: Machine processable error code. Clients must be prepared to handle new codes.
description: 'query_validation_failed: Query validation failed'
/project/{project}/service/{service_name}/connection_pool:
post:
summary: Create a new connection pool for service
tags:
- Service:_PostgreSQL
operationId: ServicePGBouncerCreate
parameters:
- $ref: '#/components/parameters/project'
- $ref: '#/components/parameters/service_name'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ServicePGBouncerCreateRequestBody'
example:
database: testdb
pool_mode: session
pool_name: mypool-x-y-z
pool_size: 50
username: testuser
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/ServicePGBouncerCreateResponse'
security:
- tokenAuth: []
oauth2:
- services:write
/project/{project}/service/{service_name}/connection_pool/{pool_name}:
delete:
summary: Delete a connection pool
tags:
- Service:_PostgreSQL
operationId: ServicePGBouncerDelete
parameters:
- $ref: '#/components/parameters/project'
- $ref: '#/components/parameters/service_name'
- $ref: '#/components/parameters/pool_name'
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/ServicePGBouncerDeleteResponse'
security:
- tokenAuth: []
oauth2:
- services:write
put:
summary: Update a connection pool
tags:
- Service:_PostgreSQL
operationId: ServicePGBouncerUpdate
parameters:
- $ref: '#/components/parameters/project'
- $ref: '#/components/parameters/service_name'
- $ref: '#/components/parameters/pool_name'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ServicePGBouncerUpdateRequestBody'
example:
database: testdb
pool_mode: session
pool_size: 50
username: testuser
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/ServicePGBouncerUpdateResponse'
security:
- tokenAuth: []
oauth2:
- services:write
components:
schemas:
PGAccountQueryOptimizeResponse:
type: object
description: PGAccountQueryOptimizeResponse
properties:
optimize:
type: object
description: Optimize
properties:
existing_recommended_indexes:
type: array
description: Existing Recommended Indexes
items:
type: object
properties:
index_definition:
type: string
description: Index definition
required:
- index_definition
index_recommendations:
type: array
description: Index Recommendations
items:
type: object
properties:
creation_cmd:
type: string
description: Creation command
table_name:
type: string
description: Table name
required:
- creation_cmd
- table_name
optimization_id:
type: string
description: Optimization ID
optimized_query:
type: string
description: Optimized query in base64 format
original_query:
type: string
description: Original query in base64 format
recommendations:
type: array
description: Recommendations
items:
type: object
properties:
bad_practice_sample:
type: string
description: Bad practice sample
best_practice_sample:
type: string
description: Best practice sample
description:
type: string
description: Description
fixable:
type: boolean
description: Fixable
line_number:
type: integer
description: Line number
priority:
type: integer
description: Priority
title:
type: string
description: Title
type:
type: integer
description: Type
required:
- bad_practice_sample
- best_practice_sample
- description
- fixable
- line_number
- priority
- title
- type
required:
- existing_recommended_indexes
- index_recommendations
- optimized_query
- original_query
- recommendations
required:
- optimize
ServicePGBouncerUpdateResponse:
type: object
description: ServicePGBouncerUpdateResponse
properties:
errors:
type: array
description: List of errors occurred during request processing
items:
type: object
properties:
message:
type: string
description: Printable error message
more_info:
type: string
description: URL to the documentation of the error
status:
type: integer
description: HTTP error status code
required:
- message
- status
message:
type: string
description: Printable result of the request
PGServiceAvailableExtensionsResponse:
type: object
description: PGServiceAvailableExtensionsResponse
properties:
errors:
type: array
description: List of errors occurred during request processing
items:
type: object
properties:
message:
type: string
description: Printable error message
more_info:
type: string
description: URL to the documentation of the error
status:
type: integer
description: HTTP error status code
required:
- message
- status
extensions:
type: array
description: Extensions available for loading with CREATE EXTENSION in this service
items:
type: object
properties:
default_version:
type: string
description: Default version
name:
type: string
description: Extension name
versions:
type: array
description: Extension versions available
items:
type: string
required:
- name
message:
type: string
description: Printable result of the request
required:
- extensions
PGServiceDatabaseMetadataQueryResponse:
type: object
description: PGServiceDatabaseMetadataQueryResponse
properties:
metadata_query:
type: string
description: Database metadata retrieval query
required:
- metadata_query
ServicePGBouncerCreateRequestBody:
type: object
description: ServicePGBouncerCreateRequestBody
properties:
database:
type: string
maxLength: 63
description: Service database name
pool_mode:
type: string
description: PGBouncer pool mode
default: transaction
enum:
- session
- transaction
- statement
pool_name:
type: string
maxLength: 63
description: Connection pool name
pool_size:
type: integer
minimum: 1
maximum: 10000
description: Size of PGBouncer's PostgreSQL side connection pool
default: 10
username:
type: string
maxLength: 64
description: Service username
required:
- database
- pool_name
ServicePGBouncerCreateResponse:
type: object
description: ServicePGBouncerCreateResponse
properties:
errors:
type: array
description: List of errors occurred during request processing
items:
type: object
properties:
message:
type: string
description: Printable error message
more_info:
type: string
description: URL to the documentation of the error
status:
type: integer
description: HTTP error status code
required:
- message
- status
message:
type: string
description: Printable result of the request
PGServiceQueryStatisticsDeprecatedResponse:
type: object
description: PGServiceQueryStatisticsDeprecatedResponse
properties:
errors:
type: array
description: List of errors occurred during request processing
items:
type: object
properties:
message:
type: string
description: Printable error message
more_info:
type: string
description: URL to the documentation of the error
status:
type: integer
description: HTTP error status code
required:
- message
- status
message:
type: string
description: Printable result of the request
queries:
type: array
description: List of query statistics
items:
type: object
properties:
blk_read_time:
type: number
description: Query statistic
blk_write_time:
type: number
description: Query statistic
calls:
type: number
description: Query statistic
database_name:
type: string
description: Query statistic
local_blks_dirtied:
type: number
description: Query statistic
local_blks_hit:
type: number
description: Query statistic
local_blks_read:
type: number
description: Query statistic
local_blks_written:
type: number
description: Query statistic
max_plan_time:
type: number
description: Query statistic
max_time:
type: number
description: Query statistic
mean_plan_time:
type: number
description: Query statistic
mean_time:
type: number
description: Query statistic
min_plan_time:
type: number
description: Query statistic
min_time:
type: number
description: Query statistic
query:
type: string
description: Query statistic
queryid:
type: number
description: Query statistic
rows:
type: number
description: Query statistic
shared_blks_dirtied:
type: number
description: Query statistic
shared_blks_hit:
type: number
description: Query statistic
shared_blks_read:
type: number
description: Query statistic
shared_blks_written:
type: number
description: Query statistic
stddev_plan_time:
type: number
description: Query statistic
stddev_time:
type: number
description: Query statistic
temp_blks_read:
type: number
description: Query statistic
temp_blks_written:
type: number
description: Query statistic
total_plan_time:
type: number
description: Query statistic
total_time:
type: number
description: Query statistic
user_name:
type: string
description: Query statistic
wal_bytes:
type: string
description: Query statistic
wal_fpi:
type: number
description: Query statistic
wal_records:
type: number
description: Query statistic
required:
- queries
PGServiceQueryValidateResponse:
type: object
description: PGServiceQueryValidateResponse
properties:
status:
type: string
description: Status
required:
- status
ServicePGBouncerUpdateRequestBody:
type: object
description: ServicePGBouncerUpdateRequestBody
properties:
database:
type: string
maxLength: 63
description: Service database name
pool_mode:
type: string
description: PGBouncer pool mode
enum:
- session
- transaction
- statement
pool_size:
type: integer
minimum: 1
maximum: 10000
description: Size of PGBouncer's PostgreSQL side connection pool
username:
type: string
maxLength: 64
description: Service username
PGServiceQueryValidateRequestBody:
type: object
description: PGServiceQueryValidateRequestBody
properties:
do_not_store:
type: boolean
description: Do not store details
default: false
query:
type: string
description: Query
required:
- query
PGAccountQueryOptimizeRequestBody:
type: object
description: PGAccountQueryOptimizeRequestBody
properties:
do_not_store:
type: boolean
description: Do not store details
default: false
flags:
type: array
description: Optimization flags
items:
type: string
pg_version:
type: string
description: An enumeration.
title: PostgreSQL version
enum:
- '18'
- '17'
- '16'
- '15'
- '14'
- '13'
- '12'
- '11'
- '10'
- '9'
- '8'
- '7'
query:
type: string
description: Query
schema_metadata:
type: string
description: Schema metadata
required:
- flags
- pg_version
- query
PGServiceMetadataValidateResponse:
type: object
description: PGServiceMetadataValidateResponse
properties:
status:
type: string
description: Status
required:
- status
PGServiceQueryStatisticsResponse:
type: object
description: PGServiceQueryStatisticsResponse
properties:
errors:
type: array
description: List of errors occurred during request processing
items:
type: object
properties:
message:
type: string
description: Printable error message
more_info:
type: string
description: URL to the documentation of the error
status:
type: integer
description: HTTP error status code
required:
- message
- status
message:
type: string
description: Printable result of the request
queries:
type: array
description: List of query statistics
items:
type: object
properties:
blk_read_time:
type: number
description: Query statistic
blk_write_time:
type: number
description: Query statistic
calls:
type: number
description: Query statistic
database_name:
type: string
description: Query statistic
local_blks_dirtied:
type: number
description: Query statistic
local_blks_hit:
type: number
description: Query statistic
local_blks_read:
type: number
description: Query statistic
local_blks_written:
type: number
description: Query statistic
max_plan_time:
type: number
description: Query statistic
max_time:
type: number
description: Query statistic
mean_plan_time:
type: number
description: Query statistic
mean_time:
type: number
description: Query statistic
min_plan_time:
type: number
description: Query statistic
min_time:
type: number
description: Query statistic
query:
type: string
description: Query statistic
queryid:
type: number
description: Query statistic
rows:
type: number
description: Query statistic
shared_blks_dirtied:
type: number
description: Query statistic
shared_blks_hit:
type: number
description: Query statistic
shared_blks_read:
type: number
description: Query statistic
shared_blks_written:
type: number
description: Query statistic
stddev_plan_time:
type: number
description: Query statistic
stddev_time:
type: number
description: Query statistic
temp_blks_read:
type: number
description: Query statistic
temp_blks_written:
type: number
description: Query statistic
total_plan_time:
type: number
description: Query statistic
total_time:
type: number
description: Query statistic
user_name:
type: string
description: Query statistic
wal_bytes:
type: string
description: Query statistic
wal_fpi:
type: number
description: Query statistic
wal_records:
type: number
description: Query statistic
required:
- queries
PGServiceMetadataValidateRequestBody:
type: object
description: PGServiceMetadataValidateRequestBody
properties:
db_version:
type: string
description: Database version
metadata:
type: string
description: Metadata to validate
required:
- db_version
- metadata
PGServiceQueryStatisticsRequestBody:
type: object
description: PGServiceQueryStatisticsRequestBody
properties:
limit:
type: integer
minimum: 1
maximum: 5000
description: Limit for number of results
default: 100
offset:
type: integer
minimum: 0
description: Offset for retrieved results based on sort order
default: 0
order_by:
type: string
maxLength: 256
description: 'Sort order can be either asc or desc and multiple comma separated columns with their own order can be specified: :asc,:desc. Accepted sort columns are: blk_read_time, blk_write_time, calls, database_name, local_blks_dirtied, local_blks_hit, local_blks_read, local_blks_written, max_plan_time, max_time, mean_plan_time, mean_time, min_plan_time, min_time, query, queryid, rows, shared_blks_dirtied, shared_blks_hit, shared_blks_read, shared_blks_written, stddev_plan_time, stddev_time, temp_blks_read, temp_blks_written, total_plan_time, total_time, user_name, wal_bytes, wal_fpi, wal_records'
title: Order in which to sort retrieved results
default: calls:desc
ServicePGBouncerDeleteResponse:
type: object
description: ServicePGBouncerDeleteResponse
properties:
errors:
type: array
description: List of errors occurred during request processing
items:
type: object
properties:
message:
type: string
description: Printable error message
more_info:
type: string
description: URL to the documentation of the error
status:
type: integer
description: HTTP error status code
required:
- message
- status
message:
type: string
description: Printable result of the request
parameters:
account_id:
in: path
name: account_id
description: Account ID
schema:
type: string
required: true
service_name:
in: path
name: service_name
description: Service name
schema:
type: string
required: true
pool_name:
in: path
name: pool_name
description: PgBouncer connection pool name
schema:
type: string
required: true
project:
in: path
name: project
description: Project name
schema:
type: string
required: true
securitySchemes:
tokenAuth:
description: 'Header should be of the format `authorization: aivenv1