# 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 for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/credits/defacto/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## 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/credits/defacto/add-to-cart \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/defacto/get-category-products \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/defacto/get-product-detail \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/defacto/get-search-filters \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/defacto/search-products \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"page":"<integer>","query":"<string>"}'
```

## Next steps

- [All wrapped API providers](https://paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://paywithlocus.com/agent/index.md): every Locus agent page.