# City Electric Supply — 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 City Electric Supply's product catalog across categories, view detailed product information with localized pricing and inventory based on a ZIP code, and manage a shopping cart. Access product details and real-time stock availability for any area.

**Category:** E-commerce | **Website:** [cityelectricsupply.com/](https://cityelectricsupply.com/) | **Docs:** [parse.bot/marketplace/4e332344-f03a-4b25-820e-ca4adf3e021f/cityelectricsupply-com-api](https://parse.bot/marketplace/4e332344-f03a-4b25-820e-ca4adf3e021f/cityelectricsupply-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-cityelectricsupply-com-api-4e332344/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### add_to_cart

Add a product to the guest shopping cart. Returns a success status confirmation. The cart persists across calls within the same session. Fails with upstream_error if quantity exceeds available stock.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `product_id` | integer | Yes | Internal product ID to add (from search_products or get_product_details) |
| `quantity` | integer | No | Quantity to add |

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

### get_cart

Retrieve current guest shopping cart contents including line items with product details and pricing, applied promotions, and an order summary with subtotals and shipping status.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-cityelectricsupply-com-api-4e332344/get_cart \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_category_details

Retrieve category details and its direct subcategories. Accepts category_id or slug as identifier (at least one required). Returns the category name, images, SEO metadata, and an array of child categories with their own IDs and slugs.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category_id` | integer | No | Internal category ID (from list_categories or search_products categoryFilters) |
| `slug` | string | No | Category URL slug (from list_categories results urlSlug field) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-cityelectricsupply-com-api-4e332344/get_category_details \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"category_id":"<integer>","slug":"<string>"}'
```

### get_category_products

Browse products within a specific category. Returns paginated product summaries with attribute filters and sort options. Pagination is 0-based page indexing. Accepts category_id or slug as identifier (at least one required).

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category_id` | integer | No | Internal category ID (from list_categories or get_category_details) |
| `limit` | integer | No | Number of results per page |
| `page` | integer | No | Page index (0-based) |
| `slug` | string | No | Category URL slug |
| `zipcode` | string | No | 5-digit US ZIP code for localized pricing and inventory |

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

### get_product_details

Retrieve full product details including specifications, stock levels, images, categories, and manufacturer info. Accepts product_id, slug, or stock_code as identifier (at least one required). The slug or stock_code is resolved internally to a product_id before fetching. Returns 404-equivalent stale_input when the product does not exist.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `product_id` | integer | No | Internal product ID (from search_products results) |
| `slug` | string | No | Product URL slug (from search_products results productDetailPageUrl field) |
| `stock_code` | string | No | CES stock code (e.g. 0544-0020) |
| `zipcode` | string | No | 5-digit US ZIP code for localized pricing and inventory |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-cityelectricsupply-com-api-4e332344/get_product_details \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"product_id":"<integer>","slug":"<string>","stock_code":"<string>","zipcode":"<string>"}'
```

### list_categories

List all top-level product categories in a single call (no pagination). Returns category IDs, names, slugs, image URLs, and SEO metadata. Use category IDs or slugs to drill into subcategories via get_category_details or browse products via get_category_products.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-cityelectricsupply-com-api-4e332344/list_categories \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### search_products

Full-text search over the CES product catalog by keyword, SKU, or part number. Returns paginated product summaries with attribute filters, category facets, sort options, and total match count. Pagination is 0-based page indexing. Supports localized pricing and inventory when a zipcode is provided.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `limit` | integer | No | Number of results per page |
| `page` | integer | No | Page index (0-based) |
| `query` | string | Yes | Search keyword, SKU, or part number |
| `zipcode` | string | No | 5-digit US ZIP code for localized pricing and inventory |

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