본문 바로가기
WIKI 기술 지식 베이스

조직 사용량 조회

원문 보기 위키 갱신

조직 사용량 조회 (Organization Usage)

조직의 현재 청구 주기 동안 사용한 리소스를 한눈에 확인하는 API예요. 읽은 행 수, 쓴 행 수, 저장 용량은 물론 조직에 속한 데이터베이스별 사용량까지 함께 돌려줘요.

출처: 문서

본문

Fetch current billing cycle usage for an organization.

GET /v1/organizations/{organizationSlug}/usage를 호출하면 조직 전체 사용량과 데이터베이스별 사용량을 받아볼 수 있어요.

```bash cURL theme={null} curl -L https://api.turso.tech/v1/organizations/{organizationSlug}/usage \ -H 'Authorization: Bearer ***' ```

OpenAPI

openapi: 3.0.1
info:
  title: Turso Platform API
  description: API description here
  license:
    name: MIT
  version: 0.1.0
servers:
  - url: https://api.turso.tech
    description: Turso's Platform API
security: []
paths:
  /v1/organizations/{organizationSlug}/usage:
    get:
      summary: Organization Usage
      description: Fetch current billing cycle usage for an organization.
      operationId: getOrganizationUsage
      parameters:
        - $ref: '#/components/parameters/organizationSlug'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  organization:
                    type: object
                    description: >-
                      The organization usage object, containing the total usage
                      for rows read and written, as well as the total storage
                      size (in bytes).
                    properties:
                      uuid:
                        type: string
                        description: The UUID of the organization.
                        example: fa72ba58-7db3-436b-bcab-14b83eb1dd88
                      usage:
                        type: object
                        description: The usage object for the organization.
                        properties:
                          rows_read:
                            type: integer
                            description: >-
                              The number of rows read allowed for the specific
                              plan.
                            example: 1000000000
                          rows_written:
                            type: integer
                            description: >-
                              The number of rows written allowed for the
                              specific plan.
                            example: 25000000
                          databases:
                            type: integer
                            description: >-
                              The number of databases allowed for the specific
                              plan.
                            example: 500
                          locations:
                            type: integer
                            description: >-
                              The number of locations allowed for the specific
                              plan.
                            example: 3
                          storage_bytes:
                            type: integer
                            description: >-
                              The amount of storage allowed for the specific
                              plan, in bytes.
                            example: 9000000000
                          groups:
                            type: integer
                            description: >-
                              The number of groups allowed for the specific
                              plan.
                            example: 1
                          bytes_synced:
                            type: integer
                            description: >-
                              The number of bytes synced allowed for the
                              specific plan, in bytes.
                            example: 3000000000
                      databases:
                        type: array
                        description: The databases for the organization and their usage.
                        items:
                          $ref: '#/components/schemas/DatabaseUsageOutput'
components:
  parameters:
    organizationSlug:
      in: path
      name: organizationSlug
      required: true
      schema:
        type: string
      description: The slug of the organization or user account.
  schemas:
    DatabaseUsageOutput:
      type: object
      properties:
        uuid: 392d53be-f751-4c16-a1a5-49dd57fe99df
        instances:
          type: array
          description: The usage objects for instances of the current database.
          items:
            type: object
            properties:
              uuid:
                type: string
                description: The instance universal unique identifier (UUID).
                example: cd831986-94e5-11ee-a6fe-7a52e1f7759a
              usage:
                $ref: '#/components/schemas/DatabaseUsageObject'
                description: The usage for the current database instance.
          example:
            - uuid: cd831986-94e5-11ee-a6fe-7a52e1f7759a
              usage:
                rows_read: 0
                rows_written: 0
                storage_bytes: 4096
                bytes_synced: 0
            - uuid: 0be90471-6906-11ee-8553-eaa7715aeaf2
              usage:
                rows_read: 0
                rows_written: 0
                storage_bytes: 4096
                bytes_synced: 0
        total:
          $ref: '#/components/schemas/DatabaseUsageObject'
          description: The total usage for the database.
          example:
            rows_read: 0
            rows_written: 0
            storage_bytes: 8192
            bytes_synced: 0
    DatabaseUsageObject:
      type: object
      properties:
        rows_read:
          type: integer
          example: 0
          description: The total rows read in the time period.
        rows_written:
          type: integer
          example: 0
          description: The total rows written in the time period.
        storage_bytes:
          type: integer
          example: 0
          description: The total storage used.
        bytes_synced:
          type: integer
          example: 0
          description: The total bytes synced.

더 알아보기 (Learn more)