# City Electric Supply — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.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 for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/credits/city-electric-supply/`
**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 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.beta.paywithlocus.com/api/wrapped/credits/city-electric-supply/add-to-cart \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/city-electric-supply/get-cart \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/city-electric-supply/get-category-details \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/city-electric-supply/get-category-products \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/city-electric-supply/get-product-details \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/city-electric-supply/list-categories \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/city-electric-supply/search-products \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"limit":"<integer>","page":"<integer>","query":"<string>","zipcode":"<string>"}'
```

## Next steps

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