# Divar — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Search for classified listings across Iran's largest marketplace by city, category, and keywords to find products, services, and deals. Access detailed information about specific posts including pricing, descriptions, and seller details to make informed purchasing decisions.

**Category:** Marketplaces | **Website:** [www.divar.ir/](https://www.divar.ir/) | **Docs:** [parse.bot/marketplace/95b1c84a-73c9-4fd2-8312-196f87b9a591/divar-ir-api](https://parse.bot/marketplace/95b1c84a-73c9-4fd2-8312-196f87b9a591/divar-ir-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-divar-ir-api-95b1c84a/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_post_details

Retrieve full details of a single Divar listing by its token. Returns structured data including title, description, category breadcrumb, item properties (condition, price, type-specific attributes), images with thumbnails, and geographic location coordinates. The token is obtained from search_posts results.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `token` | string | Yes | The unique post token identifier, obtained from search_posts results (e.g. 'garQy9Dl'). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-divar-ir-api-95b1c84a/get_post_details \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"token":"<string>"}'
```

### search_posts

Search and list classified ad posts on Divar. Accepts a city slug, optional free-text query, and category filter. Returns a list of post summaries including title, price text, location, and image info. Results are sorted by newest first. Each post carries a token usable with get_post_details for the full listing.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category` | string | No | Category slug to filter results. Use ROOT for all categories. Examples of category slugs: personal, clothing-and-shoes, clothing, vehicles, real-estate, digital-goods, home-kitchen, services, entertainment, industrial, jobs. |
| `city` | string | No | City slug for filtering posts. Accepted values: tehran, mashhad, karaj, shiraz, isfahan, ahvaz, tabriz, kermanshah, qom, rasht. Alternatively, pass a numeric city ID directly. |
| `limit` | integer | No | Maximum number of posts to return from the search results. |
| `query` | string | No | Free-text search query to match against post titles and descriptions. Empty string returns all recent posts. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-divar-ir-api-95b1c84a/search_posts \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"category":"<string>","city":"<string>","limit":"<integer>","query":"<string>"}'
```
