# Agriaffaires Scraper - Used Farm & Ag Machinery (`serp.cheap.ofc/agriaffaires-scraper`) Actor

Scrape Agriaffaires listings — tractors, harvesters and farm/construction machinery across Europe. Search by category or brand and pull full details: price, year, hours, power, full spec table, photos and dealer contact incl. phone. Pay per result, no subscription.

- **URL**: https://apify.com/serp.cheap.ofc/agriaffaires-scraper.md
- **Developed by:** [serp.cheap](https://apify.com/serp.cheap.ofc) (community)
- **Categories:** E-commerce, Lead generation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Agriaffaires Scraper — Used Farm & Construction Machinery

Scrape **Agriaffaires**, Europe's largest agricultural & construction machinery marketplace, on
Apify. Browse by category or brand and pull **complete machine details** — price, year, hours,
power, the full spec table, every photo, and the **dealer's contact including phone number**.

**Pay per result, no start fee, no subscription.**

### Why this one

- **The full detail surface.** Each machine returns brand, model, year, price (excl. VAT), condition,
  the complete category-specific spec table (hours, power, width, hitch, equipment…), description and
  every full-resolution photo.
- **Dealer contact — with phone.** Dealer name, type (professional / private), SIRET, location with
  GPS coordinates, how many other machines they list, and the **phone number**.
- **Flexible search.** By category (`tracteur-agricole`, `moissonneuse-batteuse`, `telescopique`…),
  brand, or a pasted Agriaffaires URL — used or new. Pagination is automatic.
- **Self-monitored.** Every run checks upstream health, catching site changes early.

### Modes

Set `mode` in the input:

#### `search` — list machines

`{ "mode": "search", "category": "tracteur-agricole" }`
or paste URLs: `{ "mode": "search", "searchUrls": ["https://www.agriaffaires.com/occasion/1/moissonneuse-batteuse.html"] }`
Returns listing cards (title, price, year, hours, power, seller, location, thumbnail, URL). Set
`detailFollow: true` to also fetch each machine's full detail page (incl. dealer phone).

#### `detail` — full machine detail

`{ "mode": "detail", "detailUrls": ["https://www.agriaffaires.com/occasion/dechaumeur/46351874/amazone-catros-3004.html"] }`
Accepts Agriaffaires listing URLs. Returns the complete machine object with dealer contact.

#### `selftest` — free health check

Probes search + detail and reports which are healthy. No charge.

### Search filters

`category` (French slug), `condition` (`occasion` = used / `neuf` = new) — or just paste `searchUrls`.
`maxItems` caps how many results are returned.

### Notes

- Output is two dataset views: **Listings** (search cards) and **Machine detail** (full objects).
  Prices are in euros and quoted excluding VAT (HT), as on Agriaffaires. Text is in French.
- **A residential proxy is required** — the site blocks datacenter IPs.

### Pricing

Pay per result — no monthly fee, no start fee. See the Store pricing panel.

#### Free-call limit

Requests that return nothing you are charged for — a blocked page, a search that matches nothing,
a machine listing that has been sold or withdrawn, and the whole free `selftest` mode — are capped at
**300 per run**. Requests that do return billable results never count against it, so a normal run
of any size does not come close to the limit. If a run does reach it, it stops there, keeps and
charges everything it had already collected, and says so in the log.

# Actor input Schema

## `mode` (type: `string`):

'search' = list machines (by category / brand / pasted URL). 'detail' = full detail for specific listings. 'selftest' = free health check.

## `searchUrls` (type: `array`):

Paste one or more Agriaffaires category or search URLs (e.g. https://www.agriaffaires.com/occasion/1/tracteur-agricole.html). If set, the fields below are ignored. Pagination is automatic.

## `category` (type: `string`):

Machine category slug in French (e.g. tracteur-agricole, moissonneuse-batteuse, telescopique). Defaults to tracteur-agricole; the site has no all-categories browse page.

## `condition` (type: `string`):

Used or new machines.

## `detailUrls` (type: `array`):

For 'detail' mode: Agriaffaires listing URLs or paths.

## `detailFollow` (type: `boolean`):

In 'search' mode, also fetch each listing's detail page for the full spec surface and the seller phone. Costs one detail charge per listing (slower).

## `maxItems` (type: `integer`):

Cap on listings returned (search) or detail pages (detail).

## `proxyConfiguration` (type: `object`):

A residential proxy is required — the site blocks datacenter IPs.

## `debug` (type: `boolean`):

Verbose per-request logging for troubleshooting.

## Actor input object example

```json
{
  "mode": "search",
  "searchUrls": [],
  "category": "tracteur-agricole",
  "condition": "occasion",
  "detailFollow": false,
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "debug": false
}
```

# Actor output Schema

## `listings` (type: `string`):

No description

## `detail` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchUrls": [],
    "category": "tracteur-agricole"
};

// Run the Actor and wait for it to finish
const run = await client.actor("serp.cheap.ofc/agriaffaires-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchUrls": [],
    "category": "tracteur-agricole",
}

# Run the Actor and wait for it to finish
run = client.actor("serp.cheap.ofc/agriaffaires-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchUrls": [],
  "category": "tracteur-agricole"
}' |
apify call serp.cheap.ofc/agriaffaires-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,serp.cheap.ofc/agriaffaires-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/cWs3jaSA7t8uK4w1d/builds/NJUqRc1kVQFFEsqVn/openapi.json
