# Indiavotes — 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.

> Access comprehensive Indian election data including Lok Sabha and Vidhan Sabha results, search candidates by name, explore constituency details, and compare party performance across historical elections. Track election results across states and parliamentary/assembly constituencies all in one place.

**Category:** Government & Public Data | **Website:** [indiavotes.com/](https://indiavotes.com/) | **Docs:** [parse.bot/marketplace/a898b513-d509-4cdd-afc3-51d29cb6a00e/indiavotes-com-api](https://parse.bot/marketplace/a898b513-d509-4cdd-afc3-51d29cb6a00e/indiavotes-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-indiavotes-com-api-a898b513/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_ac_elections

List available Vidhan Sabha (state assembly) election years for a specific state. Returns year and URL for each assembly election held in the state.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `state_slug` | string | Yes | URL slug of the state (e.g. 'maharashtra', 'karnataka', 'uttar-pradesh'). Obtained from get_pc_states or the Vidhan Sabha listing. |

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

### get_all_party_results

Get party-wise results for an election. For Lok Sabha (pc) without state_slug, returns all parties nationally with seats won, contested, vote share, and total votes. For Vidhan Sabha (ac), requires state_slug and returns party performance in that state's assembly election. Note: state-level filtering for pc returns constituency data from the first table on the page.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category` | string | No | Election category: 'pc' for Lok Sabha, 'ac' for Vidhan Sabha |
| `state_slug` | string | No | State slug. Required when category is 'ac'. For 'pc', omit to get national party results. |
| `year` | string | Yes | Election year (e.g. '2024', '2019') |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-indiavotes-com-api-a898b513/get_all_party_results \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"category":"<string>","state_slug":"<string>","year":"<string>"}'
```

### get_constituency_details

Get detailed candidate-wise results for a specific constituency in a Lok Sabha or Vidhan Sabha election. Returns ranked candidates with votes and vote share, plus past by-elections if any. For Lok Sabha (pc), URL pattern is /lok-sabha/{year}/{state}/{constituency}/. For Vidhan Sabha (ac), pattern is /vidhan-sabha/{state}/{year}/{constituency}/.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category` | string | No | Election category: 'pc' for Lok Sabha (Parliamentary Constituency), 'ac' for Vidhan Sabha (Assembly Constituency) |
| `constituency_slug` | string | Yes | URL slug of the constituency (e.g. 'mumbai-north', 'varanasi'). Obtained from Constituency_url in get_lok_sabha_results. |
| `state_slug` | string | Yes | URL slug for the state (e.g. 'maharashtra', 'uttar-pradesh') |
| `year` | string | Yes | Election year (e.g. '2024') |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-indiavotes-com-api-a898b513/get_constituency_details \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"category":"<string>","constituency_slug":"<string>","state_slug":"<string>","year":"<string>"}'
```

### get_lok_sabha_results

Get Lok Sabha election results. When state_slug is provided, returns constituency-level results for that state. Without state_slug, returns the national party summary and list of states. Each constituency result includes winner name, party, vote share, and margin.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `state_slug` | string | No | URL slug for the state (e.g. 'maharashtra', 'karnataka'). When omitted, returns national-level party summary and states list. |
| `year` | string | Yes | Lok Sabha election year (e.g. '2024', '2019'). Obtained from get_pc_elections. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-indiavotes-com-api-a898b513/get_lok_sabha_results \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"state_slug":"<string>","year":"<string>"}'
```

### get_pc_elections

List all Lok Sabha (Parliamentary) general elections from 1952 to 2024. Returns year and URL path for each election. Use the year value as input to other Lok Sabha endpoints.

**Estimated cost:** Metered

_No parameters required._

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

### get_pc_states

List states and union territories that participated in a specific Lok Sabha election year. Returns slug and name for each state. The slug is used as state_slug in other endpoints.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `year` | string | Yes | Lok Sabha election year (e.g. '2024', '2019', '1952'). Obtained from get_pc_elections. |

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

### search_candidates

Search for MPs and candidates by name using the site's fuzzy search index. Returns matching records with name, state, party, constituency, and profile URL. Matches against candidate name and constituency name. The search index covers all current and historical Lok Sabha MPs.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | Yes | Search term to match against candidate names and constituency names (e.g. 'Modi', 'Rahul Gandhi', 'Varanasi') |

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