> ## Documentation Index
> Fetch the complete documentation index at: https://developers.liara.ir/llms.txt
> Use this file to discover all available pages before exploring further.

# Get database events

> Returns up to 100 lifecycle events of the database, such as started, stopped, restarted or out of memory. You can read events from the last 7 days. Team permission: `view`, `operate` or `manage`.



## OpenAPI

````yaml /spec/dbaas.yaml get /v1/databases/{databaseID}/events
openapi: 3.0.1
info:
  title: Databases
  version: 1.0.0
  description: >
    Create managed databases, connect to them, change their plans and

    settings, back them up and restore them, and read their metrics and

    events.


    Supported types: `mysql`, `mariadb`, `postgres`, `mongodb`, `redis`,

    `mssql`, `elasticsearch`, `rabbitmq` and `clickhouse`. Databases are

    created in one of your private networks (see Networks in Apps &

    Deployments).


    ## Connecting


    `GET /v1/databases/{databaseID}` returns the connection details:


    - **From apps in the same network:** `hostname` and `internalPort`.

    - **Over the public network** (if `publicNetwork` is on):
    `network.node.host`
      and `port`.
    - **Credentials:** `username` and `root_password`.


    ## Team permissions


    With `teamID`, each endpoint needs one of the database permissions it

    lists (`view`, `operate` or `manage`). A permission from your role or a

    resource permission on that database both count.
servers:
  - url: https://api.liara.ir
security:
  - bearerAuth: []
tags:
  - name: Databases
    description: Create, list, inspect and delete databases.
  - name: Configuration
    description: Plans, scaling, settings, public network, password and control panel.
  - name: Backups
    description: Back up databases, download backups and import backup files.
  - name: Metrics & Events
    description: >-
      Resource usage, lifecycle events and the progress of background
      operations.
paths:
  /v1/databases/{databaseID}/events:
    get:
      tags:
        - Metrics & Events
      summary: Get database events
      description: >-
        Returns up to 100 lifecycle events of the database, such as started,
        stopped, restarted or out of memory. You can read events from the last 7
        days. Team permission: `view`, `operate` or `manage`.
      operationId: getDatabaseEvents
      parameters:
        - $ref: '#/components/parameters/TeamID'
        - $ref: '#/components/parameters/DatabaseID'
        - name: start
          in: query
          required: false
          description: >-
            Start of the range, in Unix seconds. Defaults to 1 day ago; values
            older than 7 days are moved to 7 days ago.
          schema:
            type: integer
        - name: end
          in: query
          required: false
          description: >-
            End of the range, in Unix seconds. Defaults to now. Must be after
            `start`.
          schema:
            type: integer
        - name: direction
          in: query
          required: false
          description: >-
            `backward` returns the newest events first, `forward` the oldest
            first.
          schema:
            type: string
            enum:
              - backward
              - forward
            default: backward
        - name: search
          in: query
          required: false
          description: Only return events containing this text. At least 3 characters.
          schema:
            type: string
            minLength: 3
      responses:
        '200':
          description: Events. Each event can include additional fields not listed here.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: ID of the instance the event is about.
                        action:
                          type: string
                          description: >-
                            What happened, for example `start`, `stop`,
                            `restart` or `oom`.
                        time:
                          type: string
                          description: When it happened, in Unix seconds.
              example:
                data:
                  - id: <instance-id>
                    action: start
                    time: '1767254400'
        '400':
          $ref: '#/components/responses/ValidationOrTeamIDError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/TeamForbidden'
        '404':
          $ref: '#/components/responses/DatabaseNotFound'
        '503':
          $ref: '#/components/responses/TemporarilyUnavailable'
components:
  parameters:
    TeamID:
      name: teamID
      in: query
      required: false
      description: >-
        Run the request in the context of a team you belong to, instead of your
        personal account.
      schema:
        $ref: '#/components/schemas/ObjectID'
      example: '000000000000000000000002'
    DatabaseID:
      name: databaseID
      in: path
      required: true
      description: The database's `_id`.
      schema:
        $ref: '#/components/schemas/ObjectID'
      example: '000000000000000000000300'
  responses:
    ValidationOrTeamIDError:
      description: >-
        The body or a parameter is invalid (`message` says which), or `teamID`
        isn't a valid ID.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            validation:
              summary: Invalid parameter
              value:
                statusCode: 400
                error: Bad Request
                message: Invalid id
            invalidTeamID:
              summary: Invalid team ID
              value:
                statusCode: 400
                error: Bad Request
                message: Invalid team ID.
                data: null
    Unauthorized:
      description: The API token is missing, invalid or expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthError'
          example:
            error: Unauthorized.
    TeamForbidden:
      description: >-
        With `teamID`: you aren't a member of the team (`team_not_found`), or
        you don't have the required permission on this database
        (`no_permission`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            teamNotFound:
              summary: Not a team member
              value:
                statusCode: 403
                error: Forbidden
                message: Team not found
                data:
                  code: team_not_found
            noPermission:
              summary: Missing permission
              value:
                statusCode: 403
                error: Forbidden
                message: You do not have permission to access this resource.
                data:
                  code: no_permission
    DatabaseNotFound:
      description: The database doesn't exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 404
            error: Not Found
            message: Database not found.
            data: null
    TemporarilyUnavailable:
      description: The data is temporarily unavailable. Try again later.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 503
            error: Service Unavailable
            message: Service Unavailable
            data: null
  schemas:
    ObjectID:
      type: string
      pattern: ^[0-9a-fA-F]{24}$
      description: 24-character hexadecimal ID.
    Error:
      type: object
      description: Standard error body.
      properties:
        statusCode:
          type: integer
        error:
          type: string
          description: HTTP status text.
        message:
          type: string
          description: What went wrong.
        data:
          type: object
          nullable: true
          description: >-
            Extra details. When present, `code` is a stable, machine-readable
            error code.
          properties:
            code:
              type: string
    AuthError:
      type: object
      description: Error body returned when the API token is rejected.
      properties:
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Send your API token as `Authorization: Bearer <api-token>`.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.