Runtime Usage API

The usage API from Runtime, for usage.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 2

GET /v2/usage Returns the organization's credit and charges (everything credited and spent… #
GET /v2/usage/export Returns the organization's measured usage in a time range, of every resource or… #

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/withruntime-com:withruntime-com-usage-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

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. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

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

OpenAPI Specification

withruntime-com-usage-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Runtime API v2 Usage API
  version: '2026-10-27'
servers:
- url: https://api.withruntime.com
security:
- bearer: []
tags:
- name: Usage
paths:
  /v2/usage:
    get:
      operationId: usage.get
      summary: Returns the organization's credit and charges (everything credited and spent…
      tags:
      - Usage
      x-action: usage:get
      parameters:
      - name: key
        in: query
        required: false
        description: 'One key''s spend too, by its ID: a key the caller may see (its own holder''s, or any for an owner or admin); any other is 404.'
        schema:
          type: string
      - name: by
        in: query
        required: false
        description: 'Splits too (repeat it for both): `hour`, what each product used each hour (`hours`); `key`, what each key used this month (`keys`).'
        schema:
          type: array
          items:
            type: string
      responses:
        '400':
          description: 'An error: invalid_request.'
          x-error-codes:
          - invalid_request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: 'An error: unauthorized.'
          x-error-codes:
          - unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: 'An error: forbidden.'
          x-error-codes:
          - forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 'An error: rate_limited.'
          x-error-codes:
          - rate_limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: 'An error: internal.'
          x-error-codes:
          - internal
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: 'An error: unavailable.'
          x-error-codes:
          - unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '200':
          description: What the org has used and has left, at the card's prices.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Usage'
      x-mcp-tool: runtime_usage_get
      x-idempotent: true
  /v2/usage/export:
    get:
      operationId: usage.export
      summary: Returns the organization's measured usage in a time range, of every resource or…
      tags:
      - Usage
      x-action: usage:list
      parameters:
      - name: since
        in: query
        required: true
        description: The range's first moment, inclusive (UTC, RFC 3339).
        schema:
          type: string
          format: date-time
      - name: until
        in: query
        required: true
        description: The range's end, exclusive (UTC, RFC 3339).
        schema:
          type: string
          format: date-time
      - name: by
        in: query
        required: false
        description: 'What the range selects lines by: `hour`, each line''s hour''s start, or `settled`, its settledAt (its hour''s end), of hours that have ended. Ranges by `settled`, each from the last one''s end to no later than `finalThrough`, read every line once, final.'
        schema:
          type: string
          default: hour
      - name: resourceId
        in: query
        required: false
        description: 'Only the usage of these resources (repeat it for several, up to 100): each line''s `resourceId`, such as a machine''s ID.'
        schema:
          type: array
          items:
            type: string
      - name: cursor
        in: query
        required: false
        description: 'Where the page starts: a page''s `next`.'
        schema:
          type: string
      - name: limit
        in: query
        required: false
        description: At most this many machine-hours.
        schema:
          type: integer
          default: 100
          minimum: 1
          maximum: 500
      responses:
        '400':
          description: 'An error: invalid_request.'
          x-error-codes:
          - invalid_request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: 'An error: unauthorized.'
          x-error-codes:
          - unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: 'An error: forbidden.'
          x-error-codes:
          - forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: 'An error: conflict.'
          x-error-codes:
          - conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 'An error: rate_limited.'
          x-error-codes:
          - rate_limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: 'An error: internal.'
          x-error-codes:
          - internal
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: 'An error: unavailable.'
          x-error-codes:
          - unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '200':
          description: The organization's measured usage in a time range, oldest hour first.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageExport'
      x-mcp-tool: runtime_usage_export
      x-idempotent: true
