Skip to main content
GET
/
v1
/
usage
/
runs
from retab import Retab

client = Retab()

# List recent workflow-run usage rows
runs = client.usage.list_runs(
    limit=20,
    order="desc",
)

# Filter by workflow and date range
runs = client.usage.list_runs(
    workflow_id="wf_123",
    from_date="2024-01-01",
    to_date="2024-12-31",
    limit=50,
)

for run in runs.data:
    print(run.run_id, run.credits, run.page_count)
import { Retab } from "@retab/node";

const client = new Retab({ apiKey: process.env.RETAB_API_KEY });

// List recent workflow-run usage rows
const runs = await client.usage.list_runs({
  limit: 20,
  order: "desc",
});

// Filter by workflow and date range
const filtered = await client.usage.list_runs({
  workflowId: "wf_123",
  fromDate: "2024-01-01",
  toDate: "2024-12-31",
  limit: 50,
});

console.log(runs.data, filtered.data);
package main

import (
	"context"
	"fmt"
	"log"

	retab "github.com/retab-dev/retab/clients/go"
)

func ptr[T any](v T) *T { return &v }

func main() {
	ctx := context.Background()

	client, err := retab.NewClient("")
	if err != nil {
		log.Fatal(err)
	}

	// List recent workflow-run usage rows
	runs, err := client.Usage.ListRuns(ctx, &retab.UsageListRunsParams{
		PaginationParams: retab.PaginationParams{Limit: ptr(20), Order: ptr("desc")},
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(runs)

	// Filter by workflow and date range
	filtered, err := client.Usage.ListRuns(ctx, &retab.UsageListRunsParams{
		PaginationParams: retab.PaginationParams{Limit: ptr(50)},
		WorkflowID:       ptr("wf_123"),
		FromDate:         ptr("2024-01-01"),
		ToDate:           ptr("2024-12-31"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(filtered)
}
import com.retab.RetabClient;

public final class Example {
  public static void main(String[] args) throws Exception {
    RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));

    var runs = client.usage().listRuns();
    System.out.println(runs);
  }
}
curl -X 'GET' \
  'https://api.retab.com/v1/usage/runs?limit=20&order=desc' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <your-api-key>'

# Filter by workflow and date range
curl -X 'GET' \
  'https://api.retab.com/v1/usage/runs?workflow_id=wf_123&from_date=2024-01-01&to_date=2024-12-31&limit=50' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <your-api-key>'
{
  "data": [
    {
      "run_id": "run_01G34H8J2K",
      "workflow_id": "wf_123",
      "status": "completed",
      "trigger_type": "api",
      "created_at": "2024-03-15T10:30:00Z",
      "started_at": "2024-03-15T10:30:01Z",
      "completed_at": "2024-03-15T10:30:12Z",
      "duration_ms": 11000,
      "page_count": 8,
      "credits": 12.5,
      "retry_count": 0,
      "execution_duration_ms": 9400
    }
  ],
  "list_metadata": {
    "before": null,
    "after": "run_01G34H8J2K"
  }
}
from retab import Retab

client = Retab()

# List recent workflow-run usage rows
runs = client.usage.list_runs(
    limit=20,
    order="desc",
)

# Filter by workflow and date range
runs = client.usage.list_runs(
    workflow_id="wf_123",
    from_date="2024-01-01",
    to_date="2024-12-31",
    limit=50,
)

for run in runs.data:
    print(run.run_id, run.credits, run.page_count)
import { Retab } from "@retab/node";

const client = new Retab({ apiKey: process.env.RETAB_API_KEY });

// List recent workflow-run usage rows
const runs = await client.usage.list_runs({
  limit: 20,
  order: "desc",
});

// Filter by workflow and date range
const filtered = await client.usage.list_runs({
  workflowId: "wf_123",
  fromDate: "2024-01-01",
  toDate: "2024-12-31",
  limit: 50,
});

console.log(runs.data, filtered.data);
package main

import (
	"context"
	"fmt"
	"log"

	retab "github.com/retab-dev/retab/clients/go"
)

func ptr[T any](v T) *T { return &v }

func main() {
	ctx := context.Background()

	client, err := retab.NewClient("")
	if err != nil {
		log.Fatal(err)
	}

	// List recent workflow-run usage rows
	runs, err := client.Usage.ListRuns(ctx, &retab.UsageListRunsParams{
		PaginationParams: retab.PaginationParams{Limit: ptr(20), Order: ptr("desc")},
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(runs)

	// Filter by workflow and date range
	filtered, err := client.Usage.ListRuns(ctx, &retab.UsageListRunsParams{
		PaginationParams: retab.PaginationParams{Limit: ptr(50)},
		WorkflowID:       ptr("wf_123"),
		FromDate:         ptr("2024-01-01"),
		ToDate:           ptr("2024-12-31"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(filtered)
}
import com.retab.RetabClient;

public final class Example {
  public static void main(String[] args) throws Exception {
    RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));

    var runs = client.usage().listRuns();
    System.out.println(runs);
  }
}
curl -X 'GET' \
  'https://api.retab.com/v1/usage/runs?limit=20&order=desc' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <your-api-key>'

# Filter by workflow and date range
curl -X 'GET' \
  'https://api.retab.com/v1/usage/runs?workflow_id=wf_123&from_date=2024-01-01&to_date=2024-12-31&limit=50' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <your-api-key>'
{
  "data": [
    {
      "run_id": "run_01G34H8J2K",
      "workflow_id": "wf_123",
      "status": "completed",
      "trigger_type": "api",
      "created_at": "2024-03-15T10:30:00Z",
      "started_at": "2024-03-15T10:30:01Z",
      "completed_at": "2024-03-15T10:30:12Z",
      "duration_ms": 11000,
      "page_count": 8,
      "credits": 12.5,
      "retry_count": 0,
      "execution_duration_ms": 9400
    }
  ],
  "list_metadata": {
    "before": null,
    "after": "run_01G34H8J2K"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

limit
integer
default:20

Maximum number of run rows to return.

Required range: 1 <= x <= 100
order
enum<string>
default:desc

Sort direction on run created_at.

Available options:
asc,
desc
before
string | null

Return runs before this run id (keyset cursor).

after
string | null

Return runs after this run id (keyset cursor).

workflow_id
string | null

Filter to a single workflow id.

status
string | null

Filter by lifecycle status: pending, queued, running, completed, error, failed, awaiting_review, or cancelled.

trigger_type
string | null

Filter by trigger type: manual, api, schedule, webhook, email, or restart.

from_date
string | null

Inclusive created_at lower bound (YYYY-MM-DD, UTC).

to_date
string | null

Inclusive created_at upper bound (YYYY-MM-DD, UTC).

Response

Successful Response

data
UsageRunRecord · object[]
required
list_metadata
ListMetadata · object
required

Boundary resource IDs for page navigation.