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

# Get a workspace's usage



## OpenAPI

````yaml /api-reference/openapi.json get /v1/workspaces/{workspaceId}/usage
openapi: 3.1.0
info:
  title: Refmatter API
  version: 0.1.0
  description: >-
    Public social data API: one request turns a TikTok, Instagram, YouTube or
    Meta Ad Library link into structured data; import it to keep verified media,
    a transcript and provenance.
servers:
  - url: https://api.refmatter.com
security:
  - bearerApiKey: []
tags:
  - name: workspaces
    x-group: Workspaces
    description: Manage workspaces and review their usage.
  - name: imports
    x-group: Imports
    description: Start imports from source URLs and check their progress.
  - name: urls
    x-group: URLs
    description: Identify the platform and object represented by a social URL.
  - name: items
    x-group: Items
    description: List and look up items from supported platforms.
  - name: accounts
    x-group: Accounts
    description: Look up accounts and retrieve their current data.
  - name: comments
    x-group: Comments
    description: List comments for supported items.
  - name: search
    x-group: Search
    description: Search supported platforms for items or accounts.
  - name: references
    x-group: References
    description: Manage saved references and their transcripts and media.
  - name: media
    x-group: Media
    description: Create short-lived access to stored media.
  - name: sourceRoutes
    x-group: Sources
    description: List the supported platforms and objects with their limits.
paths:
  /v1/workspaces/{workspaceId}/usage:
    get:
      tags:
        - workspaces
      summary: Get a workspace's usage
      operationId: workspacesUsageGet
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: Opaque workspace identifier
          schema:
            type: string
            format: uuid
        - name: range
          in: query
          required: false
          description: Preset period ending now; default 30d. Omit with from and to
          schema:
            enum:
              - 6h
              - 24h
              - 7d
              - 30d
        - name: from
          in: query
          required: false
          description: First UTC day of a custom period, inclusive; needs to
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Last UTC day of a custom period, inclusive; at most 90 days
          schema:
            type: string
            format: date
      responses:
        '200':
          description: Usage over the requested period
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceUsage'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: Action not permitted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '409':
          description: Revision or idempotency conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: Request cannot be fulfilled by the current source contract
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '503':
          description: Service or dependency unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - bearerApiKey: []
components:
  schemas:
    WorkspaceUsage:
      $schema: https://json-schema.org/draft/2020-12/schema
      type: object
      properties:
        workspaceId:
          type: string
          pattern: >-
            ^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
        window:
          type: object
          properties:
            range:
              type: string
              enum:
                - 6h
                - 24h
                - 7d
                - 30d
                - custom
            start:
              type: string
              pattern: >-
                ^\d{4}-(0[1-9]|1[0-2])-([0-2]\d|3[01])T([01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d{1,9})?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$
            end:
              type: string
              pattern: >-
                ^\d{4}-(0[1-9]|1[0-2])-([0-2]\d|3[01])T([01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d{1,9})?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$
            bucket:
              type: string
              enum:
                - 15m
                - 1h
                - 1d
          required:
            - range
            - start
            - end
            - bucket
          additionalProperties: false
        imports:
          type: object
          properties:
            total:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            succeeded:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            failed:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            cancelled:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            inFlight:
              type: integer
              minimum: 0
              maximum: 9007199254740991
          required:
            - total
            - succeeded
            - failed
            - cancelled
            - inFlight
          additionalProperties: false
        credits:
          type: object
          properties:
            granted:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            spent:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            balance:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
          required:
            - granted
            - spent
            - balance
          additionalProperties: false
        failuresByCode:
          maxItems: 20
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - invalid_input
                  - unauthenticated
                  - invalid_credential
                  - credential_conflict
                  - forbidden
                  - policy_blocked
                  - route_disabled
                  - route_degraded
                  - not_found
                  - bootstrap_conflict
                  - last_owner_conflict
                  - revision_conflict
                  - idempotency_conflict
                  - unavailable_private
                  - unavailable_restricted
                  - unavailable_removed
                  - unsupported_object
                  - unsupported_media
                  - insufficient_credits
                  - limit_exceeded
                  - rate_limited
                  - source_changed
                  - network_timeout
                  - network_transport
                  - media_invalid
                  - storage_unavailable
                  - retry_exhausted
                  - internal_error
              count:
                type: integer
                minimum: 0
                maximum: 9007199254740991
            required:
              - code
              - count
            additionalProperties: false
        series:
          maxItems: 100
          type: array
          items:
            type: object
            properties:
              total:
                type: integer
                minimum: 0
                maximum: 9007199254740991
              succeeded:
                type: integer
                minimum: 0
                maximum: 9007199254740991
              failed:
                type: integer
                minimum: 0
                maximum: 9007199254740991
              start:
                type: string
                pattern: >-
                  ^\d{4}-(0[1-9]|1[0-2])-([0-2]\d|3[01])T([01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d{1,9})?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$
            required:
              - total
              - succeeded
              - failed
              - start
            additionalProperties: false
        byPlatform:
          maxItems: 16
          type: array
          items:
            type: object
            properties:
              total:
                type: integer
                minimum: 0
                maximum: 9007199254740991
              succeeded:
                type: integer
                minimum: 0
                maximum: 9007199254740991
              failed:
                type: integer
                minimum: 0
                maximum: 9007199254740991
              platform:
                anyOf:
                  - type: string
                    enum:
                      - youtube
                      - tiktok
                      - instagram
                      - meta_ad_library
                  - type: 'null'
            required:
              - total
              - succeeded
              - failed
              - platform
            additionalProperties: false
        generatedAt:
          type: string
          pattern: >-
            ^\d{4}-(0[1-9]|1[0-2])-([0-2]\d|3[01])T([01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d{1,9})?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$
      required:
        - workspaceId
        - window
        - imports
        - credits
        - failuresByCode
        - series
        - byPlatform
        - generatedAt
      additionalProperties: false
    ErrorEnvelope:
      $schema: https://json-schema.org/draft/2020-12/schema
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - invalid_input
                - unauthenticated
                - invalid_credential
                - credential_conflict
                - forbidden
                - policy_blocked
                - route_disabled
                - route_degraded
                - not_found
                - bootstrap_conflict
                - last_owner_conflict
                - revision_conflict
                - idempotency_conflict
                - unavailable_private
                - unavailable_restricted
                - unavailable_removed
                - unsupported_object
                - unsupported_media
                - insufficient_credits
                - limit_exceeded
                - rate_limited
                - source_changed
                - network_timeout
                - network_transport
                - media_invalid
                - storage_unavailable
                - retry_exhausted
                - internal_error
            message:
              type: string
              minLength: 1
              maxLength: 240
            retryable:
              type: boolean
            requestId:
              type: string
              minLength: 8
              maxLength: 128
              pattern: ^[A-Za-z0-9][A-Za-z0-9._:-]*$
            details:
              type: object
              propertyNames:
                type: string
              additionalProperties:
                type:
                  - string
                  - number
                  - boolean
          required:
            - code
            - message
            - retryable
            - requestId
            - details
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer

````