components:
  schemas:
    UsageExport:
      type: object
      description: The organization's measured usage in a time range, oldest hour first.
      properties:
        since:
          type: string
          format: date-time
          description: The range's first moment, inclusive (UTC).
        until:
          type: string
          format: date-time
          description: The range's end, exclusive (UTC).
        finalThrough:
          type: string
          format: date-time
          description: 'Every line whose `settledAt` is at or before this moment is final: all usage before it has been measured. It never moves back; a later hour stays open until its usage is measured. None: no line is final yet.'
        items:
          type: array
          items:
            $ref: '#/components/schemas/UsageLine'
          description: Each meter of each resource's hour.
        next:
          type: string
          description: Pass as cursor, with the same range, for the next page; none on the last.
        cursor:
          type: string
          description: The cursor this page was asked from; none on the first page.
      required:
      - since
      - until
      - items
    KeySpend:
      type: object
      description: What one key, or what was made with no key, used this month.
      properties:
        keyId:
          type: string
          description: The key the machines and storage were made with. Omitted for what was made with no key (signed in to the console), and for `others`.
        name:
          type: string
          description: The key's name.
        accountId:
          type: string
          description: The person the key acts for, or who made it signed in to the console.
        email:
          type: string
          description: That person's email address.
        agentId:
          type: string
          description: The agent or CI pipeline the key acts as.
        source:
          type: string
          description: '`key`: one key''s. `console`: made signed in, with no key. `others`: keys the caller may not see, together. `unknown`: made by something deleted too long ago to name.'
        charged:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: Charged this month at the card's rates, in US dollars.
      required:
      - source
      - charged
    Error:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - code
          - message
          - requestId
          - hint
          - retryable
          properties:
            code:
              type: string
              enum:
              - invalid_request
              - unauthorized
              - payment_required
              - card_required
              - forbidden
              - limit_exceeded
              - not_found
              - method_not_allowed
              - already_exists
              - conflict
              - too_large
              - rate_limited
              - internal
              - not_implemented
              - unavailable
              - capacity_unavailable
              - timeout
            message:
              type: string
            requestId:
              type: string
              description: The answer's request-id header.
            hint:
              type: string
              description: What to do about it.
            retryable:
              type: boolean
              description: 'The same request, sent again after Retry-After, may pass: nothing was done.'
            param:
              type: string
              description: The request's field it is about.
            details:
              type: object
              description: Its case (`reason`) and the facts of it.
              properties:
                reason:
                  type: string
                  enum:
                  - invalid_request
                  - invalid_code
                  - invalid_network_rule
                  - system_label
                  - invalid_archive
                  - archive_failed
                  - not_a_directory
                  - is_a_directory
                  - exec_format_error
                  - limit_above_org
                  - unauthorized
                  - forbidden
                  - payment_required
                  - card_required
                  - card_declined
                  - public_preview_not_allowed
                  - permission_denied
                  - org_closing
                  - limit_not_set
                  - not_found
                  - route_not_found
                  - method_not_allowed
                  - image_not_found
                  - file_not_found
                  - cwd_not_found
                  - program_not_found
                  - process_not_found
                  - upload_not_found
                  - length_required
                  - already_exists
                  - name_taken
                  - conflict
                  - image_in_use
                  - not_supported
                  - precondition_failed
                  - sandbox_paused
                  - delete_protected
                  - confirmation_required
                  - idempotency_key_reused
                  - version_conflict
                  - upload_running
                  - upload_incomplete
                  - checksum_mismatch
                  - blobs_missing
                  - file_changed
                  - display_not_running
                  - browser_not_running
                  - kernel_not_installed
                  - act_failed
                  - root_unavailable
                  - image_lost
                  - archive_unavailable
                  - directory_not_empty
                  - stdin_closed
                  - stdin_busy
                  - fork_unsafe
                  - card_on_file
                  - no_card
                  - not_test_mode
                  - too_large
                  - file_too_large
                  - limit_exceeded
                  - quota_exceeded
                  - blob_store_full
                  - process_limit
                  - disk_full
                  - rate_limited
                  - transfer_limit
                  - internal
                  - sandbox_failed
                  - not_implemented
                  - previews_unavailable
                  - unavailable
                  - run_goes_on
                  - machine_restarting
                  - sign_in_unavailable
                  - secrets_unavailable
                  - billing_unavailable
                  - capacity_unavailable
                  - timeout
    ProductLine:
      type: object
      description: 'One meter''s part of one product''s month: a quantity at the card''s rate.'
      properties:
        product:
          type: string
          description: What it was used by, as `hours` names it (`sandbox`, `disk`, `traffic`, ...).
        meter:
          type: string
          description: The card's meter (`cpu`, `memory`, `traffic-out`, ...).
        name:
          type: string
          description: The meter's name on the card (`CPU`, `Memory`), from `names::METERS`.
        quantity:
          type: string
          description: Used this month, in `unit`, as a decimal in text.
        unit:
          type: string
          description: 'What `quantity` counts: `active vCPU-hours`, `GiB-hours`, `GiB-months`, `GB`, ...'
        rate:
          type: string
          description: The card's price for one of `unit`, as the card writes it (`$0.03 per active vCPU-hour`).
        charged:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: What it costs on the price card, before any credit, in US dollars.
      required:
      - product
      - meter
      - name
      - quantity
      - unit
      - rate
      - charged
    UsageLine:
      type: object
      description: One meter of one machine's, disk's or address's hour, as measured, at the card's price.
      properties:
        id:
          type: string
          description: 'The line''s ID: the same line has the same ID on every read.'
        subjectId:
          type: string
          description: 'The resource it was used by: a machine, a disk or an address.'
        resourceId:
          type: string
          description: The ID its product names it by (a machine's own ID).
        projectId:
          type: string
          description: Its project.
        meter:
          type: string
          description: The card's meter (`cpu`, `memory`, `standard`, `traffic-out`, ...).
        startsAt:
          type: string
          format: date-time
          description: The hour's first moment (UTC).
        endsAt:
          type: string
          format: date-time
          description: The hour's end.
        quantity:
          type: string
          description: What was used, in the meter's base unit, as an integer in text.
        unit:
          type: string
          description: 'The base unit: `core-microseconds`, `vcpu-microseconds`, `byte-seconds`, `bytes`, `calls` or `seconds`.'
        chargedMicros:
          type: string
          description: The hour alone at the card's rate, rounded down, in integer microdollars as text.
        rateMicros:
          type: string
          description: The card's rate, in microdollars per priced unit, as an integer in text.
        settledAt:
          type: string
          format: date-time
          description: 'When the line settles: its hour''s end (UTC). A line can change only until the page''s `finalThrough` reaches it.'
        final:
          type: boolean
          description: 'Whether the line is final: its `settledAt` is at or before the page''s `finalThrough`, and it never changes again.'
        resourceFinal:
          type: boolean
          description: Whether its resource is deleted and every line it will ever have is final.
      required:
      - id
      - subjectId
      - resourceId
      - projectId
      - meter
      - startsAt
      - endsAt
      - quantity
      - unit
      - chargedMicros
      - rateMicros
      - settledAt
      - final
      - resourceFinal
    MeterUse:
      type: object
      description: One meter's use and charges this month.
      properties:
        meter:
          type: string
          description: The card's meter (`cpu`, `memory`, `traffic-out`, ...).
        quantity:
          type: string
          description: Used this month, in the meter's base unit, as an integer in text.
        unit:
          type: string
          description: 'The base unit: `core-microseconds`, `vcpu-microseconds`, `byte-seconds`, `bytes`, `calls` or `seconds`.'
        charged:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: Charged this month at the card's rate, in US dollars.
      required:
      - meter
      - quantity
      - unit
      - charged
    KeyUsage:
      type: object
      description: 'One key''s spend and what its holder runs: a coordinator reads what each worker''s key spent.'
      properties:
        keyId:
          type: string
          description: The key's ID.
        name:
          type: string
          description: Its name.
        agentId:
          type: string
          description: The agent or CI pipeline it acts as.
        accountId:
          type: string
          description: The person it acts as or for.
        daySpent:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: What its calls committed in the last 24 hours, in US dollars, as its spend caps count it.
        periodSpent:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: What its calls committed this month (UTC), in US dollars.
        running:
          type: integer
          description: Its holder's machines running now.
        machines:
          type: integer
          description: Its holder's machines, not deleted.
      required:
      - keyId
      - name
      - daySpent
      - periodSpent
      - running
      - machines
    Limit:
      type: object
      description: One limit the org is held to, and what it uses of it now.
      properties:
        name:
          type: string
          description: '`running.vcpus`, `running.memory`, `machine.vcpus`, `machine.memory` or `starts.per-second`.'
        unit:
          type: string
          enum:
          - count
          - bytes
          - per-second
          description: What `max` and `used` count.
        max:
          type: integer
          description: The most it may hold; none for no limit.
        used:
          type: integer
          description: What it holds now.
      required:
      - name
      - unit
      - used
    Usage:
      type: object
      description: What the org has used and has left, at the card's prices.
      properties:
        orgId:
          type: string
          description: The organization.
        periodStart:
          type: string
          format: date-time
          description: The month's first moment (UTC).
        credited:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: Every credit ever added, in US dollars.
        spent:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: Every charge ever settled, in US dollars.
        available:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: 'What can still be spent: credited less spent, in US dollars.'
        periodSpent:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: Charged this month, in US dollars.
        meters:
          type: array
          items:
            $ref: '#/components/schemas/MeterUse'
          description: This month's use and charges by meter.
        plan:
          type: string
          description: Its plan on the price card.
        limits:
          type: array
          items:
            $ref: '#/components/schemas/Limit'
          description: 'Every limit it is held to, with what it uses of each now: the figures a create past one is refused by.'
        spendCap:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: The org's own cap on a month's charges, in US dollars.
        key:
          $ref: '#/components/schemas/KeyUsage'
        keySpendCap:
          $ref: '#/components/schemas/KeySpendCap'
        hours:
          type: array
          items:
            $ref: '#/components/schemas/UsageHour'
          description: 'With `by=hour`: what each product used each hour, since the month began or 7 days ago, whichever is earlier, oldest first. Only hours that cost something.'
        lines:
          type: array
          items:
            $ref: '#/components/schemas/ProductLine'
          description: 'With `by=hour`: what each product''s month is made of, a line for each meter it used, its quantity at the card''s rate. A product''s lines sum to its hours since the month began.'
        keys:
          type: array
          items:
            $ref: '#/components/schemas/KeySpend'
          description: 'With `by=key`: what each key''s machines and storage used this month, most first. A key the caller may not see is counted under `others`.'
      required:
      - orgId
      - periodStart
      - credited
      - spent
      - available
      - periodSpent
      - meters
      - plan
      - limits
    KeySpendCap:
      type: object
      description: The spend cap a key's creates are held to, and what is left under it.
      properties:
        cap:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: The most its holder's machines may spend over windowSeconds, in US dollars.
        spent:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: What they spent over the window, in US dollars, as the cap counts it.
        remaining:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: 'What is left: cap less spent, never below 0. Once 0, a create is refused 403 until the window passes it.'
        windowSeconds:
          type: integer
          description: The rolling window the cap counts over, in seconds.
      required:
      - cap
      - spent
      - remaining
      - windowSeconds
    UsageHour:
      type: object
      description: One product's use in one hour, at the card's prices.
      properties:
        at:
          type: string
          format: date-time
          description: The hour's first moment (UTC).
        product:
          type: string
          description: 'What it was used by: the machine''s kind (`sandbox`, `app`, `function`, `ci`, ...), what is kept on disk (`disk`, `volume`, `snapshot`, `image`), or `traffic`, what was sent out; `machine` or `storage` when what used it was deleted too long ago to name.'
        charged:
          type: string
          format: decimal
          pattern: ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,9})?$
          description: What it costs on the price card, before any credit, in US dollars.
      required:
      - at
      - product
      - charged
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
x-shortcuts:
- name: run
  description: Runs a command in a new sandbox and deletes the sandbox after, whether the command succeeded or not. Returns the command's result.
  inputSchema:
    type: object
    properties:
      cmd:
        oneOf:
        - type: string
          minLength: 1
          description: Run by bash -lc.
        - type: array
          items:
            type: string
          minItems: 1
          description: The program and its arguments, run without a shell.
        description: 'The command: text is run by `bash -lc`; a list is the program and its arguments, run without a shell.'
      image:
        type: string
        description: The image it boots, by name or ID; Runtime's default image when omitted.
      vcpu:
        type: integer
        description: Its vCPUs; 2 when omitted.
      memoryGB:
        type: number
        description: Its memory in GB (1 GB is 1,024 MiB); 4 when omitted.
      cwd:
        type: string
        description: The directory it runs in; the user's home when omitted.
      env:
        type: object
        additionalProperties:
          type: string
        description: Environment variables to add.
      stdin:
        type: string
        contentEncoding: base64
        description: Bytes sent to its standard input.
      timeoutSeconds:
        type: number
        description: Seconds it may run before it is stopped; it runs to its end when omitted.
    required:
    - cmd
  steps:
  - verb: sandboxes.create
    args:
      image:
        arg: image
      vcpu:
        arg: vcpu
      memoryGB:
        arg: memoryGB
    always: false
  - verb: sandboxes.exec
    args:
      id:
        step: 0
        field: id
      cmd:
        arg: cmd
      cwd:
        arg: cwd
      env:
        arg: env
      stdin:
        arg: stdin
      timeoutSeconds:
        arg: timeoutSeconds
    always: false
  - verb: sandboxes.delete
    args:
      id:
        step: 0
        field: id
    always: true
  answer: 1