Aiven Service:_MySQL API

The Service:_MySQL API from Aiven — 5 operation(s) for service:_mysql.

Operations 5

POST /account/{account_id}/mysql/query/optimize Get optimization recommendations for a query #
GET /mysql/database-metadata-query Retrieve metadata query for MySQL database #
POST /mysql/query/metadata-validate Validate schema metadata structure and statistics #
POST /project/{project}/service/{service_name}/mysql/query/stats Fetch MySQL service query statistics #
POST /mysql/query/validate Validate SQL query syntax #

Documentation

Specifications

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/aiven-service-mysql-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

aiven-service-mysql-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact:
    email: support@aiven.io
    name: Aiven support team
    url: https://aiven.io/support-services
  title: 'Aiven API Documentation Service: My SQL 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


    Direct link to openapi.json for use with external tools


    Aiven is a modern fully-managed open source data platform for streaming, storing, and analyzing data on any public cloud.'
servers:
- url: https://api.aiven.io/v1
tags:
- name: Service:_MySQL
  x-displayName: 'Service: MySQL'
paths:
  /account/{account_id}/mysql/query/optimize:
    post:
      summary: Get optimization recommendations for a query
      tags:
      - Service:_MySQL
      operationId: MySQLAccountQueryOptimize
      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.
      parameters:
      - $ref: '#/components/parameters/account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MySQLAccountQueryOptimizeRequestBody'
            example:
              do_not_store: true
              flags: []
              mysql_version: '8.4'
              query: Select email from users;
              schema_metadata: '{ ''columns'': [...], ''indexes'': [...], ''views'': [...], ... }'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MySQLAccountQueryOptimizeResponse'
        '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
  /mysql/database-metadata-query:
    get:
      summary: Retrieve metadata query for MySQL database
      tags:
      - Service:_MySQL
      operationId: MySQLServiceDatabaseMetadataQuery
      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/MySQLServiceDatabaseMetadataQueryResponse'
  /mysql/query/metadata-validate:
    post:
      summary: Validate schema metadata structure and statistics
      tags:
      - Service:_MySQL
      operationId: MySQLServiceMetadataValidate
      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/MySQLServiceMetadataValidateRequestBody'
            example:
              db_version: '16'
              metadata: '{ ''columns'': [...], ''indexes'': [...], ''views'': [...], ... }'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MySQLServiceMetadataValidateResponse'
        '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}/mysql/query/stats:
    post:
      summary: Fetch MySQL service query statistics
      tags:
      - Service:_MySQL
      operationId: MySQLServiceQueryStatistics
      parameters:
      - $ref: '#/components/parameters/project'
      - $ref: '#/components/parameters/service_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MySQLServiceQueryStatisticsRequestBody'
            example:
              limit: 100
              offset: 100
              order_by: count_star:desc,sum_timer_wait:asc
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MySQLServiceQueryStatisticsResponse'
      security:
      - tokenAuth: []
        oauth2:
        - services:read
  /mysql/query/validate:
    post:
      summary: Validate SQL query syntax
      tags:
      - Service:_MySQL
      operationId: MySQLServiceQueryValidate
      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/MySQLServiceQueryValidateRequestBody'
            example:
              do_not_store: true
              query: select email from users;
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MySQLServiceQueryValidateResponse'
        '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'
