MeterClient
TheMeterClient class is the main interface for all Meter API operations. It handles authentication, request management, and provides methods for strategies, jobs, and schedules.
Constructor
Parameters
Example
Context Manager
The client can be used as a context manager for automatic resource cleanup:Strategy Methods
generate_strategy()
Generate a new extraction strategy using AI.
Returns:
Dict with fields:
strategy_id(str): UUID of the created strategystrategy(dict): The extraction strategy (CSS selectors, fields)preview_data(list): Sample extracted data (first 5-10 items)attempts(int): Number of generation attempts (usually 1)scraper_type(str): Type of scraper used -'css'or'api'api_parameters(dict, optional): Available URL parameters for API-based strategies
MeterError if generation fails
When
force_api=True, Meter will attempt to identify and capture underlying API calls
instead of using CSS selectors. This is useful for sites that load data dynamically
via JavaScript APIs.refine_strategy()
Refine an existing strategy with feedback.
Returns:
Dict with same fields as generate_strategy()
Example:
Refinement uses cached HTML from initial generation, so it’s fast and doesn’t re-fetch the page.
list_strategies()
List all strategies for the authenticated user.
Returns:
List[Dict] where each dict contains:
id(str): Strategy UUIDname(str): Strategy namedescription(str): Extraction descriptionurl(str): Original URL used for generationpreview_data(list): Sample extracted datacreated_at(str): ISO timestampupdated_at(str): ISO timestamp
get_strategy()
Get details for a specific strategy.
Returns:
Dict with full strategy details (same fields as list_strategies() items)
Example:
MeterError with 404 if strategy not found
delete_strategy()
Delete a strategy and all associated jobs and schedules.
Returns:
Dict with confirmation message
Example:
Job Methods
create_job()
Create a new scrape job using a strategy.
Returns:
Dict with fields:
job_id(str): UUID of the created job (single URL)batch_id(str): Batch UUID for tracking progress (multiple URLs)status(str): Job status (usually “pending”)strategy_id(str): Strategy UUIDurl(str): Target URLparameters(dict, optional): Parameters used for this jobcreated_at(str): ISO timestamp
You must provide either
url or urls, but not both. The parameters option
only applies to API-based strategies (where scraper_type is 'api').execute_job()
Create and execute a scrape job synchronously. Returns results directly without polling.
Returns:
Dict with completed job details including results
Example:
MeterError if job fails or times out
This endpoint blocks until the job completes (up to 1 hour timeout). Use
create_job() + wait_for_job() for more control over polling behavior, or create_job() alone for fire-and-forget jobs.get_job()
Get status and results for a job.
Returns:
Dict with fields:
job_id(str): Job UUIDstatus(str): “pending”, “running”, “completed”, or “failed”results(list): Extracted data (only if status is “completed”)item_count(int): Number of items extractedcontent_hash(str): Hash for change detectionstructural_signature(dict): Structural fingerprinterror(str): Error message (only if status is “failed”)started_at(str): ISO timestampcompleted_at(str): ISO timestampcreated_at(str): ISO timestamp
wait_for_job()
Wait for a job to complete, polling automatically.
Returns:
Dict with completed job details (same as get_job())
Example:
MeterError if timeout exceeded or job fails
list_jobs()
List jobs with optional filtering.
Returns:
List[Dict] of job summaries
Example:
compare_jobs()
Compare two jobs to detect changes.
Returns:
Dict with fields:
content_hash_match(bool): True if content hashes matchstructural_match(bool): True if structure matchessemantic_similarity(float): Similarity score 0.0-1.0 (planned feature)changes(list): Detected structural changes
get_strategy_history()
Get timeline of all jobs for a strategy.
Returns:
List[Dict] where each dict contains:
job_id(str): Job UUIDstatus(str): Job statusitem_count(int): Items extractedhas_changes(bool): True if content changed vs. previous jobcreated_at(str): ISO timestamp
Schedule Methods
create_schedule()
Create a new recurring schedule.
Returns:
Dict with schedule details
Example:
You must provide either
url or urls, but not both. You must also provide
either interval_seconds or cron_expression, but not both.list_schedules()
List all schedules for the authenticated user.List[Dict] of schedules
Example:
update_schedule()
Update an existing schedule.
Returns:
Dict with updated schedule details
Example:
Setting
url will clear urls, and vice versa.delete_schedule()
Delete a schedule (stops future jobs).
Returns:
Dict with confirmation message
Example:
get_schedule_changes()
Get unseen changes for a schedule (pull-based change detection).
Returns:
Dict with fields:
schedule_id(str): Schedule UUIDchanges(list): Jobs with changes (full job details)count(int): Number of changed jobsmarked_seen(bool): Whether changes were marked as seen
regenerate_webhook_secret()
Regenerate the webhook secret for a schedule. The old secret is immediately invalidated.
Returns:
Dict with schedule_id and the new webhook_secret
Example:
MeterError if schedule has no webhook URL configured
Workflow Methods
For workflow methods (create_workflow, run_workflow, wait_for_workflow, etc.), see the dedicated Workflow Methods reference.
Strategy Group Methods
Manage collections of strategies with shared schedules and output schemas. See Strategy Groups for concepts.create_strategy_group()
Create a new strategy group.
Returns:
Dict with id, name, description, strategy_count, created_at, updated_at
Example:
list_strategy_groups()
List all strategy groups.
Returns:
List[Dict] of strategy groups with strategy counts
Example:
get_strategy_group()
Get group details including member strategies.
Returns:
Dict with id, name, description, strategies (list), created_at, updated_at
Example:
update_strategy_group()
Update a group’s name or description.
Returns:
Dict with updated group details
delete_strategy_group()
Delete a group. Strategies become ungrouped (not deleted).
Returns:
Dict with confirmation message
add_strategies_to_group()
Add existing strategies to a group.
Returns:
Dict with confirmation message
Example:
remove_strategy_from_group()
Remove a strategy from a group without deleting it.
Returns:
Dict with confirmation message
apply_group_schedule()
Apply a schedule to all strategies in a group.
Returns:
Dict with message, created count, updated count
Example:
Provide either
interval_seconds or cron_expression, not both.delete_group_schedules()
Delete all schedules for strategies in a group.toggle_group_schedules()
Enable or disable all schedules in a group.apply_group_schema()
Apply an output schema to all strategies in a group. Triggers async regeneration.
Returns:
Dict with message and strategy_count
Example:
get_schema_progress()
Poll progress of a group schema regeneration.test_group_webhook()
Send a test webhook using a group’s webhook configuration.Dict with success, status_code, message
Error Handling
All methods raiseMeterError on API errors. See Error Handling for details.
Next steps
Error Handling
Learn about error handling and exceptions
Quick Start
See the SDK in action with examples
Strategies Guide
Deep dive into strategy concepts
Jobs Guide
Understanding job lifecycle