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

> Browse Ximalaya's audio content by exploring categories and albums, retrieving detailed album information and track listings, viewing user profiles, and reading user comments. Search for albums and discover audio content organized by category with complete metadata.

**Category:** Music | **Website:** [ximalaya.com/](https://ximalaya.com/) | **Docs:** [parse.bot/marketplace/68118e85-be31-48ac-a115-727d8b853d2e/ximalaya-com-api](https://parse.bot/marketplace/68118e85-be31-48ac-a115-727d8b853d2e/ximalaya-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/ximalaya/`
**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

### Get album comments

Retrieve comments for an album with pagination. Returns comment content, author nickname, likes, reply count, region, creation timestamp, and overall album score/rating statistics.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `album_id` | string | Yes | Numeric album ID (e.g. 77855794). Obtainable from get_category_albums or search_albums results. |
| `order` | string | No | Sort order for comments (e.g. content-score-desc). |
| `page` | integer | No | Page number for pagination. |
| `page_size` | integer | No | Number of comments per page. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/ximalaya/get-album-comments \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"album_id":"<string>","order":"<string>","page":"<integer>","page_size":"<integer>"}'
```

### Get album info

Retrieve detailed metadata for a single album by its numeric ID. Returns title, cover, play count, subscription count, pricing, intro text, category, creation/update dates, and anchor details. A single round-trip; no pagination.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `album_id` | string | Yes | Numeric album ID (e.g. 77855794). Obtainable from get_category_albums or search_albums results. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/ximalaya/get-album-info \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"album_id":"<string>"}'
```

### Get album tracks

List tracks within an album with pagination. Returns track title, duration (seconds), play count, likes, comments count, pricing info, and order number. Paginates via page number.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `album_id` | string | Yes | Numeric album ID (e.g. 77855794). Obtainable from get_category_albums or search_albums results. |
| `page` | integer | No | Page number for pagination. |
| `page_size` | integer | No | Number of tracks per page. |
| `sort_asc` | string | No | Sort order. Accepted values: true (ascending by track order), false (descending). |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/ximalaya/get-album-tracks \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"album_id":"<string>","page":"<integer>","page_size":"<integer>","sort_asc":"<string>"}'
```

### Get categories

Retrieve all top-level content categories on Ximalaya. Each category has a pinyin name usable as a key in get_category_albums. Returns the full category tree in one call (no pagination).

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/ximalaya/get-categories \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### Get category albums

List albums within a category, sorted by popularity. Category is identified by its pinyin name (from get_categories). Paginates via page number; each page returns up to page_size albums with play counts, track counts, and anchor info.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category_name` | string | No | Category pinyin name from get_categories (e.g. youshengshu, yinyue, ertong, xiangsheng, comic, finance, culture, kid, entertainment, train). |
| `page` | integer | No | Page number for pagination. |
| `page_size` | integer | No | Number of albums per page. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/ximalaya/get-category-albums \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"category_name":"<string>","page":"<integer>","page_size":"<integer>"}'
```

### Get user info

Retrieve public profile information for a user or anchor by numeric UID. Returns nickname, avatar, fan count, following count, track/album counts, personal signature, province/city, anchor grade, and live-stream status.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `uid` | string | Yes | Numeric user ID (e.g. 10778196). Obtainable from album or track details (anchorUid or uid field). |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/ximalaya/get-user-info \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"uid":"<string>"}'
```

### Search albums

Full-text search for albums by keyword. Supports Chinese and English queries. Returns paginated results with album summaries including play counts, track counts, anchor name, and intro text.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `page` | integer | No | Page number for pagination. |
| `page_size` | integer | No | Number of results per page. |
| `query` | string | Yes | Search keyword (supports Chinese characters and English). |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/ximalaya/search-albums \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"page":"<integer>","page_size":"<integer>","query":"<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.