components:
  schemas:
    MySQLServiceQueryStatisticsResponse:
      type: object
      description: MySQLServiceQueryStatisticsResponse
      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:
              avg_timer_wait:
                type: number
                description: Query statistic
              count_star:
                type: number
                description: Query statistic
              digest:
                type: string
                description: Query statistic
              digest_text:
                type: string
                description: Query statistic
              first_seen:
                type: string
                description: Query statistic
              last_seen:
                type: string
                description: Query statistic
              max_timer_wait:
                type: number
                description: Query statistic
              min_timer_wait:
                type: number
                description: Query statistic
              quantile_95:
                type: number
                description: Query statistic
              quantile_99:
                type: number
                description: Query statistic
              quantile_999:
                type: number
                description: Query statistic
              query_sample_seen:
                type: string
                description: Query statistic
              query_sample_text:
                type: string
                description: Query statistic
              query_sample_timer_wait:
                type: string
                description: Query statistic
              schema_name:
                type: string
                description: Query statistic
              sum_created_tmp_disk_tables:
                type: number
                description: Query statistic
              sum_created_tmp_tables:
                type: number
                description: Query statistic
              sum_errors:
                type: number
                description: Query statistic
              sum_lock_time:
                type: number
                description: Query statistic
              sum_no_good_index_used:
                type: number
                description: Query statistic
              sum_no_index_used:
                type: number
                description: Query statistic
              sum_rows_affected:
                type: number
                description: Query statistic
              sum_rows_examined:
                type: number
                description: Query statistic
              sum_rows_sent:
                type: number
                description: Query statistic
              sum_select_full_join:
                type: number
                description: Query statistic
              sum_select_full_range_join:
                type: number
                description: Query statistic
              sum_select_range:
                type: number
                description: Query statistic
              sum_select_range_check:
                type: number
                description: Query statistic
              sum_select_scan:
                type: number
                description: Query statistic
              sum_sort_merge_passes:
                type: number
                description: Query statistic
              sum_sort_range:
                type: number
                description: Query statistic
              sum_sort_rows:
                type: number
                description: Query statistic
              sum_sort_scan:
                type: number
                description: Query statistic
              sum_timer_wait:
                type: number
                description: Query statistic
              sum_warnings:
                type: number
                description: Query statistic
      required:
      - queries
    MySQLServiceMetadataValidateResponse:
      type: object
      description: MySQLServiceMetadataValidateResponse
      properties:
        status:
          type: string
          description: Status
      required:
      - status
    MySQLServiceDatabaseMetadataQueryResponse:
      type: object
      description: MySQLServiceDatabaseMetadataQueryResponse
      properties:
        metadata_query:
          type: string
          description: Database metadata retrieval query
      required:
      - metadata_query
    MySQLServiceQueryValidateResponse:
      type: object
      description: MySQLServiceQueryValidateResponse
      properties:
        status:
          type: string
          description: Status
      required:
      - status
    MySQLAccountQueryOptimizeRequestBody:
      type: object
      description: MySQLAccountQueryOptimizeRequestBody
      properties:
        do_not_store:
          type: boolean
          description: Do not store details
          default: false
        flags:
          type: array
          description: Optimization flags
          items:
            type: string
        mysql_version:
          type: string
          description: An enumeration.
          title: MySQL version
          enum:
          - '5.0'
          - '5.1'
          - '5.5'
          - '5.6'
          - '5.7'
          - '8.0'
          - '8.1'
          - '8.2'
          - '8.3'
          - '8.4'
        query:
          type: string
          description: Query
        schema_metadata:
          type: string
          description: Schema metadata
      required:
      - flags
      - mysql_version
      - query
    MySQLServiceQueryStatisticsRequestBody:
      type: object
      description: MySQLServiceQueryStatisticsRequestBody
      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: avg_timer_wait, count_star, digest, digest_text, first_seen, last_seen, max_timer_wait, min_timer_wait, query_sample_seen, query_sample_text, query_sample_timer_wait, quantile_95, quantile_99, quantile_999, schema_name, sum_created_tmp_disk_tables, sum_created_tmp_tables, sum_errors, sum_lock_time, sum_no_good_index_used, sum_no_index_used, sum_rows_affected, sum_rows_examined, sum_rows_sent, sum_select_full_join, sum_select_full_range_join, sum_select_range, sum_select_range_check, sum_select_scan, sum_sort_merge_passes, sum_sort_range, sum_sort_rows, sum_sort_scan, sum_timer_wait, sum_warnings'
          title: Order in which to sort retrieved results
          default: count_star:desc
    MySQLServiceMetadataValidateRequestBody:
      type: object
      description: MySQLServiceMetadataValidateRequestBody
      properties:
        db_version:
          type: string
          description: Database version
        metadata:
          type: string
          description: Metadata to validate
      required:
      - db_version
      - metadata
    MySQLServiceQueryValidateRequestBody:
      type: object
      description: MySQLServiceQueryValidateRequestBody
      properties:
        do_not_store:
          type: boolean
          description: Do not store details
          default: false
        query:
          type: string
          description: Query
      required:
      - query
    MySQLAccountQueryOptimizeResponse:
      type: object
      description: MySQLAccountQueryOptimizeResponse
      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
  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
    project:
      in: path
      name: project
      description: Project name
      schema:
        type: string
      required: true
  securitySchemes:
    tokenAuth:
      description: 'Header should be of the format `authorization: aivenv1 <TOKEN>`. Tokens can be obtained from [your Aiven profile page](https://console.aiven.io/profile/auth)'
      scheme: bearer
      type: http
    oauth2:
      type: oauth2
      description: OAuth2 security scheme
      flows:
        authorizationCode:
          authorizationUrl: https://console.aiven.io/oauth/authorize
          tokenUrl: https://api.aiven.io/v1/oauth2/token
          scopes:
            all: Provide full access to the API
            accounts: Allow enumerating and reading accounts configuration
            accounts:read: Allow modifying account configuration
            accounts:write: Provides full access to authentication related API
            authentication: Provides full access to authentication related API
            authentication:read: Allow reading authentication related configuration on resources (user profile, accounts)
            authentication:write: Allow modifying authentication related configurations on resources (user profile, accounts)
            billing: Provide full access to billing APIs
            billing:read: Allow reading billing information and configuration
            billing:write: Allow writing billing configuration
            payments: Provide full access to payment method APIs
            payments:read: Allow reading the payment method configurations
            payments:write: Allows writing payment method configuration
            privatelink: Provide full access to private link APIs
            privatelink:read: Allow enumerating and reading private link items and configurations
            privatelink:write: Allow writing (creating, modifying, deleting) private link items
            projects: Provide full access to projects APIs
            projects:read: Allow enumerating projects and reading their configuration
            projects:write: Allow writing (creating, modifying, deleting) projects
            scim: Provide full access to SCIM operations
            scim:read: Allow reading SCIM endpoints
            scim:write: Allow writing (modifying) SCIM endpoints
            services: Provide full access to services APIs
            services:read: Allow enumerating services and reading their configuration
            services:write: Allow writing (creating, modifying, deleting) services
            static_ips: Provide full access to static IPs APIs
            static_ips:read: Allow enumerating and reading static IP items and configurations
            static_ips:write: Allow writing (creating, modifying, deleting) static IP items
            tickets: Provide full access to support ticket APIs
            tickets:read: Allow enumerating and reading support tickets
            tickets:write: Allow writing (creating, modifying) support tickets
            user: Provide full access to user profile APIs
            user:read: Allow reading user profile and configuration
            user:write: Allow writing (modifying) user profile and configuration
externalDocs:
  description: Aiven CLI client
  url: https://github.com/aiven/aiven-client