# Defacto — 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 and browse fashion products on DeFacto, view detailed item information including specs, pricing, and available variants, and manage shopping cart operations programmatically. Filter products by category, color, size, price range, and other criteria to find items across their apparel catalog.

**Category:** E-commerce | **Website:** [defacto.com/](https://defacto.com/) | **Docs:** [parse.bot/marketplace/b95f25d1-48d3-4536-916a-71c1efec0bd2/defacto-com-api](https://parse.bot/marketplace/b95f25d1-48d3-4536-916a-71c1efec0bd2/defacto-com-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-defacto-com-api-b95f25d1/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### add_to_cart

Add a product variant to the shopping cart. Requires a ProductVariantMatrixId UUID obtained from get_product_detail Sizes array. Returns a confirmation message on success.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `quantity` | integer | No | Quantity to add. |
| `variant_id` | string | Yes | The ProductVariantMatrixId UUID for the size variant, from get_product_detail Sizes array. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-defacto-com-api-b95f25d1/add_to_cart \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"quantity":"<integer>","variant_id":"<string>"}'
```

### get_category_products

Retrieve products from a specific category by URL slug. Returns paginated product listings (up to 24 per page). Category slugs are path segments from defacto.com.tr URLs.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `page` | integer | No | Page number for pagination. |
| `slug` | string | Yes | Category URL slug (e.g. 'erkek-tisort', 'kadin-elbise'). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-defacto-com-api-b95f25d1/get_category_products \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"page":"<integer>","slug":"<string>"}'
```

### get_product_detail

Fetch detailed product information by long code. Returns full product data including all available sizes with ProductVariantMatrixId (usable with add_to_cart), available color variants with swatches, product pictures, and pricing. The long code is obtainable from search or category listing results.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `product_code` | string | Yes | Product long code (e.g. 'V7699AZ26SPBK81'). Obtainable from search_products or get_category_products LongCode field. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-defacto-com-api-b95f25d1/get_product_detail \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"product_code":"<string>"}'
```

### get_search_filters

Retrieve available filter facets for a search query or category. Returns filter groups (sort, gender, category, size, color, price range, etc.) with selectable options and product counts. Provide either query or slug.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | No | Search keyword to get filters for. Provide either query or slug. |
| `slug` | string | No | Category slug to get filters for. Provide either query or slug. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-defacto-com-api-b95f25d1/get_search_filters \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"<string>","slug":"<string>"}'
```

### search_products

Full-text search over DeFacto Turkey's product catalog. Returns paginated product listings matching the keyword. Each page contains up to 24 products with pricing, color, stock, size, and campaign badge information.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `page` | integer | No | Page number for pagination. |
| `query` | string | Yes | Search keyword (e.g. 'tshirt', 'elbise', 'jean'). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-defacto-com-api-b95f25d1/search_products \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"page":"<integer>","query":"<string>"}'
```
