Skip to main content

Strategy Endpoints

Create and manage AI-generated extraction strategies via HTTP.

Generate strategy

Generate a new extraction strategy using AI.
POST /v1/strategies/generate

Request body

{
  "url": "https://example.com/products",
  "description": "Extract product names and prices",
  "name": "Product Scraper"
}
FieldTypeRequiredDescription
urlstringYesTarget webpage URL
descriptionstringYesWhat to extract
namestringYesStrategy name

Response

{
  "strategy_id": "550e8400-e29b-41d4-a716-446655440000",
  "strategy": {
    "container": {...},
    "fields": {...}
  },
  "preview_data": [
    {"name": "Product A", "price": "$19.99"},
    {"name": "Product B", "price": "$29.99"}
  ],
  "attempts": 1
}

Example

curl -X POST https://api.meter.sh/v1/strategies/generate \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://news.ycombinator.com",
    "description": "Extract post titles and scores",
    "name": "HN Front Page"
  }'

Refine strategy

Improve an existing strategy with feedback.
POST /v1/strategies/{strategy_id}/refine

Request body

{
  "feedback": "Also extract product images and SKU"
}

Response

Same as generate strategy response with updated preview data.

Example

curl -X POST https://api.meter.sh/v1/strategies/550e8400-e29b-41d4-a716-446655440000/refine \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"feedback": "Also extract product images"}'

List strategies

Get all strategies for the authenticated user.
GET /v1/strategies?limit=20&offset=0

Query parameters

ParameterTypeRequiredDescription
limitintegerNoMax results (default: 20)
offsetintegerNoResults to skip (default: 0)

Response

[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Product Scraper",
    "description": "Extract product names and prices",
    "url": "https://example.com/products",
    "preview_data": [...],
    "created_at": "2025-01-15T10:30:00Z",
    "updated_at": "2025-01-15T10:30:00Z"
  }
]

Example

curl https://api.meter.sh/v1/strategies?limit=10 \
  -H "Authorization: Bearer sk_live_..."

Get strategy

Get details for a specific strategy.
GET /v1/strategies/{strategy_id}

Response

Same format as list strategies items.

Example

curl https://api.meter.sh/v1/strategies/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer sk_live_..."

Delete strategy

Delete a strategy and all associated jobs and schedules.
DELETE /v1/strategies/{strategy_id}

Response

{
  "message": "Strategy deleted successfully"
}

Example

curl -X DELETE https://api.meter.sh/v1/strategies/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer sk_live_..."
This action is irreversible and deletes all associated resources.

Error responses

See REST API Errors for common error codes and solutions.

Next steps

Need help?

Email me at [email protected]