from retab import Retab
client = Retab()
# List per-block usage rows
blocks = client.usage.list_blocks(
limit=20,
order="desc",
)
# Filter by workflow and block type
blocks = client.usage.list_blocks(
workflow_id="wf_123",
block_type="extract",
limit=50,
)
for block in blocks.data:
print(block.block_id, block.credits, block.execution_count)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
// List per-block usage rows
const blocks = await client.usage.list_blocks({
limit: 20,
order: "desc",
});
// Filter by workflow and block type
const filtered = await client.usage.list_blocks({
workflowId: "wf_123",
blockType: "extract",
limit: 50,
});
console.log(blocks.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 per-block usage rows
blocks, err := client.Usage.ListBlocks(ctx, &retab.UsageListBlocksParams{
PaginationParams: retab.PaginationParams{Limit: ptr(20), Order: ptr("desc")},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(blocks)
// Filter by workflow and block type
filtered, err := client.Usage.ListBlocks(ctx, &retab.UsageListBlocksParams{
PaginationParams: retab.PaginationParams{Limit: ptr(50)},
WorkflowID: ptr("wf_123"),
BlockType: ptr("extract"),
})
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 blocks = client.usage().listBlocks();
System.out.println(blocks);
}
}
curl -X 'GET' \
'https://api.retab.com/v1/usage/blocks?limit=20&order=desc' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your-api-key>'
# Filter by workflow and block type
curl -X 'GET' \
'https://api.retab.com/v1/usage/blocks?workflow_id=wf_123&block_type=extract&limit=50' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your-api-key>'
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
# List per-block usage rows
blocks = client.usage.list_blocks(
limit: 20,
order: 'desc',
)
# Filter by workflow and date range
blocks = client.usage.list_blocks(
workflow_id: 'wf_123',
from_date: '2024-01-01',
to_date: '2024-12-31',
limit: 50,
)
blocks.data.each do |row|
puts row.block_id
end
use retab::resources::usage::ListBlocksParams;
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
// List per-block usage rows
let _blocks = client
.usage()
.list_blocks(ListBlocksParams {
limit: Some(20),
..Default::default()
})
.await?;
// Filter by workflow and date range
let _filtered = client
.usage()
.list_blocks(ListBlocksParams {
workflow_id: Some("wf_123".into()),
from_date: Some("2024-01-01".into()),
to_date: Some("2024-12-31".into()),
limit: Some(50),
..Default::default()
})
.await?;
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
// List per-block usage rows
$result = $client->usage()->listBlocks(limit: 20);
// Filter by workflow and date range
$filtered = $client->usage()->listBlocks(
workflowId: 'wf_123',
fromDate: '2024-01-01',
toDate: '2024-12-31',
limit: 50,
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
// List per-block usage rows
var result = await client.Usage.ListBlocksAsync(new UsageListBlocksOptions { Limit = 20 });
// Filter by workflow and date range
var filtered = await client.Usage.ListBlocksAsync(new UsageListBlocksOptions
{
WorkflowId = "wf_123",
FromDate = "2024-01-01",
ToDate = "2024-12-31",
Limit = 50,
});
Console.WriteLine(result);
{
"data": [
{
"block_id": "blk_01G34H8J2K",
"workflow_id": "wf_123",
"block_type": "extract",
"run_count": 42,
"execution_count": 201,
"page_count": 640,
"credits": 512.0,
"status_counts": {
"completed": 190,
"failed": 11
},
"first_activity_at": "2024-03-01T08:00:00Z",
"last_activity_at": "2024-03-15T10:30:12Z"
}
],
"list_metadata": {
"before": null,
"after": "blk_01G34H8J2K"
}
}
Usage
List Usage Blocks
One row per workflow block with its credits, pages, runs and executions. An extract block’s execution_count and status_counts include the cited sources pass of each extraction it made in an organization that uses cited sources (billed once per extraction; see Pricing), and its credits include their cost; its page_count counts each document once.
GET
/
v1
/
usage
/
blocks
from retab import Retab
client = Retab()
# List per-block usage rows
blocks = client.usage.list_blocks(
limit=20,
order="desc",
)
# Filter by workflow and block type
blocks = client.usage.list_blocks(
workflow_id="wf_123",
block_type="extract",
limit=50,
)
for block in blocks.data:
print(block.block_id, block.credits, block.execution_count)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
// List per-block usage rows
const blocks = await client.usage.list_blocks({
limit: 20,
order: "desc",
});
// Filter by workflow and block type
const filtered = await client.usage.list_blocks({
workflowId: "wf_123",
blockType: "extract",
limit: 50,
});
console.log(blocks.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 per-block usage rows
blocks, err := client.Usage.ListBlocks(ctx, &retab.UsageListBlocksParams{
PaginationParams: retab.PaginationParams{Limit: ptr(20), Order: ptr("desc")},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(blocks)
// Filter by workflow and block type
filtered, err := client.Usage.ListBlocks(ctx, &retab.UsageListBlocksParams{
PaginationParams: retab.PaginationParams{Limit: ptr(50)},
WorkflowID: ptr("wf_123"),
BlockType: ptr("extract"),
})
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 blocks = client.usage().listBlocks();
System.out.println(blocks);
}
}
curl -X 'GET' \
'https://api.retab.com/v1/usage/blocks?limit=20&order=desc' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your-api-key>'
# Filter by workflow and block type
curl -X 'GET' \
'https://api.retab.com/v1/usage/blocks?workflow_id=wf_123&block_type=extract&limit=50' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your-api-key>'
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
# List per-block usage rows
blocks = client.usage.list_blocks(
limit: 20,
order: 'desc',
)
# Filter by workflow and date range
blocks = client.usage.list_blocks(
workflow_id: 'wf_123',
from_date: '2024-01-01',
to_date: '2024-12-31',
limit: 50,
)
blocks.data.each do |row|
puts row.block_id
end
use retab::resources::usage::ListBlocksParams;
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
// List per-block usage rows
let _blocks = client
.usage()
.list_blocks(ListBlocksParams {
limit: Some(20),
..Default::default()
})
.await?;
// Filter by workflow and date range
let _filtered = client
.usage()
.list_blocks(ListBlocksParams {
workflow_id: Some("wf_123".into()),
from_date: Some("2024-01-01".into()),
to_date: Some("2024-12-31".into()),
limit: Some(50),
..Default::default()
})
.await?;
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
// List per-block usage rows
$result = $client->usage()->listBlocks(limit: 20);
// Filter by workflow and date range
$filtered = $client->usage()->listBlocks(
workflowId: 'wf_123',
fromDate: '2024-01-01',
toDate: '2024-12-31',
limit: 50,
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
// List per-block usage rows
var result = await client.Usage.ListBlocksAsync(new UsageListBlocksOptions { Limit = 20 });
// Filter by workflow and date range
var filtered = await client.Usage.ListBlocksAsync(new UsageListBlocksOptions
{
WorkflowId = "wf_123",
FromDate = "2024-01-01",
ToDate = "2024-12-31",
Limit = 50,
});
Console.WriteLine(result);
{
"data": [
{
"block_id": "blk_01G34H8J2K",
"workflow_id": "wf_123",
"block_type": "extract",
"run_count": 42,
"execution_count": 201,
"page_count": 640,
"credits": 512.0,
"status_counts": {
"completed": 190,
"failed": 11
},
"first_activity_at": "2024-03-01T08:00:00Z",
"last_activity_at": "2024-03-15T10:30:12Z"
}
],
"list_metadata": {
"before": null,
"after": "blk_01G34H8J2K"
}
}
from retab import Retab
client = Retab()
# List per-block usage rows
blocks = client.usage.list_blocks(
limit=20,
order="desc",
)
# Filter by workflow and block type
blocks = client.usage.list_blocks(
workflow_id="wf_123",
block_type="extract",
limit=50,
)
for block in blocks.data:
print(block.block_id, block.credits, block.execution_count)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
// List per-block usage rows
const blocks = await client.usage.list_blocks({
limit: 20,
order: "desc",
});
// Filter by workflow and block type
const filtered = await client.usage.list_blocks({
workflowId: "wf_123",
blockType: "extract",
limit: 50,
});
console.log(blocks.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 per-block usage rows
blocks, err := client.Usage.ListBlocks(ctx, &retab.UsageListBlocksParams{
PaginationParams: retab.PaginationParams{Limit: ptr(20), Order: ptr("desc")},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(blocks)
// Filter by workflow and block type
filtered, err := client.Usage.ListBlocks(ctx, &retab.UsageListBlocksParams{
PaginationParams: retab.PaginationParams{Limit: ptr(50)},
WorkflowID: ptr("wf_123"),
BlockType: ptr("extract"),
})
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 blocks = client.usage().listBlocks();
System.out.println(blocks);
}
}
curl -X 'GET' \
'https://api.retab.com/v1/usage/blocks?limit=20&order=desc' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your-api-key>'
# Filter by workflow and block type
curl -X 'GET' \
'https://api.retab.com/v1/usage/blocks?workflow_id=wf_123&block_type=extract&limit=50' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your-api-key>'
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
# List per-block usage rows
blocks = client.usage.list_blocks(
limit: 20,
order: 'desc',
)
# Filter by workflow and date range
blocks = client.usage.list_blocks(
workflow_id: 'wf_123',
from_date: '2024-01-01',
to_date: '2024-12-31',
limit: 50,
)
blocks.data.each do |row|
puts row.block_id
end
use retab::resources::usage::ListBlocksParams;
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
// List per-block usage rows
let _blocks = client
.usage()
.list_blocks(ListBlocksParams {
limit: Some(20),
..Default::default()
})
.await?;
// Filter by workflow and date range
let _filtered = client
.usage()
.list_blocks(ListBlocksParams {
workflow_id: Some("wf_123".into()),
from_date: Some("2024-01-01".into()),
to_date: Some("2024-12-31".into()),
limit: Some(50),
..Default::default()
})
.await?;
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
// List per-block usage rows
$result = $client->usage()->listBlocks(limit: 20);
// Filter by workflow and date range
$filtered = $client->usage()->listBlocks(
workflowId: 'wf_123',
fromDate: '2024-01-01',
toDate: '2024-12-31',
limit: 50,
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
// List per-block usage rows
var result = await client.Usage.ListBlocksAsync(new UsageListBlocksOptions { Limit = 20 });
// Filter by workflow and date range
var filtered = await client.Usage.ListBlocksAsync(new UsageListBlocksOptions
{
WorkflowId = "wf_123",
FromDate = "2024-01-01",
ToDate = "2024-12-31",
Limit = 50,
});
Console.WriteLine(result);
{
"data": [
{
"block_id": "blk_01G34H8J2K",
"workflow_id": "wf_123",
"block_type": "extract",
"run_count": 42,
"execution_count": 201,
"page_count": 640,
"credits": 512.0,
"status_counts": {
"completed": 190,
"failed": 11
},
"first_activity_at": "2024-03-01T08:00:00Z",
"last_activity_at": "2024-03-15T10:30:12Z"
}
],
"list_metadata": {
"before": null,
"after": "blk_01G34H8J2K"
}
}